summaryrefslogtreecommitdiff
path: root/packages/create-astro/src/components/Help.tsx
diff options
context:
space:
mode:
authorGravatar Drew Powers <1369770+drwpow@users.noreply.github.com> 2021-05-03 12:26:10 -0600
committerGravatar GitHub <noreply@github.com> 2021-05-03 12:26:10 -0600
commit94038d329705acb79a0f804458821d43f59121db (patch)
tree0f11c52b13a6de9344a83c900466b1bceb888bbe /packages/create-astro/src/components/Help.tsx
parentc93201a909105bb0ef75278d9635de4b5b8734e7 (diff)
downloadastro-94038d329705acb79a0f804458821d43f59121db.tar.gz
astro-94038d329705acb79a0f804458821d43f59121db.tar.zst
astro-94038d329705acb79a0f804458821d43f59121db.zip
Format (#167)
Diffstat (limited to 'packages/create-astro/src/components/Help.tsx')
-rw-r--r--packages/create-astro/src/components/Help.tsx124
1 files changed, 71 insertions, 53 deletions
diff --git a/packages/create-astro/src/components/Help.tsx b/packages/create-astro/src/components/Help.tsx
index 88fcf5633..5991664f1 100644
--- a/packages/create-astro/src/components/Help.tsx
+++ b/packages/create-astro/src/components/Help.tsx
@@ -2,61 +2,79 @@ import React, { FC } from 'react';
import { Box, Text } from 'ink';
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 } }) => {
+const Type: FC<{ type: any; enum?: string[] }> = ({ type, enum: e }) => {
+ if (type === Boolean) {
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>
+ <>
+ <Text color="#3894FF">true</Text>
+ <Text dimColor>|</Text>
+ <Text color="#3894FF">false</Text>
+ </>
);
-}
-
-const Help: FC<{ context: any }> = ({ context: { templates }}) => {
+ }
+ if (e?.length > 0) {
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={name} info={name === 'template' ? { ...info, enum: templates.map(({ value }) => value) } : info} /> )}
- </Box>
- </>
- )
+ <>
+ {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={name} info={name === 'template' ? { ...info, enum: templates.map(({ value }) => value) } : info} />
+ ))}
+ </Box>
+ </>
+ );
};
export default Help;