Compare commits
No commits in common. "658b9d9cc74b1ae177687a73a83fb07fecb41ddf" and "ed16cdd61d87cbdb13c52a7c2b9e4711b0a8b08c" have entirely different histories.
658b9d9cc7
...
ed16cdd61d
6 changed files with 16 additions and 80 deletions
|
@ -1,6 +1,7 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FixedSizeList as List } from 'react-window';
|
import { FixedSizeList as List } from 'react-window';
|
||||||
import { Properties } from '../Properties/Properties';
|
import { Properties } from '../Properties/Properties';
|
||||||
|
import ContainerProperties from '../../Interfaces/IProperties';
|
||||||
import { IContainerModel } from '../../Interfaces/IContainerModel';
|
import { IContainerModel } from '../../Interfaces/IContainerModel';
|
||||||
import { getDepth, MakeIterator } from '../../utils/itertools';
|
import { getDepth, MakeIterator } from '../../utils/itertools';
|
||||||
import { Menu } from '../Menu/Menu';
|
import { Menu } from '../Menu/Menu';
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { MenuAlt2Icon, MenuAlt3Icon, MenuIcon } from '@heroicons/react/outline';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { XPositionReference } from '../../Enums/XPositionReference';
|
import { XPositionReference } from '../../Enums/XPositionReference';
|
||||||
import IProperties from '../../Interfaces/IProperties';
|
import IProperties from '../../Interfaces/IProperties';
|
||||||
|
@ -108,33 +107,11 @@ const DynamicForm: React.FunctionComponent<IDynamicFormProps> = (props) => {
|
||||||
<RadioGroupButtons
|
<RadioGroupButtons
|
||||||
name='XPositionReference'
|
name='XPositionReference'
|
||||||
value={props.properties.XPositionReference.toString()}
|
value={props.properties.XPositionReference.toString()}
|
||||||
inputClassName='hidden'
|
|
||||||
labelText='Horizontal alignment'
|
labelText='Horizontal alignment'
|
||||||
inputGroups={[
|
inputGroups={[
|
||||||
{
|
{ text: 'Left', value: XPositionReference.Left.toString() },
|
||||||
text: (
|
{ text: 'Center', value: XPositionReference.Center.toString() },
|
||||||
<div title='Left' aria-label='left' className='radio-button-icon'>
|
{ text: 'Right', value: XPositionReference.Right.toString() }
|
||||||
<MenuAlt2Icon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Left.toString()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: (
|
|
||||||
<div title='Center' aria-label='center' className='radio-button-icon'>
|
|
||||||
<MenuIcon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Center.toString()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: (
|
|
||||||
<div title='Right' aria-label='right' className='radio-button-icon'>
|
|
||||||
<MenuAlt3Icon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Right.toString()
|
|
||||||
}
|
|
||||||
]}
|
]}
|
||||||
onChange={(event) => props.onChange('XPositionReference', event.target.value)}
|
onChange={(event) => props.onChange('XPositionReference', event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { MenuAlt2Icon, MenuIcon, MenuAlt3Icon } from '@heroicons/react/outline';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { XPositionReference } from '../../Enums/XPositionReference';
|
import { XPositionReference } from '../../Enums/XPositionReference';
|
||||||
import IProperties from '../../Interfaces/IProperties';
|
import IProperties from '../../Interfaces/IProperties';
|
||||||
|
@ -102,33 +101,11 @@ const StaticForm: React.FunctionComponent<IStaticFormProps> = (props) => {
|
||||||
<RadioGroupButtons
|
<RadioGroupButtons
|
||||||
name='XPositionReference'
|
name='XPositionReference'
|
||||||
defaultValue={props.properties.XPositionReference.toString()}
|
defaultValue={props.properties.XPositionReference.toString()}
|
||||||
inputClassName='hidden'
|
|
||||||
labelText='Horizontal alignment'
|
labelText='Horizontal alignment'
|
||||||
inputGroups={[
|
inputGroups={[
|
||||||
{
|
{ text: 'Left', value: XPositionReference.Left.toString() },
|
||||||
text: (
|
{ text: 'Center', value: XPositionReference.Center.toString() },
|
||||||
<div title='Left' aria-label='left' className='radio-button-icon'>
|
{ text: 'Right', value: XPositionReference.Right.toString() }
|
||||||
<MenuAlt2Icon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Left.toString()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: (
|
|
||||||
<div title='Center' aria-label='center' className='radio-button-icon'>
|
|
||||||
<MenuIcon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Center.toString()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: (
|
|
||||||
<div title='Right' aria-label='right' className='radio-button-icon'>
|
|
||||||
<MenuAlt3Icon className='heroicon' />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
value: XPositionReference.Right.toString()
|
|
||||||
}
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
{ getCSSInputs(props.properties) }
|
{ getCSSInputs(props.properties) }
|
||||||
|
|
|
@ -5,7 +5,6 @@ interface IRadioGroupButtonsProps {
|
||||||
name: string
|
name: string
|
||||||
value?: string
|
value?: string
|
||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
inputClassName: string
|
|
||||||
labelText: string
|
labelText: string
|
||||||
inputGroups: IInputGroup[]
|
inputGroups: IInputGroup[]
|
||||||
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
||||||
|
@ -14,40 +13,30 @@ interface IRadioGroupButtonsProps {
|
||||||
export const RadioGroupButtons: React.FunctionComponent<IRadioGroupButtonsProps> = (props) => {
|
export const RadioGroupButtons: React.FunctionComponent<IRadioGroupButtonsProps> = (props) => {
|
||||||
let inputGroups;
|
let inputGroups;
|
||||||
if (props.value !== undefined) {
|
if (props.value !== undefined) {
|
||||||
// dynamic
|
|
||||||
inputGroups = props.inputGroups.map((inputGroup) => (
|
inputGroups = props.inputGroups.map((inputGroup) => (
|
||||||
<div key={inputGroup.value}>
|
<label key={inputGroup.value}>
|
||||||
<input
|
<input
|
||||||
id={inputGroup.value}
|
|
||||||
type='radio'
|
type='radio'
|
||||||
name={props.name}
|
name={props.name}
|
||||||
className={`peer m-2 ${props.inputClassName}`}
|
|
||||||
value={inputGroup.value}
|
value={inputGroup.value}
|
||||||
checked={props.value === inputGroup.value}
|
checked={props.value === inputGroup.value}
|
||||||
onChange={props.onChange}
|
onChange={props.onChange}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={inputGroup.value} className='text-gray-400 peer-checked:text-blue-500'>
|
{inputGroup.text}
|
||||||
{inputGroup.text}
|
</label>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
// static
|
|
||||||
inputGroups = props.inputGroups.map((inputGroup) => (
|
inputGroups = props.inputGroups.map((inputGroup) => (
|
||||||
<div key={inputGroup.value}>
|
<label key={inputGroup.value}>
|
||||||
<input
|
<input
|
||||||
id={inputGroup.value}
|
|
||||||
type='radio'
|
type='radio'
|
||||||
name={props.name}
|
name={props.name}
|
||||||
className={`peer m-2 ${props.inputClassName}`}
|
|
||||||
value={inputGroup.value}
|
value={inputGroup.value}
|
||||||
defaultChecked={props.defaultValue === inputGroup.value}
|
defaultChecked={props.defaultValue === inputGroup.value}
|
||||||
|
onChange={props.onChange}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={inputGroup.value} className='text-gray-400 peer-checked:text-blue-500'>
|
{inputGroup.text}
|
||||||
{inputGroup.text}
|
</label>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +45,7 @@ export const RadioGroupButtons: React.FunctionComponent<IRadioGroupButtonsProps>
|
||||||
<label>
|
<label>
|
||||||
{props.labelText}
|
{props.labelText}
|
||||||
</label>
|
</label>
|
||||||
<div id='XPositionReference'
|
<div id='XPositionReference'>
|
||||||
className='flex flex-col'
|
|
||||||
>
|
|
||||||
{ inputGroups }
|
{ inputGroups }
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export interface IInputGroup {
|
export interface IInputGroup {
|
||||||
text: React.ReactNode
|
text: string
|
||||||
value: string
|
value: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,6 @@
|
||||||
@apply h-full w-full align-middle items-center justify-center
|
@apply h-full w-full align-middle items-center justify-center
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-button-icon {
|
|
||||||
@apply rounded-md shadow-sm bg-white w-8 cursor-pointer inline-block
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-tooltip {
|
.sidebar-tooltip {
|
||||||
@apply absolute w-auto p-2 m-2 min-w-max left-14
|
@apply absolute w-auto p-2 m-2 min-w-max left-14
|
||||||
rounded-md shadow-md
|
rounded-md shadow-md
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue