diff options
author | 2021-06-08 08:10:56 -0700 | |
---|---|---|
committer | 2021-06-08 11:10:56 -0400 | |
commit | 6bca7c83a7e2d62015f45f873b0f69f11b4d902b (patch) | |
tree | 5662630e51c6e6e743785d308785cff2e47568f0 /packages/create-astro/src/components/Help.tsx | |
parent | 9594447335b7fa15f82c0789f18a3fe02ec20d70 (diff) | |
download | astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.tar.gz astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.tar.zst astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.zip |
redesign create-astro (#301)
* redesign create astro
* add changeset
* Use npm start
* Update the astro version
* Adds the changeset
Co-authored-by: Fred Schott <fks@Freds-MBP.attlocal.net>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'packages/create-astro/src/components/Help.tsx')
-rw-r--r-- | packages/create-astro/src/components/Help.tsx | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/packages/create-astro/src/components/Help.tsx b/packages/create-astro/src/components/Help.tsx deleted file mode 100644 index ebbc0aa3c..000000000 --- a/packages/create-astro/src/components/Help.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React, { FC } from 'react'; -import { Box, Text } from 'ink'; -import decamelize from 'decamelize'; -import { ARGS, ARG } from '../config'; - -const Type: FC<{ type: any; enum?: string[] }> = ({ type, enum: e }) => { - if (type === Boolean) { - return ( - <> - <Text color="#3894FF">true</Text> - <Text dimColor>|</Text> - <Text color="#3894FF">false</Text> - </> - ); - } - if (e?.length > 0) { - return ( - <> - {e.map((item, i, { length: len }) => { - if (i !== len - 1) { - return ( - <Box key={item}> - <Text color="#17C083">{item}</Text> - <Text dimColor>|</Text> - </Box> - ); - } - - return ( - <Text color="#17C083" key={item}> - {item} - </Text> - ); - })} - </> - ); - } - - return <Text color="#3894FF">string</Text>; -}; - -const Command: FC<{ name: string; info: ARG }> = ({ name, info: { alias, description, type, enum: e } }) => { - return ( - <Box display="flex" alignItems="flex-start"> - <Box width={24} display="flex" flexGrow={0}> - <Text color="whiteBright">--{name}</Text> - {alias && <Text dimColor> -{alias}</Text>} - </Box> - <Box width={24}> - <Type type={type} enum={e} /> - </Box> - <Box> - <Text>{description}</Text> - </Box> - </Box> - ); -}; - -const Help: FC<{ context: any }> = ({ context: { templates } }) => { - return ( - <> - <Box width={48} display="flex" marginY={1}> - <Text backgroundColor="#882DE7" color="white"> - {' astro '} - </Text> - <Box marginLeft={1}> - <Text color="black" backgroundColor="white"> - {' '} - help{' '} - </Text> - </Box> - </Box> - <Box marginBottom={1} marginLeft={2} display="flex" flexDirection="column"> - {Object.entries(ARGS).map(([name, info]) => ( - <Command key={name} name={decamelize(name, { separator: '-' })} info={name === 'template' ? { ...info, enum: templates.map(({ value }) => value) } : info} /> - ))} - </Box> - </> - ); -}; -export default Help; |