1a16a3d18SBartosz Kaszubowskiimport type { PropsWithChildren } from 'react';
2*26a76ff7SBartosz Kaszubowskiimport ReactMarkdown from 'react-markdown';
38a3afa28SCedric van Putten
4b3bd70ceSTomasz Sapetaimport { APISectionPlatformTags } from '~/components/plugins/api/APISectionPlatformTags';
5*26a76ff7SBartosz Kaszubowskiimport { mdComponents } from '~/components/plugins/api/APISectionUtils';
6af644ed4SBartosz Kaszubowskiimport { Cell, HeaderCell, Row, Table, TableHead } from '~/ui/components/Table';
7a16a3d18SBartosz Kaszubowskiimport { P, CODE, H3 } from '~/ui/components/Text';
88a3afa28SCedric van Putten
98a3afa28SCedric van Puttentype Props = PropsWithChildren<{
108a3afa28SCedric van Putten  properties: PluginProperty[];
118a3afa28SCedric van Putten}>;
128a3afa28SCedric van Putten
138a3afa28SCedric van Puttenexport const ConfigPluginProperties = ({ children, properties }: Props) => (
148a3afa28SCedric van Putten  <>
158a3afa28SCedric van Putten    <H3>Configurable properties</H3>
168a3afa28SCedric van Putten    {!!children && <P>{children}</P>}
17af644ed4SBartosz Kaszubowski    <Table>
18af644ed4SBartosz Kaszubowski      <TableHead>
19af644ed4SBartosz Kaszubowski        <Row>
20af644ed4SBartosz Kaszubowski          <HeaderCell>Name</HeaderCell>
21af644ed4SBartosz Kaszubowski          <HeaderCell>Default</HeaderCell>
22af644ed4SBartosz Kaszubowski          <HeaderCell>Description</HeaderCell>
23af644ed4SBartosz Kaszubowski        </Row>
24af644ed4SBartosz Kaszubowski      </TableHead>
258a3afa28SCedric van Putten      <tbody>
268a3afa28SCedric van Putten        {properties.map(property => (
27af644ed4SBartosz Kaszubowski          <Row key={property.name}>
28af644ed4SBartosz Kaszubowski            <Cell fitContent>
293c9a6b96SBartosz Kaszubowski              <CODE>{property.name}</CODE>
30af644ed4SBartosz Kaszubowski            </Cell>
313c9a6b96SBartosz Kaszubowski            <Cell>{!property.default ? '-' : <CODE>{property.default}</CODE>}</Cell>
32af644ed4SBartosz Kaszubowski            <Cell>
33a49fe69aSBartosz Kaszubowski              {!!property.platform && (
34b3bd70ceSTomasz Sapeta                <APISectionPlatformTags
35a49fe69aSBartosz Kaszubowski                  prefix="Only for:"
365990cc31SBartosz Kaszubowski                  platforms={[
375990cc31SBartosz Kaszubowski                    { content: [{ kind: 'text', text: property.platform }], tag: 'platform' },
385990cc31SBartosz Kaszubowski                  ]}
39a49fe69aSBartosz Kaszubowski                />
40a49fe69aSBartosz Kaszubowski              )}
41*26a76ff7SBartosz Kaszubowski              <ReactMarkdown components={mdComponents}>{property.description}</ReactMarkdown>
42af644ed4SBartosz Kaszubowski            </Cell>
43af644ed4SBartosz Kaszubowski          </Row>
448a3afa28SCedric van Putten        ))}
458a3afa28SCedric van Putten      </tbody>
46af644ed4SBartosz Kaszubowski    </Table>
478a3afa28SCedric van Putten  </>
488a3afa28SCedric van Putten);
498a3afa28SCedric van Putten
508a3afa28SCedric van Puttenexport type PluginProperty = {
518a3afa28SCedric van Putten  name: string;
528a3afa28SCedric van Putten  description: string;
538a3afa28SCedric van Putten  default?: string;
548a3afa28SCedric van Putten  platform?: 'android' | 'ios' | 'web';
558a3afa28SCedric van Putten};
56