Skip to content

Commit

Permalink
feat: add Table primitive (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch authored and alharris-at committed Feb 25, 2022
1 parent 61dc5aa commit 605284f
Show file tree
Hide file tree
Showing 11 changed files with 715 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5334,6 +5334,186 @@ export default function SliderFieldPrimitive(
"
`;
exports[`amplify render tests primitives Table 1`] = `
"/* eslint-disable */
import React from \\"react\\";
import {
EscapeHatchProps,
getOverrideProps,
} from \\"@aws-amplify/ui-react/internal\\";
import {
Table,
TableBody,
TableCell,
TableFoot,
TableHead,
TableProps,
TableRow,
} from \\"@aws-amplify/ui-react\\";
export type TablePrimitiveProps = React.PropsWithChildren<
Partial<TableProps> & {
overrides?: EscapeHatchProps | undefined | null;
}
>;
export default function TablePrimitive(
props: TablePrimitiveProps
): React.ReactElement {
const { overrides: overridesProp, ...rest } = props;
const overrides = { ...overridesProp };
return (
/* @ts-ignore: TS2322 */
<Table
caption=\\"Some fruits\\"
highlightOnHover={true}
size=\\"small\\"
variation=\\"striped\\"
{...rest}
{...getOverrideProps(overrides, \\"Table\\")}
>
<TableHead {...getOverrideProps(overrides, \\"Table.TableHead[0]\\")}>
<TableRow
{...getOverrideProps(overrides, \\"Table.TableHead[0].TableRow[0]\\")}
>
<TableCell
as=\\"th\\"
children=\\"Citrus\\"
{...getOverrideProps(
overrides,
\\"Table.TableHead[0].TableRow[0].TableCell[0]\\"
)}
></TableCell>
<TableCell
as=\\"th\\"
children=\\"Stone Fruit\\"
{...getOverrideProps(
overrides,
\\"Table.TableHead[0].TableRow[0].TableCell[1]\\"
)}
></TableCell>
<TableCell
as=\\"th\\"
children=\\"Berry\\"
{...getOverrideProps(
overrides,
\\"Table.TableHead[0].TableRow[0].TableCell[2]\\"
)}
></TableCell>
</TableRow>
</TableHead>
<TableBody {...getOverrideProps(overrides, \\"Table.TableBody[0]\\")}>
<TableRow
{...getOverrideProps(overrides, \\"Table.TableBody[0].TableRow[0]\\")}
>
<TableCell
children=\\"Orange\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[0].TableCell[0]\\"
)}
></TableCell>
<TableCell
children=\\"Nectarine\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[0].TableCell[1]\\"
)}
></TableCell>
<TableCell
children=\\"Raspberry\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[0].TableCell[2]\\"
)}
></TableCell>
</TableRow>
<TableRow
{...getOverrideProps(overrides, \\"Table.TableBody[0].TableRow[1]\\")}
>
<TableCell
children=\\"Grapefruit\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[1].TableCell[0]\\"
)}
></TableCell>
<TableCell
children=\\"Apricot\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[1].TableCell[1]\\"
)}
></TableCell>
<TableCell
children=\\"Blueberry\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[1].TableCell[2]\\"
)}
></TableCell>
</TableRow>
<TableRow
{...getOverrideProps(overrides, \\"Table.TableBody[0].TableRow[2]\\")}
>
<TableCell
children=\\"Lime\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[2].TableCell[0]\\"
)}
></TableCell>
<TableCell
children=\\"Peach\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[2].TableCell[1]\\"
)}
></TableCell>
<TableCell
children=\\"Strawberry\\"
{...getOverrideProps(
overrides,
\\"Table.TableBody[0].TableRow[2].TableCell[2]\\"
)}
></TableCell>
</TableRow>
</TableBody>
<TableFoot {...getOverrideProps(overrides, \\"Table.TableFoot[0]\\")}>
<TableRow
{...getOverrideProps(overrides, \\"Table.TableFoot[0].TableRow[0]\\")}
>
<TableCell
as=\\"th\\"
children=\\"Citrus\\"
{...getOverrideProps(
overrides,
\\"Table.TableFoot[0].TableRow[0].TableCell[0]\\"
)}
></TableCell>
<TableCell
as=\\"th\\"
children=\\"Stone Fruit\\"
{...getOverrideProps(
overrides,
\\"Table.TableFoot[0].TableRow[0].TableCell[1]\\"
)}
></TableCell>
<TableCell
as=\\"th\\"
children=\\"Berry\\"
{...getOverrideProps(
overrides,
\\"Table.TableFoot[0].TableRow[0].TableCell[2]\\"
)}
></TableCell>
</TableRow>
</TableFoot>
</Table>
);
}
"
`;
exports[`amplify render tests primitives TextField 1`] = `
"/* eslint-disable */
import React from \\"react\\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ exports[`Primitives SwitchField 1`] = `"<SwitchField {...rest} {...getOverridePr

exports[`Primitives TabItem 1`] = `"<TabItem {...rest} {...getOverrideProps(overrides, \\"TabItem\\")}></TabItem>"`;

exports[`Primitives Table 1`] = `"<Table {...rest} {...getOverrideProps(overrides, \\"Table\\")}></Table>"`;

exports[`Primitives TableBody 1`] = `"<TableBody {...rest} {...getOverrideProps(overrides, \\"TableBody\\")}></TableBody>"`;

exports[`Primitives TableCell 1`] = `"<TableCell {...rest} {...getOverrideProps(overrides, \\"TableCell\\")}></TableCell>"`;

exports[`Primitives TableFoot 1`] = `"<TableFoot {...rest} {...getOverrideProps(overrides, \\"TableFoot\\")}></TableFoot>"`;

exports[`Primitives TableHead 1`] = `"<TableHead {...rest} {...getOverrideProps(overrides, \\"TableHead\\")}></TableHead>"`;

exports[`Primitives TableRow 1`] = `"<TableRow {...rest} {...getOverrideProps(overrides, \\"TableRow\\")}></TableRow>"`;

exports[`Primitives Tabs 1`] = `"<Tabs {...rest} {...getOverrideProps(overrides, \\"Tabs\\")}></Tabs>"`;

exports[`Primitives Text 1`] = `"<Text {...rest} {...getOverrideProps(overrides, \\"Text\\")}></Text>"`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ describe('amplify render tests', () => {
test('Built-in Iconset', () => {
expect(generateWithAmplifyRenderer('builtInIconset').componentText).toMatchSnapshot();
});

test('Table', () => {
expect(generateWithAmplifyRenderer('primitives/TablePrimitive').componentText).toMatchSnapshot();
});
});

describe('icon-indices', () => {
Expand Down
Loading

0 comments on commit 605284f

Please sign in to comment.