diff options
Diffstat (limited to 'packages/create-astro/src/components/Select.tsx')
-rw-r--r-- | packages/create-astro/src/components/Select.tsx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/packages/create-astro/src/components/Select.tsx b/packages/create-astro/src/components/Select.tsx index acf8eb29f..08d588f4f 100644 --- a/packages/create-astro/src/components/Select.tsx +++ b/packages/create-astro/src/components/Select.tsx @@ -5,28 +5,28 @@ import { Text, Box } from 'ink'; const { default: Select } = SelectInput; interface Props { - isSelected?: boolean; - label: string; - description?: string; + isSelected?: boolean; + label: string; + description?: string; } -const Indicator: FC<Props> = ({ isSelected }) => isSelected ? <Text color="#3894FF">[ </Text> : <Text> </Text> -const Item: FC<Props> = ({isSelected = false, label, description }) => ( - <Box display="flex"> - <Text color={isSelected ? '#3894FF' : 'white'} dimColor={!isSelected}>{label}</Text> - {isSelected && description && typeof description === 'string' && <Text> {description}</Text>} - {isSelected && description && typeof description !== 'string' && <Box marginLeft={1}>{description}</Box>} - </Box> +const Indicator: FC<Props> = ({ isSelected }) => (isSelected ? <Text color="#3894FF">[ </Text> : <Text> </Text>); +const Item: FC<Props> = ({ isSelected = false, label, description }) => ( + <Box display="flex"> + <Text color={isSelected ? '#3894FF' : 'white'} dimColor={!isSelected}> + {label} + </Text> + {isSelected && description && typeof description === 'string' && <Text> {description}</Text>} + {isSelected && description && typeof description !== 'string' && <Box marginLeft={1}>{description}</Box>} + </Box> ); interface SelectProps { - items: { value: string|number|boolean, label: string, description?: any }[] - onSelect(value: string|number|boolean): void; + items: { value: string | number | boolean; label: string; description?: any }[]; + onSelect(value: string | number | boolean): void; } const CustomSelect: FC<SelectProps> = ({ items, onSelect }) => { - const handleSelect = ({ value }) => onSelect(value); - return ( - <Select indicatorComponent={Indicator} itemComponent={Item} items={items} onSelect={handleSelect} /> - ) -} + const handleSelect = ({ value }) => onSelect(value); + return <Select indicatorComponent={Indicator} itemComponent={Item} items={items} onSelect={handleSelect} />; +}; export default CustomSelect; |