@scottish-government/designsystem-react 0.10.1 → 0.10.2
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/.storybook/manager.ts +1 -7
- package/.storybook/sgdsArgTypes.ts +19 -0
- package/README.md +3 -0
- package/dist/common/AbstractNotificationBanner.jsx +2 -5
- package/dist/components/SequentialNavigation/SequentialNavigation.jsx +1 -0
- package/dist/components/TaskList/TaskList.jsx +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/common/AbstractNotificationBanner.tsx +2 -6
- package/src/components/Accordion/Accordion.Item.stories.tsx +62 -0
- package/src/components/Accordion/Accordion.stories.tsx +0 -50
- package/src/components/AspectBox/AspectBox.stories.tsx +1 -1
- package/src/components/BackToTop/BackToTop.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.Item.stories.tsx +35 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -1
- package/src/components/CategoryItem/CategoryItem.stories.tsx +1 -1
- package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +1 -1
- package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +1 -1
- package/src/components/ContentsNav/ContentsNav.Item.stories.tsx +45 -0
- package/src/components/ContentsNav/ContentsNav.stories.tsx +1 -2
- package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +27 -0
- package/src/components/CookieBanner/CookieBanner.stories.tsx +2 -2
- package/src/components/DatePicker/DatePicker.stories.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/components/ErrorSummary/ErrorSummary.Item.stories.tsx +28 -0
- package/src/components/ErrorSummary/ErrorSummary.stories.tsx +1 -2
- package/src/components/FileDownload/FileDownload.stories.tsx +1 -1
- package/src/components/HideThisPage/HideThisPage.stories.tsx +1 -1
- package/src/components/InsetText/InsetText.stories.tsx +1 -1
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +1 -1
- package/src/components/NotificationPanel/NotificationPanel.stories.tsx +1 -1
- package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
- package/src/components/PageMetadata/PageMetadata.Item.stories.tsx +31 -0
- package/src/components/PageMetadata/PageMetadata.stories.tsx +10 -5
- package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/RadioButton/RadioGroup.stories.tsx +1 -1
- package/src/components/SequentialNavigation/SequentialNavigation.Next.stories.tsx +35 -0
- package/src/components/SequentialNavigation/SequentialNavigation.Previous.stories.tsx +35 -0
- package/src/components/SequentialNavigation/SequentialNavigation.stories.tsx +1 -2
- package/src/components/SequentialNavigation/SequentialNavigation.test.tsx +15 -0
- package/src/components/SequentialNavigation/SequentialNavigation.tsx +1 -0
- package/src/components/SideNavigation/SideNavigation.Item.stories.tsx +36 -0
- package/src/components/SideNavigation/SideNavigation.List.stories.tsx +46 -0
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -2
- package/src/components/SiteFooter/SiteFooter.License.stories.tsx +39 -0
- package/src/components/SiteFooter/SiteFooter.Link.stories.tsx +25 -0
- package/src/components/SiteFooter/SiteFooter.Links.stories.tsx +32 -0
- package/src/components/SiteFooter/SiteFooter.Org.stories.tsx +38 -0
- package/src/components/SiteFooter/SiteFooter.stories.tsx +1 -1
- package/src/components/SiteHeader/SiteHeader.Brand.stories.tsx +45 -0
- package/src/components/SiteHeader/SiteHeader.stories.tsx +1 -1
- package/src/components/SiteNavigation/SiteNavigation.Item.stories.tsx +30 -0
- package/src/components/SiteNavigation/SiteNavigation.stories.tsx +1 -2
- package/src/components/SkipLinks/SkipLinks.Item.stories.tsx +27 -0
- package/src/components/SkipLinks/SkipLinks.stories.tsx +1 -1
- package/src/components/SummaryCard/SummaryCard.Action.stories.tsx +32 -0
- package/src/components/SummaryCard/SummaryCard.stories.tsx +1 -1
- package/src/components/SummaryList/SummaryList.Action.stories.tsx +32 -0
- package/src/components/SummaryList/SummaryList.Item.stories.tsx +35 -0
- package/src/components/SummaryList/SummaryList.Value.stories.tsx +27 -0
- package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.Item.stories.tsx +34 -0
- package/src/components/Tag/Tag.stories.tsx +2 -6
- package/src/components/TaskList/TaskList.Group.stories.tsx +101 -0
- package/src/components/TaskList/TaskList.Item.stories.tsx +70 -0
- package/src/components/TaskList/TaskList.stories.tsx +1 -1
- package/src/components/TaskList/TaskList.test.tsx +21 -1
- package/src/components/TaskList/TaskList.tsx +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import ContentsNav from './ContentsNav';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/ContentsNav/ContentsNav.Item',
|
|
8
|
+
component: ContentsNav.Item,
|
|
9
|
+
argTypes: {
|
|
10
|
+
isCurrent: argTypes.isCurrent(),
|
|
11
|
+
linkComponent: argTypes.linkComponent(),
|
|
12
|
+
children: argTypes.children()
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
children: <>
|
|
16
|
+
Apply for Blue Badge
|
|
17
|
+
</>,
|
|
18
|
+
href: '#foo'
|
|
19
|
+
}
|
|
20
|
+
} satisfies Meta<typeof ContentsNav.Item>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Current: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
isCurrent: true
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const NoLink: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
href: undefined
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const NoLinkCurrent: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
href: undefined,
|
|
43
|
+
isCurrent: true
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -4,12 +4,11 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ContentsNav from './ContentsNav';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ContentsNav',
|
|
8
8
|
component: ContentsNav,
|
|
9
9
|
argTypes: {
|
|
10
10
|
ariaLabel: argTypes.ariaLabel({description: 'Text to use for the content nav\'s aria-label property'}),
|
|
11
11
|
children: argTypes.children(),
|
|
12
|
-
linkComponent: argTypes.linkComponent(),
|
|
13
12
|
title: {
|
|
14
13
|
description: 'Title of the contents nav',
|
|
15
14
|
type: 'string'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import CookieBanner from './CookieBanner';
|
|
5
|
+
import Button from '../Button/Button';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/CookieBanner/CookieBanner.Buttons',
|
|
9
|
+
component: CookieBanner.Buttons,
|
|
10
|
+
argTypes: {
|
|
11
|
+
children: argTypes.children()
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
children: [
|
|
15
|
+
<Button className="js-accept-all-cookies" small buttonStyle="secondary">Accept all cookies</Button>,
|
|
16
|
+
<Button className="js-accept-essential-cookies" small buttonStyle="secondary">Use essential cookies only</Button>,
|
|
17
|
+
<a href="/cookies/">Set cookie preferences</a>
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
} satisfies Meta<typeof CookieBanner.Buttons>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
|
|
27
|
+
};
|
|
@@ -5,7 +5,7 @@ import CookieBanner from './CookieBanner';
|
|
|
5
5
|
import Button from '../Button/Button';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: 'Components/
|
|
8
|
+
title: 'Components/CookieBanner',
|
|
9
9
|
component: CookieBanner,
|
|
10
10
|
argTypes: {
|
|
11
11
|
children: argTypes.children()
|
|
@@ -16,7 +16,7 @@ const meta = {
|
|
|
16
16
|
experience.</p>,
|
|
17
17
|
<p key="bar">Click 'Accept all cookies' to agree to all cookies that collect anonymous data.
|
|
18
18
|
To only allow the cookies that make the site work, click 'Use essential cookies only.' Visit 'Set cookie preferences' to control specific cookies.</p>,
|
|
19
|
-
<CookieBanner.Buttons
|
|
19
|
+
<CookieBanner.Buttons>
|
|
20
20
|
<Button className="js-accept-all-cookies" small buttonStyle="secondary">Accept all cookies</Button>
|
|
21
21
|
<Button className="js-accept-essential-cookies" small buttonStyle="secondary">Use essential cookies only</Button>
|
|
22
22
|
<a href="/cookies/">Set cookie preferences</a>
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ErrorMessage from './ErrorMessage';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ErrorMessage',
|
|
8
8
|
component: ErrorMessage,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import ErrorSummary from './ErrorSummary';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/ErrorSummary/ErrorSummary.Item',
|
|
8
|
+
component: ErrorSummary.Item,
|
|
9
|
+
argTypes: {
|
|
10
|
+
fragmentId: {
|
|
11
|
+
description: 'ID of the question or field to link to',
|
|
12
|
+
type: 'string'
|
|
13
|
+
},
|
|
14
|
+
linkComponent: argTypes.linkComponent(),
|
|
15
|
+
children: argTypes.children()
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
fragmentId: 'did-resolve',
|
|
19
|
+
children: 'Did this resolve your issue?'
|
|
20
|
+
}
|
|
21
|
+
} satisfies Meta<typeof ErrorSummary.Item>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
|
|
28
|
+
};
|
|
@@ -4,10 +4,9 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ErrorSummary from './ErrorSummary';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ErrorSummary',
|
|
8
8
|
component: ErrorSummary,
|
|
9
9
|
argTypes: {
|
|
10
|
-
linkComponent: argTypes.linkComponent(),
|
|
11
10
|
title: {
|
|
12
11
|
description: 'The title of the error summary',
|
|
13
12
|
type: 'string'
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import NotificationBanner from './NotificationBanner';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/NotificationBanner',
|
|
8
8
|
component: NotificationBanner,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children(),
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import NotificationPanel from './NotificationPanel';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/NotificationPanel',
|
|
8
8
|
component: NotificationPanel,
|
|
9
9
|
argTypes: {
|
|
10
10
|
ariaLive: argTypes.ariaLive(),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import Metadata from './PageMetadata';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/PageMetadata/PageMetadata.Item',
|
|
8
|
+
component: Metadata.Item,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: argTypes.children(),
|
|
11
|
+
name: {
|
|
12
|
+
description: 'The name or key of the metadata item',
|
|
13
|
+
type: {
|
|
14
|
+
name: 'string',
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
name: 'Last updated',
|
|
21
|
+
children: '21/04/2020'
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
} satisfies Meta<typeof Metadata.Item>;
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
|
|
31
|
+
};
|
|
@@ -4,19 +4,24 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import Metadata from './PageMetadata';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/PageMetadata',
|
|
8
8
|
component: Metadata,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children(),
|
|
11
|
-
|
|
11
|
+
isInline: {
|
|
12
12
|
control: 'boolean',
|
|
13
13
|
description: 'Makes the page metadata use the truncated ‘inline’ display'
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
args: {
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
children: <>
|
|
18
|
+
<Metadata.Item name="Content type">
|
|
19
|
+
Publication
|
|
20
|
+
</Metadata.Item>
|
|
21
|
+
<Metadata.Item name="Last updated">
|
|
22
|
+
21/04/2020
|
|
23
|
+
</Metadata.Item>
|
|
24
|
+
</>
|
|
20
25
|
}
|
|
21
26
|
} satisfies Meta<typeof Metadata>;
|
|
22
27
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SequentialNavigation from './SequentialNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SequentialNavigation/SequentialNavigation.Next',
|
|
8
|
+
component: SequentialNavigation.Next,
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: argTypes.href(),
|
|
11
|
+
linkComponent: argTypes.linkComponent(),
|
|
12
|
+
textLabel: {
|
|
13
|
+
description: 'String to use for the label that precedes the link text',
|
|
14
|
+
type: 'string'
|
|
15
|
+
},
|
|
16
|
+
children: argTypes.children()
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
href: '#previous',
|
|
20
|
+
children: 'Apply for or renew a Blue Badge'
|
|
21
|
+
}
|
|
22
|
+
} satisfies Meta<typeof SequentialNavigation.Next>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const CustomLabel: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
textLabel: 'Next page'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SequentialNavigation from './SequentialNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SequentialNavigation/SequentialNavigation.Previous',
|
|
8
|
+
component: SequentialNavigation.Previous,
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: argTypes.href(),
|
|
11
|
+
linkComponent: argTypes.linkComponent(),
|
|
12
|
+
textLabel: {
|
|
13
|
+
description: 'String to use for the label that precedes the link text',
|
|
14
|
+
type: 'string'
|
|
15
|
+
},
|
|
16
|
+
children: argTypes.children()
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
href: '#previous',
|
|
20
|
+
children: 'Apply for or renew a Blue Badge'
|
|
21
|
+
}
|
|
22
|
+
} satisfies Meta<typeof SequentialNavigation.Previous>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const CustomLabel: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
textLabel: 'Previous page'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -4,11 +4,10 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import SequentialNavigation from './SequentialNavigation';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/SequentialNavigation',
|
|
8
8
|
component: SequentialNavigation,
|
|
9
9
|
argTypes: {
|
|
10
10
|
ariaLabel: argTypes.ariaLabel({ description: 'Text to use for an aria-label attribute on the nav element' }),
|
|
11
|
-
linkComponent: argTypes.linkComponent(),
|
|
12
11
|
children: argTypes.children()
|
|
13
12
|
},
|
|
14
13
|
args: {
|
|
@@ -72,6 +72,21 @@ test('sequential nav links with custom element', () => {
|
|
|
72
72
|
expect(link?.textContent).toEqual(PREVIOUS_LINK_OBJECT.title);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
test('custom text label on link', () => {
|
|
76
|
+
const TEXT_LABEL = 'foo';
|
|
77
|
+
|
|
78
|
+
render(
|
|
79
|
+
<SequentialNavigation>
|
|
80
|
+
<SequentialNavigation.Previous textLabel={TEXT_LABEL} href={PREVIOUS_LINK_OBJECT.href}>
|
|
81
|
+
{PREVIOUS_LINK_OBJECT.title}
|
|
82
|
+
</SequentialNavigation.Previous>
|
|
83
|
+
</SequentialNavigation>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const prevLink = screen.getAllByRole('link')[0];
|
|
87
|
+
expect(prevLink.querySelector('span')?.dataset.label).toEqual(TEXT_LABEL);
|
|
88
|
+
});
|
|
89
|
+
|
|
75
90
|
test('passing additional props', () => {
|
|
76
91
|
render(
|
|
77
92
|
<SequentialNavigation data-test="foo" />
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SideNavigation from './SideNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SideNavigation/SideNavigation.Item',
|
|
8
|
+
component: SideNavigation.Item,
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: argTypes.href(),
|
|
11
|
+
isCurrent: argTypes.isCurrent(),
|
|
12
|
+
linkComponent: argTypes.linkComponent(),
|
|
13
|
+
title: {
|
|
14
|
+
description: 'Text of the navigation item',
|
|
15
|
+
type: 'string'
|
|
16
|
+
},
|
|
17
|
+
children: argTypes.children()
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
href: '#bananas',
|
|
21
|
+
title: 'Bananas'
|
|
22
|
+
}
|
|
23
|
+
} satisfies Meta<typeof SideNavigation.Item>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const CurrentItem: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
isCurrent: true
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SideNavigation from './SideNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SideNavigation/SideNavigation.List',
|
|
8
|
+
component: SideNavigation.List,
|
|
9
|
+
argTypes: {
|
|
10
|
+
isRoot: {
|
|
11
|
+
description: 'Indicates that this is the root list in a nested structure. Required for mobile navigation.',
|
|
12
|
+
control: 'boolean'
|
|
13
|
+
},
|
|
14
|
+
children: argTypes.children()
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
children: <>
|
|
18
|
+
<SideNavigation.Item
|
|
19
|
+
isCurrent
|
|
20
|
+
href="#apples"
|
|
21
|
+
title="Apples"
|
|
22
|
+
>
|
|
23
|
+
</SideNavigation.Item>
|
|
24
|
+
<SideNavigation.Item
|
|
25
|
+
href="#bananas"
|
|
26
|
+
title="Bananas"
|
|
27
|
+
/>
|
|
28
|
+
<SideNavigation.Item
|
|
29
|
+
href="#cherries"
|
|
30
|
+
title="Cherries"
|
|
31
|
+
/>
|
|
32
|
+
<SideNavigation.Item
|
|
33
|
+
href="#dates"
|
|
34
|
+
title="Dates"
|
|
35
|
+
/>
|
|
36
|
+
</>,
|
|
37
|
+
isRoot: true
|
|
38
|
+
}
|
|
39
|
+
} satisfies Meta<typeof SideNavigation.List>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const Default: Story = {
|
|
45
|
+
|
|
46
|
+
};
|
|
@@ -4,10 +4,9 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import SideNavigation from './SideNavigation';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/SideNavigation',
|
|
8
8
|
component: SideNavigation,
|
|
9
9
|
argTypes: {
|
|
10
|
-
linkComponent: argTypes.linkComponent(),
|
|
11
10
|
children: argTypes.children()
|
|
12
11
|
},
|
|
13
12
|
args: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteFooter from './SiteFooter';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SiteFooter/SiteFooter.License',
|
|
8
|
+
component: SiteFooter.License,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: argTypes.children()
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
children: <>
|
|
14
|
+
<svg focusable="false" version="1.1" width="41" height="17" id="ogl-logo" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
|
15
|
+
viewBox="0 0 852.16 345.09">
|
|
16
|
+
<title>ogl</title>
|
|
17
|
+
<polygon className="fill" points="743.3 251.79 743.3 0.2 653.9 57.2 653.9 341.2 852.16 341.2 852.16 251.79 743.3 251.79"></polygon>
|
|
18
|
+
<path className="fill" d="M599.62,312.56a83.12,83.12,0,1,1,15.26-107.08l75.36-48a172.35,172.35,0,0,0-295.59,7.84A172.61,172.61,0,0,0,244.49,77.59C149.35,77.59,72,155,72,250.14s77.4,172.54,172.54,172.54A172.6,172.6,0,0,0,394.65,335a172.29,172.29,0,0,0,263.9,44.78l34.25,39.07h5.33V264H557ZM244.49,333.28a83.14,83.14,0,1,1,83.14-83.14A83.24,83.24,0,0,1,244.49,333.28Z" transform="translate(-71.95 -77.59)"/>
|
|
19
|
+
</svg>
|
|
20
|
+
<p>
|
|
21
|
+
All content is available under the{' '}
|
|
22
|
+
<a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/">
|
|
23
|
+
Open Government Licence v3.0
|
|
24
|
+
</a>
|
|
25
|
+
, except for graphic assets and where otherwise stated
|
|
26
|
+
</p>
|
|
27
|
+
<p>
|
|
28
|
+
© Crown Copyright
|
|
29
|
+
</p>
|
|
30
|
+
</>
|
|
31
|
+
}
|
|
32
|
+
} satisfies Meta<typeof SiteFooter.License>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
|
|
39
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteFooter from './SiteFooter';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SiteFooter/SiteFooter.Link',
|
|
8
|
+
component: SiteFooter.Link,
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: argTypes.href(),
|
|
11
|
+
linkComponent: argTypes.linkComponent(),
|
|
12
|
+
children: argTypes.children()
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
children: 'Cookies',
|
|
16
|
+
href: '#cookies'
|
|
17
|
+
}
|
|
18
|
+
} satisfies Meta<typeof SiteFooter.Link>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
|
|
25
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteFooter from './SiteFooter';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SiteFooter/SiteFooter.Links',
|
|
8
|
+
component: SiteFooter.Links,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: argTypes.children()
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
children: <>
|
|
14
|
+
<SiteFooter.Link href="#">
|
|
15
|
+
Privacy
|
|
16
|
+
</SiteFooter.Link>
|
|
17
|
+
<SiteFooter.Link href="#">
|
|
18
|
+
Cookies
|
|
19
|
+
</SiteFooter.Link>
|
|
20
|
+
<SiteFooter.Link href="#">
|
|
21
|
+
Accessibility
|
|
22
|
+
</SiteFooter.Link>
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
} satisfies Meta<typeof SiteFooter.Links>;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
|
|
32
|
+
};
|