summaryrefslogtreecommitdiff
path: root/packages/create-astro/src/components/Template.tsx
blob: 7fbab035d4609400f37e37cdacb76502c9be1edd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import React, { FC } from 'react';
import { Box, Text } from 'ink';
import Spacer from './Spacer';
import Select from './Select';

const Template: FC<{ context: any, onSubmit: (value: string) => void }> = ({ context: { templates }, onSubmit }) => {
  const items = templates.map(({ title: label, ...rest }) => ({ ...rest, label }));

  return (
    <>
      <Box display="flex">
        <Text color="#17C083">{'[query]'}</Text>
        <Text> Which template should be used?</Text>
      </Box>
      <Box display="flex">
        <Spacer width={6} />
        <Select items={items} onSelect={onSubmit} />
      </Box>
    </>
  );
};

export default Template;