import { Input, InputProps, Popup } from '@fluentui/react-northstar'; import * as React from 'react'; import ComponentExampleColorPicker from './ComponentExampleColorPicker'; export type ComponentExampleVariableProps = { componentName: string; onChange: (componentName: string, variableName: string, variableValue: string) => void; variableName: string; variableType: 'color' | 'string'; variableValue: string; }; const ComponentExampleVariable: React.FunctionComponent = props => { const { componentName, onChange, variableName, variableType, variableValue } = props; const handleInputChange = React.useCallback( (e, data: InputProps) => { onChange(componentName, variableName, data.value as string); }, [componentName, onChange, variableName], ); const handleColorChange = React.useCallback( (colorValue: string) => { onChange(componentName, variableName, colorValue); }, [componentName, onChange, variableName], ); return (
{variableType === 'string' &&
{variableName}
} {variableType === 'string' && } {variableType === 'color' && ( {variableName}
} align="start" position="below" content={} /> )} ); }; export default React.memo(ComponentExampleVariable);