@ndla/ui 47.1.2 → 47.2.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/es/BlogPost/BlogPost.js +6 -7
- package/es/{Image/LazyLoadImage.js → ExpandableBox/ExpandableBox.js} +15 -32
- package/es/ExpandableBox/index.js +9 -0
- package/es/Footer/Footer.js +8 -8
- package/es/Footer/FooterLinks.js +6 -6
- package/es/FramedContent/FramedContent.js +37 -0
- package/es/FramedContent/index.js +10 -0
- package/es/Image/Image.js +5 -14
- package/es/Resource/storyComponents.js +67 -0
- package/es/index.js +2 -0
- package/es/locale/messages-en.js +17 -5
- package/es/locale/messages-nb.js +17 -5
- package/es/locale/messages-nn.js +17 -5
- package/es/locale/messages-se.js +15 -3
- package/es/locale/messages-sma.js +19 -7
- package/lib/BlogPost/BlogPost.js +6 -7
- package/lib/ExpandableBox/ExpandableBox.d.ts +15 -0
- package/lib/ExpandableBox/ExpandableBox.js +41 -0
- package/lib/ExpandableBox/index.d.ts +8 -0
- package/lib/ExpandableBox/index.js +18 -0
- package/lib/Footer/Footer.d.ts +5 -9
- package/lib/Footer/Footer.js +8 -8
- package/lib/Footer/FooterLinks.d.ts +5 -9
- package/lib/Footer/FooterLinks.js +6 -6
- package/lib/FramedContent/FramedContent.d.ts +12 -0
- package/lib/{Image/LazyLoadImage.js → FramedContent/FramedContent.js} +25 -37
- package/lib/FramedContent/index.d.ts +9 -0
- package/lib/FramedContent/index.js +17 -0
- package/lib/Image/Image.js +5 -14
- package/lib/Resource/storyComponents.d.ts +12 -0
- package/lib/Resource/storyComponents.js +74 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +20 -0
- package/lib/locale/messages-en.d.ts +14 -2
- package/lib/locale/messages-en.js +17 -5
- package/lib/locale/messages-nb.d.ts +14 -2
- package/lib/locale/messages-nb.js +17 -5
- package/lib/locale/messages-nn.d.ts +14 -2
- package/lib/locale/messages-nn.js +17 -5
- package/lib/locale/messages-se.d.ts +14 -2
- package/lib/locale/messages-se.js +15 -3
- package/lib/locale/messages-sma.d.ts +14 -2
- package/lib/locale/messages-sma.js +19 -7
- package/package.json +19 -19
- package/src/Article/ArticleByline.stories.tsx +52 -0
- package/src/BlogPost/BlogPost.tsx +1 -7
- package/src/Breadcrumb/Breadcrumb.stories.tsx +77 -0
- package/src/Breadcrumb/HomeBreadcrumb.stories.tsx +57 -0
- package/src/ContentLoader/ContentLoader.stories.tsx +64 -0
- package/src/CreatedBy/CreatedBy.stories.tsx +38 -0
- package/src/ErrorMessage/ErrorMessage.stories.tsx +59 -0
- package/src/ExpandableBox/ExpandableBox.stories.tsx +34 -0
- package/src/ExpandableBox/ExpandableBox.tsx +21 -0
- package/src/ExpandableBox/index.ts +9 -0
- package/src/FactBox/Factbox.stories.tsx +62 -0
- package/src/FileList/FileList.stories.tsx +48 -0
- package/src/Footer/Footer.stories.tsx +116 -0
- package/src/Footer/Footer.tsx +5 -9
- package/src/Footer/FooterLinks.tsx +5 -9
- package/src/FramedContent/FramedContent.stories.tsx +88 -0
- package/src/FramedContent/FramedContent.tsx +29 -0
- package/src/FramedContent/index.ts +10 -0
- package/src/Image/Image.stories.tsx +63 -0
- package/src/Image/Image.tsx +3 -17
- package/src/Image/__tests__/__snapshots__/Image-test.jsx.snap +19 -10
- package/src/List/OrderedList.stories.tsx +114 -0
- package/src/List/UnorderedList.stories.tsx +46 -0
- package/src/Logo/Logo.stories.tsx +50 -0
- package/src/Messages/MessageBanner.stories.tsx +33 -0
- package/src/Messages/MessageBox.stories.tsx +60 -0
- package/src/MyNdla/Resource/Folder.stories.tsx +31 -4
- package/src/MyNdla/Resource/FolderInput.stories.tsx +29 -0
- package/src/Resource/BlockResource.stories.tsx +51 -5
- package/src/Resource/ListResource.stories.tsx +98 -0
- package/src/Resource/storyComponents.tsx +46 -0
- package/src/SnackBar/Snack.stories.tsx +91 -0
- package/src/Table/Table.stories.tsx +701 -0
- package/src/TagSelector/TagSelector.stories.tsx +88 -0
- package/src/index.ts +2 -0
- package/src/locale/messages-en.ts +13 -4
- package/src/locale/messages-nb.ts +16 -4
- package/src/locale/messages-nn.ts +16 -4
- package/src/locale/messages-se.ts +11 -2
- package/src/locale/messages-sma.ts +15 -6
- package/lib/Image/LazyLoadImage.d.ts +0 -17
- package/src/Image/LazyLoadImage.tsx +0 -37
- package/src/Resource/Resource.stories.tsx +0 -81
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import ContentLoader from '.';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Components/ContentLoader',
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
parameters: {
|
|
17
|
+
inlineStories: true,
|
|
18
|
+
...defaultParameters,
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
speed: 2,
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
children: { control: false },
|
|
25
|
+
},
|
|
26
|
+
component: ContentLoader,
|
|
27
|
+
} as Meta<typeof ContentLoader>;
|
|
28
|
+
|
|
29
|
+
export const ImageOrVideo: StoryObj<typeof ContentLoader> = {
|
|
30
|
+
args: {
|
|
31
|
+
width: 1000,
|
|
32
|
+
height: 750,
|
|
33
|
+
children: (
|
|
34
|
+
<>
|
|
35
|
+
<rect x="0" y="0" rx="3" ry="3" width="800" height="600" />
|
|
36
|
+
<rect x="20" y="610" rx="3" ry="3" width="600" height="30" />
|
|
37
|
+
<rect x="20" y="650" rx="3" ry="3" width="400" height="30" />
|
|
38
|
+
<circle cx="30" cy="700" r="15" fill="purple" />
|
|
39
|
+
<circle cx="70" cy="700" r="15" fill="purple" />
|
|
40
|
+
<circle cx="110" cy="700" r="15" fill="purple" />
|
|
41
|
+
</>
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Article: StoryObj<typeof ContentLoader> = {
|
|
47
|
+
args: {
|
|
48
|
+
width: 1000,
|
|
49
|
+
height: 1050,
|
|
50
|
+
children: (
|
|
51
|
+
<>
|
|
52
|
+
<rect x="100" y="0" rx="3" ry="3" width="800" height="60" />
|
|
53
|
+
<rect x="100" y="100" rx="3" ry="3" width="800" height="25" />
|
|
54
|
+
<rect x="100" y="140" rx="3" ry="3" width="800" height="25" />
|
|
55
|
+
<rect x="100" y="180" rx="3" ry="3" width="400" height="25" />
|
|
56
|
+
<rect x="0" y="260" rx="3" ry="3" width="1000" height="600" />
|
|
57
|
+
<rect x="100" y="900" rx="3" ry="3" width="800" height="20" />
|
|
58
|
+
<rect x="100" y="930" rx="3" ry="3" width="800" height="20" />
|
|
59
|
+
<rect x="100" y="970" rx="3" ry="3" width="800" height="20" />
|
|
60
|
+
<rect x="100" y="1000" rx="3" ry="3" width="600" height="20" />
|
|
61
|
+
</>
|
|
62
|
+
),
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import CreatedBy from './CreatedBy';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
|
|
13
|
+
/***
|
|
14
|
+
* LTI-versjoner av innhold fra NDLA skal vise denne teksten og logo i bunnen. "NDLA" og logoen lenker til ndla.no. "Artikkel" kan være en lenke til artikkelen på ndla.no om den fins. Begge lenker åpner som standard i ny fane men det kan overstyres med target-parameter.
|
|
15
|
+
*/
|
|
16
|
+
export default {
|
|
17
|
+
title: 'Components/CreatedBy',
|
|
18
|
+
component: CreatedBy,
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
parameters: {
|
|
21
|
+
inlineStories: true,
|
|
22
|
+
...defaultParameters,
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
name: 'Artikkelen',
|
|
26
|
+
description: 'er utarbeidet av',
|
|
27
|
+
},
|
|
28
|
+
} as Meta<typeof CreatedBy>;
|
|
29
|
+
|
|
30
|
+
export const WithoutLink: StoryObj<typeof CreatedBy> = {
|
|
31
|
+
args: {},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const WithLink: StoryObj<typeof CreatedBy> = {
|
|
35
|
+
args: {
|
|
36
|
+
url: 'https://ndla.no/subject:26/topic:1:191103/topic:1:4352/resource:1:2052',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react';
|
|
10
|
+
import ErrorMessage from './ErrorMessage';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
//@ts-ignore
|
|
13
|
+
import Oops from '../../../../images/oops.gif';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Feilmeldingskomponenten lenker tilbake til forrige side eller til forsiden. Den brukes når det har oppstått en feil i systemet, f.eks. ved 404- eller 503-feil.
|
|
17
|
+
*/
|
|
18
|
+
export default {
|
|
19
|
+
title: 'Patterns/ErrorMessage',
|
|
20
|
+
component: ErrorMessage,
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
parameters: {
|
|
23
|
+
inlineStories: true,
|
|
24
|
+
...defaultParameters,
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
illustration: {
|
|
28
|
+
url: Oops,
|
|
29
|
+
altText: 'Systemfeil',
|
|
30
|
+
},
|
|
31
|
+
messages: {
|
|
32
|
+
title: 'Oisann, her gikk noe galt',
|
|
33
|
+
description: 'En kort beskrivelse av feilen som oppsto.',
|
|
34
|
+
linksTitle: 'Kom igang:',
|
|
35
|
+
back: 'Gå tilbake',
|
|
36
|
+
goToFrontPage: 'Gå til forsiden',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
} as Meta<typeof ErrorMessage>;
|
|
40
|
+
|
|
41
|
+
export const ErrorMessageStory: StoryFn<typeof ErrorMessage> = (args) => {
|
|
42
|
+
return <ErrorMessage {...args} />;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
ErrorMessageStory.storyName = 'ErrorMessage';
|
|
46
|
+
|
|
47
|
+
export const LoginFailed: StoryObj<typeof ErrorMessage> = {
|
|
48
|
+
args: {
|
|
49
|
+
illustration: {
|
|
50
|
+
url: Oops,
|
|
51
|
+
altText: 'Systemfeil',
|
|
52
|
+
},
|
|
53
|
+
messages: {
|
|
54
|
+
title: 'Ops, her gikk noe galt',
|
|
55
|
+
linksTitle: 'Prøv igjen',
|
|
56
|
+
logInFailed: 'Logg inn',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import { ExpandableBox, ExpandableBoxSummary } from './ExpandableBox';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This is just a thin wrapper around the native HTML details element.
|
|
15
|
+
* `ExpandableBoxSummary` is a thin wrapper around the native HTML summary element.
|
|
16
|
+
* The components will eventually add style and functionality to the native elements, as opposed to the components being styled by global css.
|
|
17
|
+
*/
|
|
18
|
+
export default {
|
|
19
|
+
title: 'Components/ExpandableBox',
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
parameters: {
|
|
22
|
+
inlineStories: true,
|
|
23
|
+
...defaultParameters,
|
|
24
|
+
},
|
|
25
|
+
component: ExpandableBox,
|
|
26
|
+
render: (args) => (
|
|
27
|
+
<ExpandableBox {...args}>
|
|
28
|
+
<ExpandableBoxSummary>Open me</ExpandableBoxSummary>
|
|
29
|
+
Everything here is only visible when the box is open
|
|
30
|
+
</ExpandableBox>
|
|
31
|
+
),
|
|
32
|
+
} as Meta<typeof ExpandableBox>;
|
|
33
|
+
|
|
34
|
+
export const Default: StoryObj<typeof ExpandableBox> = {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { HTMLAttributes } from 'react';
|
|
10
|
+
|
|
11
|
+
interface Props extends HTMLAttributes<HTMLDetailsElement> {}
|
|
12
|
+
|
|
13
|
+
export const ExpandableBox = ({ children, ...rest }: Props) => {
|
|
14
|
+
return <details {...rest}>{children}</details>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
interface SummaryProps extends HTMLAttributes<HTMLElement> {}
|
|
18
|
+
|
|
19
|
+
export const ExpandableBoxSummary = ({ children, ...rest }: SummaryProps) => {
|
|
20
|
+
return <summary {...rest}>{children}</summary>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import styled from '@emotion/styled';
|
|
10
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
11
|
+
import { spacing } from '@ndla/core';
|
|
12
|
+
import { Heading, Text } from '@ndla/typography';
|
|
13
|
+
import FactBoxV2 from './FactBoxV2';
|
|
14
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
15
|
+
|
|
16
|
+
const Wrapper = styled.div`
|
|
17
|
+
padding: ${spacing.normal};
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*For alt nytt innhold på ndla.no skal ikke flytende høyrespalte benyttes. I stedet benytter vi faktabokser innenfor innholdsspalten.
|
|
22
|
+
*/
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Components/FactBox',
|
|
25
|
+
component: FactBoxV2,
|
|
26
|
+
tags: ['autodocs'],
|
|
27
|
+
paramemeters: {
|
|
28
|
+
inlineStories: true,
|
|
29
|
+
...defaultParameters,
|
|
30
|
+
},
|
|
31
|
+
decorators: [
|
|
32
|
+
(Story) => (
|
|
33
|
+
<Wrapper>
|
|
34
|
+
<Story />
|
|
35
|
+
</Wrapper>
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
args: {
|
|
39
|
+
children: (
|
|
40
|
+
<>
|
|
41
|
+
<Heading element="h2" headingStyle="h2">
|
|
42
|
+
Faktaboks
|
|
43
|
+
</Heading>
|
|
44
|
+
<Text textStyle="content">
|
|
45
|
+
En faktaboks kan inneholde punktlister eller korte fakta som er relevant for artikkelens innhold.
|
|
46
|
+
</Text>
|
|
47
|
+
<Text textStyle="content">
|
|
48
|
+
Det anbefales å ikke ha for mye innhold i faktaboks, slik at lese-konteksten i størst mulig grad beholdes.
|
|
49
|
+
</Text>
|
|
50
|
+
<Heading element="h2" headingStyle="h2">
|
|
51
|
+
Enkel tittel
|
|
52
|
+
</Heading>
|
|
53
|
+
<Text textStyle="content">
|
|
54
|
+
Faktaboksen kan også brukes til å oppsummere innhold i slutten av en artikkel, og den kan inneholde
|
|
55
|
+
lisensiering om eksternt innhold er brukt.
|
|
56
|
+
</Text>
|
|
57
|
+
</>
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
} as Meta<typeof FactBoxV2>;
|
|
61
|
+
|
|
62
|
+
export const Default: StoryObj<typeof FactBoxV2> = {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import FileV2 from './FileV2';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
import FileListV2 from './FileListV2';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/FileList',
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
component: FileV2,
|
|
18
|
+
parameters: {
|
|
19
|
+
inlineStories: true,
|
|
20
|
+
...defaultParameters,
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
title: 'Min fil',
|
|
24
|
+
url: 'https://www.ndla.no',
|
|
25
|
+
fileExists: true,
|
|
26
|
+
fileType: 'pdf',
|
|
27
|
+
},
|
|
28
|
+
render: (args) => (
|
|
29
|
+
<FileListV2>
|
|
30
|
+
<FileV2 {...args} />
|
|
31
|
+
</FileListV2>
|
|
32
|
+
),
|
|
33
|
+
} as Meta<typeof FileV2>;
|
|
34
|
+
|
|
35
|
+
export const FileNotFound: StoryObj<typeof FileV2> = {
|
|
36
|
+
args: { fileExists: false },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const SeveralFiles: StoryObj<typeof FileV2> = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<FileListV2>
|
|
42
|
+
<FileV2 title="Fil 1" url="https://ndla.no/1" fileExists fileType="mp4" />
|
|
43
|
+
<FileV2 title="Fil 2" url="https://ndla.no/2" fileExists={false} fileType="pdf" />
|
|
44
|
+
<FileV2 title="Fil 3" url="https://ndla.no/3" fileExists fileType="docx" />
|
|
45
|
+
<FileV2 title="Fil 4" url="https://ndla.no/4" fileExists fileType="docx" />
|
|
46
|
+
</FileListV2>
|
|
47
|
+
),
|
|
48
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import { EmailOutline, Facebook, Instagram, LinkedIn, Share, Youtube } from '@ndla/icons/common';
|
|
11
|
+
import Footer from './Footer';
|
|
12
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
13
|
+
import { FooterText } from './FooterText';
|
|
14
|
+
import { EditorName } from './EditorName';
|
|
15
|
+
import { LanguageSelector } from '../LanguageSelector';
|
|
16
|
+
|
|
17
|
+
const mockFooterLinks = [
|
|
18
|
+
{
|
|
19
|
+
to: 'https://www.facebook.com/ndla.no',
|
|
20
|
+
text: 'NDLA på Facebook',
|
|
21
|
+
icon: <Facebook />,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
to: 'https://instagram.com/ndla_no/',
|
|
25
|
+
text: 'NDLA på Instagram',
|
|
26
|
+
icon: <Instagram />,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
to: 'https://www.linkedin.com/company/ndla/',
|
|
30
|
+
text: 'NDLA på LinkedIn',
|
|
31
|
+
icon: <LinkedIn />,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
to: 'https://www.youtube.com/channel/UCBlt6T8B0mmvDh3k5q7EhsA',
|
|
35
|
+
text: 'NDLA på YouTube',
|
|
36
|
+
icon: <Youtube />,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
to: 'https://om.ndla.no/nyhetsbrev/',
|
|
40
|
+
text: 'Meld deg på vårt nyhetsbrev',
|
|
41
|
+
icon: <EmailOutline />,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
to: '#',
|
|
45
|
+
text: 'Del denne siden',
|
|
46
|
+
icon: <Share />,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const privacyLinks = [
|
|
51
|
+
{ label: 'Personvernerklæring', url: 'https://om.ndla.no/gdpr' },
|
|
52
|
+
{ label: 'Erklæring om informasjonskapsler', url: 'https://om.ndla.no/cookies' },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
title: 'Components/Footer',
|
|
57
|
+
tags: ['autodocs'],
|
|
58
|
+
component: Footer,
|
|
59
|
+
parameters: {
|
|
60
|
+
inlineStories: true,
|
|
61
|
+
...defaultParameters,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
args: {
|
|
65
|
+
children: (
|
|
66
|
+
<>
|
|
67
|
+
<FooterText>
|
|
68
|
+
<EditorName title="Ansvarlig redaktør:" name="Sigurd Trageton" />
|
|
69
|
+
</FooterText>
|
|
70
|
+
<FooterText>Nettstedet er utarbeidet av NDLA med åpen kildekode.</FooterText>
|
|
71
|
+
</>
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
argTypes: {
|
|
75
|
+
children: { control: false },
|
|
76
|
+
languageSelector: { control: false },
|
|
77
|
+
auth: { control: false },
|
|
78
|
+
},
|
|
79
|
+
render: (args) => <Footer {...args}></Footer>,
|
|
80
|
+
} as Meta<typeof Footer>;
|
|
81
|
+
|
|
82
|
+
export const Default: StoryObj<typeof Footer> = {};
|
|
83
|
+
|
|
84
|
+
export const WithContentAndLinks: StoryObj<typeof Footer> = {
|
|
85
|
+
args: {
|
|
86
|
+
privacyLinks: privacyLinks,
|
|
87
|
+
links: mockFooterLinks,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const WithoutContent: StoryObj<typeof Footer> = {
|
|
92
|
+
args: {
|
|
93
|
+
children: undefined,
|
|
94
|
+
links: mockFooterLinks,
|
|
95
|
+
privacyLinks: privacyLinks,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const WithLanguageSelector: StoryObj<typeof Footer> = {
|
|
100
|
+
args: {
|
|
101
|
+
privacyLinks: privacyLinks,
|
|
102
|
+
links: mockFooterLinks,
|
|
103
|
+
// eslint-disable-next-line no-console
|
|
104
|
+
languageSelector: <LanguageSelector inverted locales={['nn', 'nb']} onSelect={console.log} />,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const WithAuthBlock: StoryObj<typeof Footer> = {
|
|
109
|
+
args: {
|
|
110
|
+
privacyLinks: privacyLinks,
|
|
111
|
+
links: mockFooterLinks,
|
|
112
|
+
// eslint-disable-next-line no-console
|
|
113
|
+
languageSelector: <LanguageSelector inverted locales={['nn', 'nb']} onSelect={console.log} />,
|
|
114
|
+
auth: <div>Auth info can be placed down here</div>,
|
|
115
|
+
},
|
|
116
|
+
};
|
package/src/Footer/Footer.tsx
CHANGED
|
@@ -113,15 +113,11 @@ const StyledLanguageWrapper = styled.div`
|
|
|
113
113
|
type Props = {
|
|
114
114
|
children: ReactNode;
|
|
115
115
|
lang: Locale;
|
|
116
|
-
links?:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
facebook: string;
|
|
122
|
-
twitter: string;
|
|
123
|
-
},
|
|
124
|
-
];
|
|
116
|
+
links?: {
|
|
117
|
+
to: string;
|
|
118
|
+
text: string;
|
|
119
|
+
icon: ReactNode;
|
|
120
|
+
}[];
|
|
125
121
|
privacyLinks?: {
|
|
126
122
|
url: string;
|
|
127
123
|
label: string;
|
|
@@ -26,15 +26,11 @@ const StyledLinksWrapper = styled.div`
|
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
28
|
type FooterLinksProps = {
|
|
29
|
-
links:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
facebook: string;
|
|
35
|
-
twitter: string;
|
|
36
|
-
},
|
|
37
|
-
];
|
|
29
|
+
links: {
|
|
30
|
+
to: string;
|
|
31
|
+
text: string;
|
|
32
|
+
icon: ReactNode;
|
|
33
|
+
}[];
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
const commonLinks = [
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
11
|
+
import FramedContent from './FramedContent';
|
|
12
|
+
import FigureImage from '../../../../stories/article/FigureImage';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/FramedContent',
|
|
16
|
+
component: FramedContent,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
parameters: {
|
|
19
|
+
inlineStories: true,
|
|
20
|
+
...defaultParameters,
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
children: <p>Content!</p>,
|
|
24
|
+
},
|
|
25
|
+
} as Meta<typeof FramedContent>;
|
|
26
|
+
|
|
27
|
+
export const WithFloating: StoryObj<typeof FramedContent> = {
|
|
28
|
+
args: {
|
|
29
|
+
children: (
|
|
30
|
+
<>
|
|
31
|
+
<p>En boks med flytelementer</p>
|
|
32
|
+
<FigureImage embedData={{ alt: '', align: 'right' }} />
|
|
33
|
+
<p>
|
|
34
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
35
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
36
|
+
</p>
|
|
37
|
+
<p>
|
|
38
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
39
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
40
|
+
</p>
|
|
41
|
+
</>
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const TooMuchContent: StoryObj<typeof FramedContent> = {
|
|
47
|
+
args: {
|
|
48
|
+
children: (
|
|
49
|
+
<>
|
|
50
|
+
<h2>
|
|
51
|
+
Tekst i ramme fungerer <em>dårlig</em> med mye tekst.
|
|
52
|
+
</h2>
|
|
53
|
+
<p>
|
|
54
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
55
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
56
|
+
</p>
|
|
57
|
+
<p>
|
|
58
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
59
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
60
|
+
</p>
|
|
61
|
+
<p>
|
|
62
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
63
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
64
|
+
</p>
|
|
65
|
+
<p>
|
|
66
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
67
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
68
|
+
</p>
|
|
69
|
+
<p>
|
|
70
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
71
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
72
|
+
</p>
|
|
73
|
+
<p>
|
|
74
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
75
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
76
|
+
</p>
|
|
77
|
+
<p>
|
|
78
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
79
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
80
|
+
</p>
|
|
81
|
+
<p>
|
|
82
|
+
Pitching er også en god måte å bevisstgjøre seg selv på. Når du pitcher, blir idéen og historien i den filmen
|
|
83
|
+
du planlegger å lage, tydeligere for både deg selv og dem du eventuelt jobber sammen med i klassen.
|
|
84
|
+
</p>
|
|
85
|
+
</>
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { HTMLAttributes, useMemo } from 'react';
|
|
10
|
+
|
|
11
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {}
|
|
12
|
+
|
|
13
|
+
const FramedContent = ({ className, children, ...rest }: Props) => {
|
|
14
|
+
const classes = useMemo(() => {
|
|
15
|
+
const classes = ['c-bodybox'];
|
|
16
|
+
if (className) {
|
|
17
|
+
classes.push(className);
|
|
18
|
+
}
|
|
19
|
+
return classes.join(' ');
|
|
20
|
+
}, [className]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={classes} {...rest}>
|
|
24
|
+
{children}
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default FramedContent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import FramedContent from './FramedContent';
|
|
10
|
+
export default FramedContent;
|