Skip to content

Commit 85d50c7

Browse files
authored
Merge pull request #185 from newjersey/chore/0402-migrate-components
Add Sub pages for template layouts
2 parents 6adfdb3 + 72d3e71 commit 85d50c7

File tree

18 files changed

+999
-25
lines changed

18 files changed

+999
-25
lines changed

.storybook/preview.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ import type { StoryFn, StoryContext, Args } from "@storybook/web-components-vite
44
import "@uswds/uswds";
55
import "./storybook.css";
66

7-
// A decorator to wrap stories in a div that applies padding and background color based on theme
8-
const storyWrapperDecorator = <TArgs extends Args>(
9-
Story: StoryFn<TArgs>,
10-
context: StoryContext<TArgs>,
11-
) => {
12-
const className = context.args.theme === "dark" ? "usa-dark-background" : "";
13-
14-
return html`
15-
<div class="display-block padding-2 ${className}">${Story(context.args, context)}</div>
16-
`;
17-
};
18-
197
const preview: Preview = {
208
parameters: {
219
layout: "fullscreen",
@@ -39,7 +27,7 @@ const preview: Preview = {
3927
test: "todo",
4028
},
4129
},
42-
decorators: [storyWrapperDecorator],
30+
decorators: [],
4331
};
4432

4533
export default preview;

.storybook/storybook.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
.margin-top-0 {
99
margin-top: 0 !important;
1010
}
11+
12+
.docs-story,
13+
#storybook-root {
14+
padding: 1rem;
15+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"url": "https://github.com/newjersey/njwds/issues"
3434
},
3535
"homepage": "https://github.com/newjersey/njwds#readme",
36+
"sideEffects": [
37+
"**/*.css"
38+
],
3639
"dependencies": {
3740
"@uswds/uswds": "3.10.0",
3841
"lit": "^3.3.2"

src/stories/elements/Link/Link.stories.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ const meta = {
66
title: "Elements/Link",
77
tags: ["autodocs"],
88
render: (args) => Link(args),
9-
argTypes: {
10-
theme: {
11-
control: { type: "select" },
12-
options: ["light", "dark"],
13-
},
14-
},
159
} satisfies Meta<LinkProps>;
1610

1711
export default meta;
@@ -20,7 +14,6 @@ type Story = StoryObj<LinkProps>;
2014
export const Basic: Story = {
2115
args: {
2216
label: "Link text",
23-
theme: "light",
2417
external: false,
2518
},
2619
};

src/stories/elements/Link/Link.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,26 @@ export const Link = ({ label, theme = "light", external = false }: LinkProps) =>
1313
const linkTheme = theme !== "light" ? "" : "";
1414

1515
return html`
16-
<a
17-
href="!#"
18-
class=${["usa-link", external && "usa-link--external", linkTheme].filter(Boolean).join(" ")}
19-
>${label}</a
20-
>
16+
<p>
17+
<a
18+
href="!#"
19+
class=${["usa-link", external && "usa-link--external", linkTheme].filter(Boolean).join(" ")}
20+
>
21+
${label}
22+
</a>
23+
</p>
24+
25+
<div class="usa-dark-background">
26+
<p>
27+
<a
28+
href="!#"
29+
class=${["usa-link", external && "usa-link--external", linkTheme]
30+
.filter(Boolean)
31+
.join(" ")}
32+
>
33+
${label}
34+
</a>
35+
</p>
36+
</div>
2137
`;
2238
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
2+
3+
import { DocumentationLayout } from "./Documentation";
4+
import "@uswds/uswds";
5+
6+
const meta = {
7+
title: "Templates/Documentation",
8+
tags: ["autodocs"],
9+
render: () => DocumentationLayout(),
10+
} satisfies Meta;
11+
12+
export default meta;
13+
type Story = StoryObj;
14+
15+
export const Default: Story = {};

0 commit comments

Comments
 (0)