@usace/groundwork 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +18 -0
- package/.github/workflows/deploy-docs.yml +59 -0
- package/.github/workflows/publish.yml +19 -0
- package/README.md +5 -0
- package/index.html +13 -0
- package/lib/catalyst/alert.jsx +110 -0
- package/lib/catalyst/avatar.jsx +64 -0
- package/lib/catalyst/badge.jsx +72 -0
- package/lib/catalyst/checkbox.jsx +160 -0
- package/lib/catalyst/dialog.jsx +101 -0
- package/lib/catalyst/dropdown.jsx +202 -0
- package/lib/catalyst/fieldset.jsx +87 -0
- package/lib/catalyst/input.jsx +78 -0
- package/lib/catalyst/listbox.jsx +195 -0
- package/lib/catalyst/pagination.jsx +75 -0
- package/lib/catalyst/radio.jsx +144 -0
- package/lib/catalyst/select.jsx +78 -0
- package/lib/catalyst/switch.jsx +203 -0
- package/lib/catalyst/textarea.jsx +59 -0
- package/lib/components/breadcrumbs.jsx +46 -0
- package/lib/components/button.jsx +219 -0
- package/lib/components/display/headings.jsx +39 -0
- package/lib/components/display/text.jsx +48 -0
- package/lib/components/hero.jsx +51 -0
- package/lib/components/layout/container.jsx +13 -0
- package/lib/components/layout/usace-box.jsx +26 -0
- package/lib/components/link.jsx +18 -0
- package/lib/components/table.jsx +146 -0
- package/lib/composite/footer/essayons.jsx +12 -0
- package/lib/composite/footer/footer-links.jsx +33 -0
- package/lib/composite/footer/index.jsx +148 -0
- package/lib/composite/footer/logo-banner.jsx +55 -0
- package/lib/composite/footer/social-links.jsx +60 -0
- package/lib/composite/header/index.jsx +83 -0
- package/lib/composite/header/navbar-links.jsx +113 -0
- package/lib/composite/header/usa-banner/USABanner.jsx +114 -0
- package/lib/composite/header/usa-banner/usa-banner.css +220 -0
- package/lib/composite/site-wrapper/index.jsx +52 -0
- package/lib/index.jsx +19 -0
- package/package.json +39 -0
- package/postcss.config.js +6 -0
- package/public/Magnifying_glass_icon.svg +5 -0
- package/public/armystar-logo-rb.svg +4 -0
- package/public/cwbi-logo.png +0 -0
- package/public/essayonscrest.png +0 -0
- package/public/icon-dot-gov.svg +1 -0
- package/public/icon-https.svg +1 -0
- package/public/nww-lucky-peak-dam.jpg +0 -0
- package/public/rsgis-logo.png +0 -0
- package/public/us_flag_small.png +0 -0
- package/public/usace-logo-color.svg +1 -0
- package/src/App.jsx +38 -0
- package/src/app-bundles/index.js +4 -0
- package/src/app-bundles/route-bundle.js +36 -0
- package/src/app-components/code-example.jsx +17 -0
- package/src/app-components/copy-button.jsx +32 -0
- package/src/app-components/props-table.jsx +43 -0
- package/src/app-components/sub-site-banner.jsx +15 -0
- package/src/app-pages/documentation/_docs-page.jsx +31 -0
- package/src/app-pages/documentation/_docs-sidebar.jsx +111 -0
- package/src/app-pages/documentation/_template.jsx +55 -0
- package/src/app-pages/documentation/app-shell/index.jsx +39 -0
- package/src/app-pages/documentation/app-shell/site-wrapper.jsx +190 -0
- package/src/app-pages/documentation/buttons/index.jsx +170 -0
- package/src/app-pages/documentation/index.jsx +57 -0
- package/src/app-pages/documentation/layout/container.jsx +68 -0
- package/src/app-pages/documentation/layout/index.jsx +52 -0
- package/src/app-pages/documentation/layout/usace-box.jsx +76 -0
- package/src/app-pages/documentation/navigation/breadcrumbs.jsx +119 -0
- package/src/app-pages/documentation/navigation/index.jsx +31 -0
- package/src/app-pages/documentation/types/index.jsx +31 -0
- package/src/app-pages/documentation/types/link.jsx +72 -0
- package/src/app-pages/home.jsx +71 -0
- package/src/index.css +3 -0
- package/src/main.jsx +18 -0
- package/tailwind.config.js +31 -0
- package/vite.config.js +46 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useConnect } from "redux-bundler-hook";
|
|
2
|
+
import { UsaceBox } from "../../../lib";
|
|
3
|
+
import { VscChevronRight } from "react-icons/vsc";
|
|
4
|
+
|
|
5
|
+
const sidebarLinks = [
|
|
6
|
+
{
|
|
7
|
+
title: "Getting Started",
|
|
8
|
+
href: "/docs",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: "Application Shell",
|
|
12
|
+
href: "/docs/app-shell",
|
|
13
|
+
children: [
|
|
14
|
+
{
|
|
15
|
+
title: "Site Wrapper",
|
|
16
|
+
href: "/docs/app-shell/site-wrapper",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: "Layout",
|
|
22
|
+
href: "/docs/layout",
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
title: "Container",
|
|
26
|
+
href: "/docs/layout/container",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "UsaceBox",
|
|
30
|
+
href: "/docs/layout/usace-box",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Navigation",
|
|
36
|
+
href: "/docs/navigation",
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
title: "Breadcrumbs",
|
|
40
|
+
href: "/docs/navigation/breadcrumbs",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "Buttons",
|
|
46
|
+
href: "/docs/buttons",
|
|
47
|
+
children: [],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Types",
|
|
51
|
+
href: "/docs/types",
|
|
52
|
+
children: [
|
|
53
|
+
{
|
|
54
|
+
title: "Link",
|
|
55
|
+
href: "/docs/types/link",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
function DocsSidebar() {
|
|
62
|
+
const { hash } = useConnect("selectHash");
|
|
63
|
+
return (
|
|
64
|
+
<UsaceBox title="Contents">
|
|
65
|
+
{sidebarLinks.map((link) => {
|
|
66
|
+
return (
|
|
67
|
+
<div key={link.href}>
|
|
68
|
+
<a href={link.href}>
|
|
69
|
+
<div
|
|
70
|
+
className={`text-lg font-bold pl-1 py-1 flex justify-between items-center cursor-pointer hover:bg-gray-100 ${
|
|
71
|
+
hash === link.href ? "bg-gray-50 rounded" : ""
|
|
72
|
+
}`}
|
|
73
|
+
>
|
|
74
|
+
{link.title}
|
|
75
|
+
<VscChevronRight
|
|
76
|
+
size={18}
|
|
77
|
+
aria-hidden="true"
|
|
78
|
+
color="rgb(156 163 175)"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</a>
|
|
82
|
+
<ul>
|
|
83
|
+
{link.children &&
|
|
84
|
+
link.children.map((child) => {
|
|
85
|
+
return (
|
|
86
|
+
<a href={child.href} key={child.href}>
|
|
87
|
+
<li
|
|
88
|
+
className={`pl-3 py-1 flex justify-between items-center cursor-pointer hover:bg-gray-100 ${
|
|
89
|
+
hash === child.href ? "bg-gray-50 rounded" : ""
|
|
90
|
+
}`}
|
|
91
|
+
>
|
|
92
|
+
{child.title}
|
|
93
|
+
<VscChevronRight
|
|
94
|
+
size={18}
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
color="rgb(156 163 175)"
|
|
97
|
+
/>
|
|
98
|
+
</li>
|
|
99
|
+
</a>
|
|
100
|
+
);
|
|
101
|
+
})}
|
|
102
|
+
</ul>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
})}
|
|
106
|
+
</UsaceBox>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default DocsSidebar;
|
|
111
|
+
export { DocsSidebar };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { UsaceBox, Code } from "../../../../lib";
|
|
2
|
+
import { CodeExample } from "../../../app-components/code-example";
|
|
3
|
+
import PropsTable from "../../../app-components/props-table";
|
|
4
|
+
import DocsPage from "../_docs-page";
|
|
5
|
+
|
|
6
|
+
const pageBreadcrumbs = [
|
|
7
|
+
{
|
|
8
|
+
text: "Documentation",
|
|
9
|
+
href: "/docs",
|
|
10
|
+
},
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const componentProps = [
|
|
14
|
+
{
|
|
15
|
+
name: "headerLinks",
|
|
16
|
+
type: "array[Link]",
|
|
17
|
+
default: "[]",
|
|
18
|
+
desc: "An array of objects to be used as links in the header. Each object should have an id, text, and href property. If you would like a drop-down of links include a children property which is an array of link objects to the top level link.",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function Docs() {
|
|
23
|
+
return (
|
|
24
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
25
|
+
<UsaceBox title="Site Wrapper">
|
|
26
|
+
{/* Description of the component and what problem it solves */}
|
|
27
|
+
<div className="pb-6">
|
|
28
|
+
<p>Description of component</p>
|
|
29
|
+
<p className="pt-3">Description continued</p>
|
|
30
|
+
</div>
|
|
31
|
+
{/* Example usage - remove if not needed */}
|
|
32
|
+
<div className="rounded-md border border-dashed px-6 py-3 mb-3"></div>
|
|
33
|
+
{/* Example code */}
|
|
34
|
+
<CodeExample
|
|
35
|
+
code={`import { } from "@usace/groundwork";
|
|
36
|
+
|
|
37
|
+
function Component() {
|
|
38
|
+
return ()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Component;
|
|
42
|
+
`}
|
|
43
|
+
/>
|
|
44
|
+
{/* Component props documentation */}
|
|
45
|
+
<div className="font-bold text-lg pt-6">
|
|
46
|
+
Component API - <Code className="p-2">{`<SiteWrapper />`}</Code>
|
|
47
|
+
</div>
|
|
48
|
+
<PropsTable propsList={componentProps} />
|
|
49
|
+
</UsaceBox>
|
|
50
|
+
</DocsPage>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default Docs;
|
|
55
|
+
export { Docs };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { UsaceBox, H4 } from "../../../../lib";
|
|
2
|
+
import DocsPage from "../_docs-page";
|
|
3
|
+
|
|
4
|
+
const pageBreadcrumbs = [
|
|
5
|
+
{
|
|
6
|
+
text: "Documentation",
|
|
7
|
+
href: "/docs",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
text: "Application Shell",
|
|
11
|
+
href: "/docs/app-shell",
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function AppShell() {
|
|
16
|
+
return (
|
|
17
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
18
|
+
<UsaceBox title="Application Shell">
|
|
19
|
+
<div className="pb-6">
|
|
20
|
+
The application shell consists of components that are shared across
|
|
21
|
+
many pages, this way we can re-use components for the header, footer,
|
|
22
|
+
etc... and don't have to worry about getting them all to match. The
|
|
23
|
+
easiest way to start your app is to use the SiteWrapper component to
|
|
24
|
+
wrap your custom page, then you only have to concentrate on your
|
|
25
|
+
specific content.
|
|
26
|
+
</div>
|
|
27
|
+
<H4>Components</H4>
|
|
28
|
+
<ul>
|
|
29
|
+
<li>
|
|
30
|
+
<a href="/docs/app-shell/site-wrapper">Site Wrapper</a>
|
|
31
|
+
</li>
|
|
32
|
+
</ul>
|
|
33
|
+
</UsaceBox>
|
|
34
|
+
</DocsPage>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default AppShell;
|
|
39
|
+
export { AppShell };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { UsaceBox, Code } from "../../../../lib";
|
|
2
|
+
import { CodeExample } from "../../../app-components/code-example";
|
|
3
|
+
import PropsTable from "../../../app-components/props-table";
|
|
4
|
+
import DocsPage from "../_docs-page";
|
|
5
|
+
|
|
6
|
+
const pageBreadcrumbs = [
|
|
7
|
+
{
|
|
8
|
+
text: "Documentation",
|
|
9
|
+
href: "/docs",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
text: "Application Shell",
|
|
13
|
+
href: "/docs/app-shell",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
text: "Site Wrapper",
|
|
17
|
+
href: "/docs/app-shell/site-wrapper",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const siteWrapperProps = [
|
|
22
|
+
{
|
|
23
|
+
name: "headerLinks",
|
|
24
|
+
type: "array[Link]",
|
|
25
|
+
default: "[]",
|
|
26
|
+
desc: "An array of objects to be used as links in the header. Each object should have an id, text, and href property. If you would like a drop-down of links include a children property which is an array of link objects to the top level link.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "usaBanner",
|
|
30
|
+
type: "boolean",
|
|
31
|
+
default: "true",
|
|
32
|
+
desc: "If true, the government website banner will be displayed at the top of the page.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "msgBanner",
|
|
36
|
+
type: "component",
|
|
37
|
+
default: "null",
|
|
38
|
+
desc: "A custom component that will render between the government website banner and the header. This is useful for displaying a message banner that is specific to the site or page.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "title",
|
|
42
|
+
type: "string",
|
|
43
|
+
default: "US Army Corps of Engineers",
|
|
44
|
+
desc: "The title to display in the header.",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "subtitle",
|
|
48
|
+
type: "string",
|
|
49
|
+
default: "''",
|
|
50
|
+
desc: "A subtitle to display in the header.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "missionText",
|
|
54
|
+
type: "string",
|
|
55
|
+
default: "''",
|
|
56
|
+
desc: "The mission text to display in the footer.",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "aboutText",
|
|
60
|
+
type: "string",
|
|
61
|
+
default: "''",
|
|
62
|
+
desc: "The about text to display in the footer.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "facebookUrl",
|
|
66
|
+
type: "string",
|
|
67
|
+
default: "''",
|
|
68
|
+
desc: "The URL to a Facebook page.",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "twitterUrl",
|
|
72
|
+
type: "string",
|
|
73
|
+
default: "''",
|
|
74
|
+
desc: "The URL to a Twitter page.",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "youtubeUrl",
|
|
78
|
+
type: "string",
|
|
79
|
+
default: "''",
|
|
80
|
+
desc: "The URL to a YouTube page.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "flickrUrl",
|
|
84
|
+
type: "string",
|
|
85
|
+
default: "''",
|
|
86
|
+
desc: "The URL to a Flickr page.",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "usaceLinks",
|
|
90
|
+
type: "array[Link]",
|
|
91
|
+
default: "[]",
|
|
92
|
+
desc: "An array of objects to be used as links in the footer. These links should point to USACE websites. Each object should have an id, text, and href property.",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "externalLinks",
|
|
96
|
+
type: "array[Link]",
|
|
97
|
+
default: "[]",
|
|
98
|
+
desc: "An array of objects to be used as external links in the footer. Use these links to point to external non-USACE websites. Each object should have an id, text, and href property.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "armyLogo",
|
|
102
|
+
type: "boolean",
|
|
103
|
+
default: "true",
|
|
104
|
+
desc: "If true, the Army logo will be displayed in the footer.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "usaceLogo",
|
|
108
|
+
type: "boolean",
|
|
109
|
+
default: "true",
|
|
110
|
+
desc: "If true, the USACE logo will be displayed in the footer.",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "rsgisLogo",
|
|
114
|
+
type: "boolean",
|
|
115
|
+
default: "false",
|
|
116
|
+
desc: "If true, the RSGIS logo will be displayed in the footer.",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "cwbiLogo",
|
|
120
|
+
type: "boolean",
|
|
121
|
+
default: "false",
|
|
122
|
+
desc: "If true, the CWBI logo will be displayed in the footer.",
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
function SiteWrapperDocs() {
|
|
127
|
+
return (
|
|
128
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
129
|
+
<UsaceBox title="Site Wrapper">
|
|
130
|
+
<div className="pb-6">
|
|
131
|
+
<p>
|
|
132
|
+
Use the Site Wrapper to add the header and footer to your page. The
|
|
133
|
+
best way to do this is add SiteWrapper to the top level of your
|
|
134
|
+
application and render any changing content as children of the
|
|
135
|
+
SiteWrapper component.
|
|
136
|
+
</p>
|
|
137
|
+
<p className="pt-3">
|
|
138
|
+
For example, in a Vite project you typically have a src/App.jsx file
|
|
139
|
+
which is the top level component for the application. You would
|
|
140
|
+
import the SiteWrapper component there and use it to wrap the rest
|
|
141
|
+
of your application.
|
|
142
|
+
</p>
|
|
143
|
+
<p className="pt-3">
|
|
144
|
+
Note that in the example below, the useConnect hook is used to get
|
|
145
|
+
the current content that should be rendered based on the url. This
|
|
146
|
+
uses a separate state management framework called{" "}
|
|
147
|
+
<a
|
|
148
|
+
className="underline"
|
|
149
|
+
href="https://reduxbundler.com"
|
|
150
|
+
target="_blank"
|
|
151
|
+
referrer="noreferrer"
|
|
152
|
+
>
|
|
153
|
+
ReduxBundler
|
|
154
|
+
</a>
|
|
155
|
+
, which we highly recommend for React state management.
|
|
156
|
+
</p>{" "}
|
|
157
|
+
</div>
|
|
158
|
+
<CodeExample
|
|
159
|
+
code={`import { SiteWrapper } from "@usace/groundwork";
|
|
160
|
+
import { useConnect } from "redux-bundler-hook";
|
|
161
|
+
|
|
162
|
+
const links = [{ id: "docs", label: "Documentation", link: "/docs" }];
|
|
163
|
+
|
|
164
|
+
function App() {
|
|
165
|
+
const {
|
|
166
|
+
route: Route,
|
|
167
|
+
} = useConnect("selectRoute");
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<SiteWrapper links={links}>
|
|
171
|
+
<Route />
|
|
172
|
+
</SiteWrapper>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default App;
|
|
177
|
+
`}
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<div className="font-bold text-lg pt-6">
|
|
181
|
+
Component API - <Code className="p-2">{`<SiteWrapper />`}</Code>
|
|
182
|
+
</div>
|
|
183
|
+
<PropsTable propsList={siteWrapperProps} />
|
|
184
|
+
</UsaceBox>
|
|
185
|
+
</DocsPage>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default SiteWrapperDocs;
|
|
190
|
+
export { SiteWrapperDocs };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { UsaceBox, Code, Button } from "../../../../lib";
|
|
2
|
+
import { CodeExample } from "../../../app-components/code-example";
|
|
3
|
+
import PropsTable from "../../../app-components/props-table";
|
|
4
|
+
import DocsPage from "../_docs-page";
|
|
5
|
+
|
|
6
|
+
const pageBreadcrumbs = [
|
|
7
|
+
{
|
|
8
|
+
text: "Documentation",
|
|
9
|
+
href: "/docs",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
text: "Buttons",
|
|
13
|
+
href: "/docs/buttons",
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const componentProps = [
|
|
18
|
+
{
|
|
19
|
+
name: "type",
|
|
20
|
+
type: "string",
|
|
21
|
+
default: "'button'",
|
|
22
|
+
desc: "The html button type to use.",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "color",
|
|
26
|
+
type: "string",
|
|
27
|
+
default: "'dark/zinc'",
|
|
28
|
+
desc: "The solid color variant to use.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "outline",
|
|
32
|
+
type: "boolean",
|
|
33
|
+
default: "false",
|
|
34
|
+
desc: "Render a button with an outline but no background.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "plain",
|
|
38
|
+
type: "boolean",
|
|
39
|
+
default: "false",
|
|
40
|
+
desc: "Render a plain button with no background or outline.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "disabled",
|
|
44
|
+
type: "boolean",
|
|
45
|
+
default: "false",
|
|
46
|
+
desc: "Disable the button.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "onClick",
|
|
50
|
+
type: "function",
|
|
51
|
+
default: "undefined",
|
|
52
|
+
desc: "Handler that will fire on the click event, all other basic React event handlers are available as well.",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
function ButtonsDocs() {
|
|
57
|
+
return (
|
|
58
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
59
|
+
<UsaceBox title="Buttons">
|
|
60
|
+
{/* Description of the component and what problem it solves */}
|
|
61
|
+
<div className="pb-6">
|
|
62
|
+
<p>
|
|
63
|
+
The Button component can be used to render a basic button with
|
|
64
|
+
pre-defined styles. For more advanced configurations it's
|
|
65
|
+
recommended that you implement your own button using the{" "}
|
|
66
|
+
<Code>{"<button>"}</Code> primitive component.
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
{/* Example usage - remove if not needed */}
|
|
70
|
+
<div className="mt-4 mb-2 text-sm font-bold">Basic Usage</div>
|
|
71
|
+
<div className="rounded-md border border-dashed px-6 py-3 mb-3">
|
|
72
|
+
<div className="flex flex-row flex-wrap gap-3">
|
|
73
|
+
<Button>Default</Button>
|
|
74
|
+
<Button outline>Outlined</Button>
|
|
75
|
+
<Button plain>Plain</Button>
|
|
76
|
+
<Button disabled>Disabled</Button>
|
|
77
|
+
<Button href="/docs/buttons">As a Link</Button>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
{/* Example code */}
|
|
81
|
+
<CodeExample
|
|
82
|
+
code={`import { Button } from "@usace/groundwork";
|
|
83
|
+
|
|
84
|
+
function Component() {
|
|
85
|
+
return (
|
|
86
|
+
<div className="flex flex-row flex-wrap gap-3">
|
|
87
|
+
<Button>Default</Button>
|
|
88
|
+
<Button outline>Outlined</Button>
|
|
89
|
+
<Button plain>Plain</Button>
|
|
90
|
+
<Button disabled>Disabled</Button>
|
|
91
|
+
<Button href="/docs/buttons">As a Link</Button>
|
|
92
|
+
</div>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default Component;
|
|
97
|
+
`}
|
|
98
|
+
/>
|
|
99
|
+
{/* Example usage - remove if not needed */}
|
|
100
|
+
<div className="mt-4 mb-2 text-sm font-bold">
|
|
101
|
+
Built-in Color Options
|
|
102
|
+
</div>
|
|
103
|
+
<div className="rounded-md border border-dashed px-6 py-3 mb-3">
|
|
104
|
+
<div className="flex flex-row flex-wrap gap-3">
|
|
105
|
+
{[
|
|
106
|
+
"dark/zinc",
|
|
107
|
+
"light",
|
|
108
|
+
"dark/white",
|
|
109
|
+
"dark",
|
|
110
|
+
"white",
|
|
111
|
+
"zinc",
|
|
112
|
+
"indigo",
|
|
113
|
+
"cyan",
|
|
114
|
+
"red",
|
|
115
|
+
"orange",
|
|
116
|
+
"amber",
|
|
117
|
+
"yellow",
|
|
118
|
+
"lime",
|
|
119
|
+
"green",
|
|
120
|
+
"emerald",
|
|
121
|
+
"teal",
|
|
122
|
+
"sky",
|
|
123
|
+
"blue",
|
|
124
|
+
"violet",
|
|
125
|
+
"purple",
|
|
126
|
+
"fuchsia",
|
|
127
|
+
"pink",
|
|
128
|
+
"rose",
|
|
129
|
+
].map((clr) => {
|
|
130
|
+
return (
|
|
131
|
+
<Button key={clr} color={clr}>
|
|
132
|
+
{clr}
|
|
133
|
+
</Button>
|
|
134
|
+
);
|
|
135
|
+
})}
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
{/* Example code */}
|
|
139
|
+
<CodeExample
|
|
140
|
+
code={`import { Button } from "@usace/groundwork";
|
|
141
|
+
|
|
142
|
+
function Component() {
|
|
143
|
+
return (
|
|
144
|
+
<div className="flex flex-row flex-wrap gap-3">
|
|
145
|
+
{colors.map((clr) => {
|
|
146
|
+
return (
|
|
147
|
+
<Button key={clr} color={clr}>
|
|
148
|
+
{clr}
|
|
149
|
+
</Button>
|
|
150
|
+
);
|
|
151
|
+
})}
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export default Component;
|
|
157
|
+
`}
|
|
158
|
+
/>
|
|
159
|
+
{/* Component props documentation */}
|
|
160
|
+
<div className="font-bold text-lg pt-6">
|
|
161
|
+
Component API - <Code className="p-2">{`<SiteWrapper />`}</Code>
|
|
162
|
+
</div>
|
|
163
|
+
<PropsTable propsList={componentProps} />
|
|
164
|
+
</UsaceBox>
|
|
165
|
+
</DocsPage>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export default ButtonsDocs;
|
|
170
|
+
export { ButtonsDocs };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UsaceBox, Code, H4 } from "../../../lib";
|
|
2
|
+
import CopyButton from "../../app-components/copy-button";
|
|
3
|
+
import DocsPage from "./_docs-page";
|
|
4
|
+
|
|
5
|
+
const pageBreadcrumbs = [
|
|
6
|
+
{
|
|
7
|
+
text: "Documentation",
|
|
8
|
+
href: "/docs",
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
function Docs() {
|
|
13
|
+
return (
|
|
14
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
15
|
+
<UsaceBox title="Getting Started">
|
|
16
|
+
<H4>Project Setup</H4>
|
|
17
|
+
<div className="mt-3 mb-3">
|
|
18
|
+
<p>
|
|
19
|
+
Groundwork is a set of React components that are designed to be used
|
|
20
|
+
by USACE Developers building internal and externally facing web
|
|
21
|
+
pages and web apps. The library should be compatible with any React
|
|
22
|
+
project using a build step. We test the framework and only support
|
|
23
|
+
using the Vite build tool. See the{" "}
|
|
24
|
+
<a
|
|
25
|
+
className="underline"
|
|
26
|
+
href="https://vitejs.dev/guide/"
|
|
27
|
+
target="_blank"
|
|
28
|
+
referrer="no-referrer"
|
|
29
|
+
>
|
|
30
|
+
Vite documentation
|
|
31
|
+
</a>{" "}
|
|
32
|
+
for more details on getting started.{" "}
|
|
33
|
+
</p>
|
|
34
|
+
<p className="mt-3">
|
|
35
|
+
Set up a new project with Vite using the following command:
|
|
36
|
+
<div className="flex flex-row justify-start space-between items-center gap-2 mt-3 mb-3">
|
|
37
|
+
<Code className="block p-1 px-2">
|
|
38
|
+
npm create vite@latest {`<app-name>`} --template react
|
|
39
|
+
</Code>
|
|
40
|
+
<CopyButton text="npm create vite@latest <app-name> --template react" />
|
|
41
|
+
</div>
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<H4>Installation</H4>
|
|
46
|
+
<div className="flex flex-row justify-start space-between items-center gap-2 mt-3 mb-3">
|
|
47
|
+
<Code className="block p-1 px-2">npm install @usace/groundwork</Code>
|
|
48
|
+
<CopyButton text="npm install @usace/groundwork" />
|
|
49
|
+
</div>
|
|
50
|
+
<div>Then go build stuff with the components</div>
|
|
51
|
+
</UsaceBox>
|
|
52
|
+
</DocsPage>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default Docs;
|
|
57
|
+
export { Docs };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { UsaceBox, Code } from "../../../../lib";
|
|
2
|
+
import { CodeExample } from "../../../app-components/code-example";
|
|
3
|
+
import PropsTable from "../../../app-components/props-table";
|
|
4
|
+
import DocsPage from "../_docs-page";
|
|
5
|
+
|
|
6
|
+
const pageBreadcrumbs = [
|
|
7
|
+
{
|
|
8
|
+
text: "Documentation",
|
|
9
|
+
href: "/docs",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
text: "Layout",
|
|
13
|
+
href: "/docs/layout",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
text: "Container",
|
|
17
|
+
href: "/docs/layout/container",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const componentProps = [
|
|
22
|
+
{
|
|
23
|
+
name: "fluid",
|
|
24
|
+
type: "boolean",
|
|
25
|
+
default: "false",
|
|
26
|
+
desc: "If true, the container will be full width. If false, the container will have a max width of 1140px.",
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
function ContainerDocs() {
|
|
31
|
+
return (
|
|
32
|
+
<DocsPage breadcrumbs={pageBreadcrumbs}>
|
|
33
|
+
<UsaceBox title="Container">
|
|
34
|
+
{/* Description of the component and what problem it solves */}
|
|
35
|
+
<div className="pb-6">
|
|
36
|
+
<p>
|
|
37
|
+
Use Container to add a section to your page with padding and a max
|
|
38
|
+
with that keeps content within a readable width on users screens, or
|
|
39
|
+
if you want full width all the time, you can set fluid == true.
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
{/* Example usage */}
|
|
43
|
+
<CodeExample
|
|
44
|
+
code={`import { Container } from "@usace/groundwork";
|
|
45
|
+
|
|
46
|
+
function MyComponent() {
|
|
47
|
+
return (
|
|
48
|
+
<Container>
|
|
49
|
+
<div>{content}</div>
|
|
50
|
+
</Container>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default MyComponent;
|
|
55
|
+
`}
|
|
56
|
+
/>
|
|
57
|
+
{/* Component props documentation */}
|
|
58
|
+
<div className="font-bold text-lg pt-6">
|
|
59
|
+
Component API - <Code className="p-2">{`<SiteWrapper />`}</Code>
|
|
60
|
+
</div>
|
|
61
|
+
<PropsTable propsList={componentProps} />
|
|
62
|
+
</UsaceBox>
|
|
63
|
+
</DocsPage>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default ContainerDocs;
|
|
68
|
+
export { ContainerDocs };
|