Skip to content

Commit 3f87f35

Browse files
committed
Add USWDS theme
1 parent 5a3e713 commit 3f87f35

File tree

4 files changed

+188
-0
lines changed

4 files changed

+188
-0
lines changed

package-lock.json

Lines changed: 119 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/playground/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@
6868
"react-is": "^18.2.0",
6969
"react-portal": "^4.2.2",
7070
"semantic-ui-react": "^2.1.3",
71+
<<<<<<< HEAD
7172
"uswds": "^2.14.0",
7273
"lucide-react": "^0.488.0"
74+
=======
75+
"uswds": "^2.14.0"
76+
>>>>>>> f066e3da (Add USWDS theme)
7377
},
7478
"devDependencies": {
7579
"@babel/cli": "^7.23.9",

packages/playground/src/app.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { Theme as SuiTheme } from '@rjsf/semantic-ui';
44
import { Theme as AntdTheme } from '@rjsf/antd';
55
import { Theme as BootstrapTheme } from '@rjsf/react-bootstrap';
66
import { Theme as ChakraUITheme } from '@rjsf/chakra-ui';
7+
<<<<<<< HEAD
78
import { Theme as shadcnTheme } from '@rjsf/shadcn';
89
import { Theme as DaisyUITheme } from '@rjsf/daisyui';
10+
=======
11+
>>>>>>> f066e3da (Add USWDS theme)
912
import { Theme as UswdsTheme } from '@rjsf/uswds';
1013
import v8Validator, { customizeValidator } from '@rjsf/validator-ajv8';
1114
import Ajv2019 from 'ajv/dist/2019.js';
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from "react";
2+
import { AddButtonProps, IconButtonProps as RjsfIconButtonProps } from "@rjsf/utils";
3+
import IconButton from "./IconButton"; // Import the generic IconButton
4+
5+
// Define specific button types using the generic IconButton
6+
const AddButton = (props: AddButtonProps) => (
7+
<IconButton
8+
{...props}
9+
iconName="add"
10+
uswdsStyle="outline"
11+
title="Add Item" // Default title
12+
>
13+
Add Item {/* Default text */}
14+
</IconButton>
15+
);
16+
17+
const RemoveButton = (props: RjsfIconButtonProps) => (
18+
<IconButton
19+
{...props}
20+
iconName="remove"
21+
uswdsStyle="unstyled"
22+
title="Remove Item" // Default title
23+
/>
24+
);
25+
26+
const MoveUpButton = (props: RjsfIconButtonProps) => (
27+
<IconButton
28+
{...props}
29+
iconName="arrow-upward"
30+
uswdsStyle="unstyled"
31+
title="Move Item Up" // Default title
32+
/>
33+
);
34+
35+
const MoveDownButton = (props: RjsfIconButtonProps) => (
36+
<IconButton
37+
{...props}
38+
iconName="arrow-downward"
39+
uswdsStyle="unstyled"
40+
title="Move Item Down" // Default title
41+
/>
42+
);
43+
44+
const CopyButton = (props: RjsfIconButtonProps) => (
45+
<IconButton
46+
{...props}
47+
iconName="copy" // Assuming 'copy' is added to iconMap
48+
uswdsStyle="unstyled"
49+
title="Copy Item" // Default title
50+
/>
51+
);
52+
53+
// Export the pre-configured buttons
54+
export default {
55+
AddButton,
56+
CopyButton,
57+
MoveDownButton,
58+
MoveUpButton,
59+
RemoveButton,
60+
// You could also export the generic IconButton itself if needed elsewhere
61+
// IconButton,
62+
};

0 commit comments

Comments
 (0)