@ndla/ui 36.0.2 → 37.0.0
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/Article/Article.js +7 -13
- package/es/Article/ArticleByline.js +79 -123
- package/es/Article/ArticleFootNotes.js +16 -11
- package/es/AudioPlayer/AudioPlayer.js +33 -35
- package/es/AudioPlayer/initAudioPlayers.js +6 -1
- package/es/Embed/AudioEmbed.js +44 -188
- package/es/Embed/BrightcoveEmbed.js +26 -122
- package/es/Embed/ConceptEmbed.js +53 -75
- package/es/Embed/EmbedErrorPlaceholder.js +41 -0
- package/es/Embed/ExternalEmbed.js +5 -12
- package/es/Embed/H5pEmbed.js +4 -14
- package/es/Embed/IframeEmbed.js +4 -4
- package/es/Embed/ImageEmbed.js +41 -153
- package/es/Embed/conceptComponents.js +62 -228
- package/es/Embed/types.js +1 -0
- package/es/KeyFigure/KeyFigure.js +57 -0
- package/es/{KeyPerformanceIndicator → KeyFigure}/index.js +1 -1
- package/es/LicenseByline/EmbedByline.js +33 -8
- package/es/LicenseByline/LicenseDescription.js +16 -14
- package/es/List/OrderedList.js +48 -0
- package/es/List/UnOrderedList.js +36 -0
- package/es/List/index.js +10 -0
- package/es/Navigation/NavigationBox.js +41 -48
- package/es/Navigation/NavigationHeading.js +18 -29
- package/es/Notion/Notion.js +5 -5
- package/es/Resource/resourceComponents.js +12 -11
- package/es/Typography/Heading.js +38 -0
- package/es/Typography/index.js +9 -0
- package/es/all.css +1 -1
- package/es/index.js +4 -2
- package/es/locale/messages-en.js +6 -2
- package/es/locale/messages-nb.js +6 -2
- package/es/locale/messages-nn.js +6 -2
- package/es/locale/messages-se.js +6 -2
- package/es/locale/messages-sma.js +6 -2
- package/es/model/ContentType.js +7 -1
- package/lib/Article/Article.d.ts +1 -3
- package/lib/Article/Article.js +7 -13
- package/lib/Article/ArticleByline.d.ts +3 -5
- package/lib/Article/ArticleByline.js +83 -126
- package/lib/Article/ArticleFootNotes.js +16 -11
- package/lib/AudioPlayer/AudioPlayer.d.ts +1 -2
- package/lib/AudioPlayer/AudioPlayer.js +33 -36
- package/lib/AudioPlayer/initAudioPlayers.d.ts +1 -0
- package/lib/AudioPlayer/initAudioPlayers.js +9 -3
- package/lib/Embed/AudioEmbed.d.ts +3 -2
- package/lib/Embed/AudioEmbed.js +53 -192
- package/lib/Embed/BrightcoveEmbed.d.ts +3 -1
- package/lib/Embed/BrightcoveEmbed.js +26 -121
- package/lib/Embed/ConceptEmbed.d.ts +7 -2
- package/lib/Embed/ConceptEmbed.js +51 -73
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +17 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +48 -0
- package/lib/Embed/ExternalEmbed.js +5 -11
- package/lib/Embed/H5pEmbed.js +4 -13
- package/lib/Embed/IframeEmbed.d.ts +2 -2
- package/lib/Embed/IframeEmbed.js +4 -4
- package/lib/Embed/ImageEmbed.d.ts +3 -10
- package/lib/Embed/ImageEmbed.js +48 -161
- package/lib/Embed/conceptComponents.d.ts +4 -2
- package/lib/Embed/conceptComponents.js +67 -231
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/types.d.ts +14 -0
- package/lib/Embed/types.js +5 -0
- package/lib/KeyFigure/KeyFigure.d.ts +10 -0
- package/lib/KeyFigure/KeyFigure.js +62 -0
- package/lib/KeyFigure/index.d.ts +1 -0
- package/lib/KeyFigure/index.js +13 -0
- package/lib/LicenseByline/EmbedByline.d.ts +10 -2
- package/lib/LicenseByline/EmbedByline.js +32 -7
- package/lib/LicenseByline/LicenseDescription.d.ts +3 -1
- package/lib/LicenseByline/LicenseDescription.js +14 -13
- package/lib/List/OrderedList.d.ts +15 -0
- package/lib/List/OrderedList.js +56 -0
- package/lib/List/UnOrderedList.d.ts +10 -0
- package/lib/List/UnOrderedList.js +43 -0
- package/lib/List/index.d.ts +9 -0
- package/lib/List/index.js +20 -0
- package/lib/Navigation/NavigationBox.js +40 -47
- package/lib/Navigation/NavigationHeading.js +17 -28
- package/lib/Notion/Notion.js +5 -5
- package/lib/Resource/resourceComponents.js +12 -11
- package/lib/Typography/Heading.d.ts +26 -0
- package/lib/Typography/Heading.js +45 -0
- package/lib/Typography/index.d.ts +8 -0
- package/lib/Typography/index.js +13 -0
- package/lib/all.css +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +23 -3
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +6 -2
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +6 -2
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +6 -2
- package/lib/locale/messages-se.d.ts +4 -0
- package/lib/locale/messages-se.js +6 -2
- package/lib/locale/messages-sma.d.ts +4 -0
- package/lib/locale/messages-sma.js +6 -2
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +9 -2
- package/package.json +15 -15
- package/src/Article/Article.tsx +1 -8
- package/src/Article/ArticleByline.tsx +78 -127
- package/src/Article/ArticleFootNotes.tsx +33 -10
- package/src/Article/component.article.scss +1 -52
- package/src/Article/component.footnotes.scss +2 -2
- package/src/Aside/component.aside.scss +3 -3
- package/src/AudioPlayer/AudioPlayer.tsx +11 -24
- package/src/AudioPlayer/initAudioPlayers.tsx +7 -2
- package/src/Dialog/component.dialog.scss +4 -5
- package/src/Embed/AudioEmbed.stories.tsx +5 -3
- package/src/Embed/AudioEmbed.tsx +45 -192
- package/src/Embed/BrightcoveEmbed.stories.tsx +5 -1
- package/src/Embed/BrightcoveEmbed.tsx +19 -94
- package/src/Embed/ConceptEmbed.stories.tsx +5 -0
- package/src/Embed/ConceptEmbed.tsx +43 -54
- package/src/Embed/EmbedErrorPlaceholder.tsx +59 -0
- package/src/Embed/ExternalEmbed.stories.tsx +86 -0
- package/src/Embed/ExternalEmbed.tsx +3 -8
- package/src/Embed/H5pEmbed.stories.tsx +92 -0
- package/src/Embed/H5pEmbed.tsx +2 -10
- package/src/Embed/IframeEmbed.stories.tsx +130 -0
- package/src/Embed/IframeEmbed.tsx +3 -3
- package/src/Embed/ImageEmbed.stories.tsx +3 -1
- package/src/Embed/ImageEmbed.tsx +21 -116
- package/src/Embed/conceptComponents.tsx +67 -257
- package/src/Embed/index.ts +1 -0
- package/src/Embed/types.ts +12 -0
- package/src/FactBox/component.factbox.scss +3 -3
- package/src/Figure/component.figure-license.scss +4 -4
- package/src/Figure/component.figure.scss +1 -1
- package/src/KeyFigure/KeyFigure.stories.tsx +36 -0
- package/src/{KeyPerformanceIndicator/KeyPerformanceIndicator.tsx → KeyFigure/KeyFigure.tsx} +9 -7
- package/src/{KeyPerformanceIndicator → KeyFigure}/index.ts +1 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +1 -0
- package/src/LicenseByline/EmbedByline.tsx +57 -9
- package/src/LicenseByline/LicenseDescription.tsx +9 -3
- package/src/List/OrderedList.tsx +115 -0
- package/src/List/UnOrderedList.tsx +49 -0
- package/src/List/index.ts +10 -0
- package/src/MediaList/component.medialist.scss +2 -2
- package/src/Navigation/NavigationBox.tsx +10 -14
- package/src/Navigation/NavigationHeading.tsx +15 -24
- package/src/Notion/Notion.tsx +1 -1
- package/src/RelatedArticleList/component.related-articles.scss +3 -13
- package/src/Resource/resourceComponents.tsx +4 -2
- package/src/Table/component.tables.scss +0 -46
- package/src/Translation/component.translation.scss +3 -5
- package/src/Typography/Heading.tsx +96 -0
- package/src/Typography/index.ts +9 -0
- package/src/index.ts +5 -1
- package/src/locale/messages-en.ts +4 -0
- package/src/locale/messages-nb.ts +4 -0
- package/src/locale/messages-nn.ts +4 -0
- package/src/locale/messages-se.ts +4 -0
- package/src/locale/messages-sma.ts +4 -0
- package/src/model/ContentType.ts +7 -0
- package/es/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -57
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.d.ts +0 -8
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -62
- package/lib/KeyPerformanceIndicator/index.d.ts +0 -1
- package/lib/KeyPerformanceIndicator/index.js +0 -13
- package/src/KeyPerformanceIndicator/KeyPerformanceIndicator.stories.tsx +0 -79
|
@@ -0,0 +1,36 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
import KeyFigure from './KeyFigure';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Enkle komponenter/Nøkkeltall',
|
|
16
|
+
component: KeyFigure,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
parameters: {
|
|
19
|
+
...defaultParameters,
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
title: '500',
|
|
24
|
+
subtitle: 'TVERRFAGLIGE RESSURSER',
|
|
25
|
+
image: {
|
|
26
|
+
alt: 'Nøkkeltall tverrfaglig',
|
|
27
|
+
src: 'https://api.test.ndla.no/image-api/raw/wMowCjRg.svg',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
} as Meta<typeof KeyFigure>;
|
|
31
|
+
|
|
32
|
+
export const KeyFigureStory: StoryFn<typeof KeyFigure> = ({ ...args }) => {
|
|
33
|
+
return <KeyFigure {...args} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
KeyFigureStory.storyName = 'Nøkkeltall';
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
11
|
-
import { IImageMetaInformationV3 } from '@ndla/types-backend/build/image-api';
|
|
12
11
|
|
|
13
12
|
const ContentWrapper = styled.div`
|
|
14
13
|
display: flex;
|
|
@@ -48,19 +47,22 @@ const SubTitleWrapper = styled.div`
|
|
|
48
47
|
`;
|
|
49
48
|
|
|
50
49
|
interface Props {
|
|
51
|
-
image?:
|
|
50
|
+
image?: {
|
|
51
|
+
src?: string;
|
|
52
|
+
alt?: string;
|
|
53
|
+
};
|
|
52
54
|
title: string;
|
|
53
|
-
|
|
55
|
+
subtitle: string;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
const
|
|
58
|
+
const KeyFigure = ({ image, title, subtitle }: Props) => {
|
|
57
59
|
return (
|
|
58
60
|
<ContentWrapper>
|
|
59
|
-
<StyledImage src={image?.
|
|
61
|
+
<StyledImage src={image?.src} alt={image?.alt} />
|
|
60
62
|
<TitleWrapper>{title}</TitleWrapper>
|
|
61
|
-
<SubTitleWrapper>{
|
|
63
|
+
<SubTitleWrapper>{subtitle}</SubTitleWrapper>
|
|
62
64
|
</ContentWrapper>
|
|
63
65
|
);
|
|
64
66
|
};
|
|
65
67
|
|
|
66
|
-
export default
|
|
68
|
+
export default KeyFigure;
|
|
@@ -9,20 +9,29 @@
|
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
|
-
import { breakpoints, colors, misc, mq, spacing } from '@ndla/core';
|
|
12
|
+
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
13
13
|
import { getLicenseByAbbreviation, getLicenseCredits } from '@ndla/licenses';
|
|
14
14
|
import { ICopyright as ImageCopyright } from '@ndla/types-backend/image-api';
|
|
15
15
|
import { ICopyright as AudioCopyright } from '@ndla/types-backend/audio-api';
|
|
16
16
|
import { ICopyright as ConceptCopyright } from '@ndla/types-backend/concept-api';
|
|
17
17
|
import { BrightcoveCopyright } from '@ndla/types-embed';
|
|
18
|
+
import { WarningOutline } from '@ndla/icons/common';
|
|
18
19
|
import LicenseLink from './LicenseLink';
|
|
19
20
|
import LicenseDescription from './LicenseDescription';
|
|
20
21
|
|
|
21
22
|
interface BaseProps {
|
|
22
23
|
topRounded?: boolean;
|
|
24
|
+
bottomRounded?: boolean;
|
|
23
25
|
description?: string;
|
|
24
26
|
children?: ReactNode;
|
|
25
27
|
visibleAlt?: string;
|
|
28
|
+
error?: true | false;
|
|
29
|
+
first?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface EmbedBylineErrorProps extends BaseProps {
|
|
33
|
+
type: EmbedBylineTypeProps['type'] | 'h5p' | 'external';
|
|
34
|
+
error: true;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
interface ImageProps extends BaseProps {
|
|
@@ -50,7 +59,9 @@ interface ConceptProps extends BaseProps {
|
|
|
50
59
|
copyright: ConceptCopyright;
|
|
51
60
|
}
|
|
52
61
|
|
|
53
|
-
type
|
|
62
|
+
export type EmbedBylineTypeProps = ImageProps | BrightcoveProps | AudioProps | PodcastProps | ConceptProps;
|
|
63
|
+
|
|
64
|
+
type Props = EmbedBylineTypeProps | EmbedBylineErrorProps;
|
|
54
65
|
|
|
55
66
|
export type LicenseType = ReturnType<typeof getLicenseByAbbreviation>;
|
|
56
67
|
|
|
@@ -58,14 +69,29 @@ const BylineWrapper = styled.div`
|
|
|
58
69
|
display: flex;
|
|
59
70
|
flex-direction: column;
|
|
60
71
|
gap: ${spacing.small};
|
|
72
|
+
font-family: ${fonts.sans};
|
|
73
|
+
${fonts.sizes('18px', '24px')};
|
|
61
74
|
background-color: ${colors.brand.lightest};
|
|
62
|
-
padding: ${spacing.
|
|
75
|
+
padding: ${spacing.nsmall} ${spacing.normal};
|
|
63
76
|
border: 1px solid ${colors.brand.tertiary};
|
|
64
|
-
border-
|
|
65
|
-
border-bottom-left-radius: ${misc.borderRadius};
|
|
77
|
+
border-top: none;
|
|
66
78
|
|
|
67
79
|
&[data-top-rounded='true'] {
|
|
68
|
-
border-radius: ${misc.borderRadius};
|
|
80
|
+
border-top-right-radius: ${misc.borderRadius};
|
|
81
|
+
border-top-left-radius: ${misc.borderRadius};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&[data-bottom-rounded='true'] {
|
|
85
|
+
border-bottom-right-radius: ${misc.borderRadius};
|
|
86
|
+
border-bottom-left-radius: ${misc.borderRadius};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-error='true'] {
|
|
90
|
+
border: none;
|
|
91
|
+
background-color: ${colors.support.redLightest};
|
|
92
|
+
}
|
|
93
|
+
&[data-first='true'] {
|
|
94
|
+
border-top: 1px solid ${colors.brand.tertiary};
|
|
69
95
|
}
|
|
70
96
|
`;
|
|
71
97
|
|
|
@@ -90,15 +116,37 @@ const LicenseInformationWrapper = styled.div`
|
|
|
90
116
|
flex: 1;
|
|
91
117
|
`;
|
|
92
118
|
|
|
93
|
-
const EmbedByline = ({
|
|
119
|
+
const EmbedByline = ({
|
|
120
|
+
type,
|
|
121
|
+
topRounded,
|
|
122
|
+
bottomRounded,
|
|
123
|
+
description,
|
|
124
|
+
children,
|
|
125
|
+
visibleAlt,
|
|
126
|
+
first = true,
|
|
127
|
+
...props
|
|
128
|
+
}: Props) => {
|
|
94
129
|
const { t, i18n } = useTranslation();
|
|
130
|
+
const strippedDescription = description?.trim();
|
|
131
|
+
|
|
132
|
+
if (props.error) {
|
|
133
|
+
const typeString = type === 'h5p' ? 'H5P' : t(`embed.type.${type}`).toLowerCase();
|
|
134
|
+
return (
|
|
135
|
+
<BylineWrapper data-top-rounded={topRounded} data-bottom-rounded={bottomRounded} data-error={true}>
|
|
136
|
+
<LicenseDescription description={t('embed.embedError', { type: typeString })} icon={<WarningOutline />} />
|
|
137
|
+
</BylineWrapper>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const { copyright } = props;
|
|
142
|
+
|
|
95
143
|
const license = getLicenseByAbbreviation(copyright.license?.license ?? '', i18n.language);
|
|
96
144
|
const authors = getLicenseCredits(copyright);
|
|
97
145
|
const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];
|
|
98
146
|
|
|
99
147
|
return (
|
|
100
|
-
<BylineWrapper data-top-rounded={topRounded}>
|
|
101
|
-
{!!description && <LicenseDescription description={description} />}
|
|
148
|
+
<BylineWrapper data-top-rounded={topRounded} data-bottom-rounded={bottomRounded} data-first={first}>
|
|
149
|
+
{!!strippedDescription?.length && description && <LicenseDescription description={description} />}
|
|
102
150
|
{visibleAlt ? <StyledSpan>{`Alt: ${visibleAlt}`}</StyledSpan> : null}
|
|
103
151
|
<RightsWrapper>
|
|
104
152
|
<LicenseLink license={license} asLink={!!license.url.length} />
|
|
@@ -8,27 +8,33 @@
|
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { colors, spacing } from '@ndla/core';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
13
14
|
description: string;
|
|
15
|
+
icon?: ReactNode;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const StyledParagraph = styled.p`
|
|
17
19
|
margin: 0;
|
|
18
|
-
padding-bottom: ${spacing.xsmall};
|
|
19
|
-
border-bottom: 1px solid ${colors.brand.tertiary};
|
|
20
20
|
`;
|
|
21
21
|
|
|
22
22
|
const StyledFigCaption = styled.figcaption`
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: ${spacing.small};
|
|
25
|
+
align-items: center;
|
|
23
26
|
background: unset;
|
|
24
27
|
padding: unset;
|
|
25
28
|
font-size: unset;
|
|
26
29
|
color: unset;
|
|
30
|
+
padding-bottom: ${spacing.xsmall};
|
|
31
|
+
border-bottom: inherit;
|
|
27
32
|
`;
|
|
28
33
|
|
|
29
|
-
const LicenseDescription = ({ description }: Props) => {
|
|
34
|
+
const LicenseDescription = ({ description, icon }: Props) => {
|
|
30
35
|
return (
|
|
31
36
|
<StyledFigCaption>
|
|
37
|
+
{icon}
|
|
32
38
|
<StyledParagraph>{description}</StyledParagraph>
|
|
33
39
|
</StyledFigCaption>
|
|
34
40
|
);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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 { fonts, spacing, spacingUnit } from '@ndla/core';
|
|
11
|
+
import { forwardRef, HTMLAttributes } from 'react';
|
|
12
|
+
|
|
13
|
+
export const generateListResets = () => {
|
|
14
|
+
let styles = '';
|
|
15
|
+
for (let $i = 0; $i < 50; $i++) {
|
|
16
|
+
styles += `
|
|
17
|
+
ol.ol-reset-${$i} { counter-reset: item ${$i - 1} }
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return styles;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const listSpacing = {
|
|
25
|
+
xlarge: `${spacingUnit * 2.5}px`,
|
|
26
|
+
xxlarge: `${spacingUnit * 3}px`,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const StyledOl = styled.ol`
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
margin-left: 0;
|
|
32
|
+
${fonts.sizes('18px', '29px')};
|
|
33
|
+
list-style-type: none;
|
|
34
|
+
|
|
35
|
+
// Child ordered lists
|
|
36
|
+
ol {
|
|
37
|
+
padding-left: ${spacing.normal};
|
|
38
|
+
}
|
|
39
|
+
// List item
|
|
40
|
+
li {
|
|
41
|
+
margin-top: ${spacing.normal};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-type='letters'] {
|
|
45
|
+
counter-reset: item 0;
|
|
46
|
+
> li {
|
|
47
|
+
counter-increment: item;
|
|
48
|
+
&:before {
|
|
49
|
+
position: absolute;
|
|
50
|
+
transform: translateX(-100%);
|
|
51
|
+
content: counter(item, upper-alpha) '.';
|
|
52
|
+
padding-right: 0.25em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
> ol[data-type='letters'] {
|
|
56
|
+
> li:before {
|
|
57
|
+
content: counter(item, lower-alpha) '.';
|
|
58
|
+
}
|
|
59
|
+
ol[data-type='letters'] {
|
|
60
|
+
padding-left: ${spacing.normal};
|
|
61
|
+
> li:before {
|
|
62
|
+
content: counter(item, lower-roman) '.';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:not([data-type='letters']) {
|
|
70
|
+
counter-reset: item 0;
|
|
71
|
+
> li {
|
|
72
|
+
counter-increment: item;
|
|
73
|
+
&:before {
|
|
74
|
+
position: absolute;
|
|
75
|
+
transform: translateX(-100%);
|
|
76
|
+
padding-right: 0.25em;
|
|
77
|
+
content: counters(item, '.') '.';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
> ol:not([data-type='letters']) {
|
|
81
|
+
padding-left: ${spacing.medium};
|
|
82
|
+
> li {
|
|
83
|
+
> ol:not([data-type='letters']) {
|
|
84
|
+
padding-left: ${spacing.large};
|
|
85
|
+
> li {
|
|
86
|
+
> ol:not([data-type='letters']) {
|
|
87
|
+
padding-left: ${listSpacing.xlarge};
|
|
88
|
+
ol:not([data-type='letters']) {
|
|
89
|
+
padding-left: ${listSpacing.xxlarge};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// List reset classes
|
|
99
|
+
${generateListResets()}
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
interface Props extends HTMLAttributes<HTMLOListElement> {
|
|
103
|
+
type?: 'letters';
|
|
104
|
+
start?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const OrderedList = forwardRef<HTMLOListElement, Props>(({ type, children, ...rest }, ref) => {
|
|
108
|
+
return (
|
|
109
|
+
<StyledOl data-type={type} ref={ref} {...rest}>
|
|
110
|
+
{children}
|
|
111
|
+
</StyledOl>
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export default OrderedList;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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 { colors, fonts, spacing } from '@ndla/core';
|
|
11
|
+
import { forwardRef, HTMLAttributes } from 'react';
|
|
12
|
+
import { generateListResets } from './OrderedList';
|
|
13
|
+
|
|
14
|
+
const StyledUl = styled.ul`
|
|
15
|
+
> li {
|
|
16
|
+
::marker {
|
|
17
|
+
color: ${colors.brand.secondary};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
ul {
|
|
21
|
+
list-style-image: none;
|
|
22
|
+
padding-left: ${spacing.mediumlarge};
|
|
23
|
+
}
|
|
24
|
+
margin-top: 0;
|
|
25
|
+
margin-left: 0;
|
|
26
|
+
${fonts.sizes('18px', '29px')};
|
|
27
|
+
|
|
28
|
+
// List item
|
|
29
|
+
li {
|
|
30
|
+
margin-top: ${spacing.normal};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Child unordered lists
|
|
34
|
+
ul {
|
|
35
|
+
padding-left: ${spacing.nsmall};
|
|
36
|
+
}
|
|
37
|
+
// List reset classes
|
|
38
|
+
${generateListResets()}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const UnOrderedList = forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(({ children, ...rest }, ref) => {
|
|
42
|
+
return (
|
|
43
|
+
<StyledUl ref={ref} {...rest}>
|
|
44
|
+
{children}
|
|
45
|
+
</StyledUl>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default UnOrderedList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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
|
+
export { default as OrderedList } from './OrderedList';
|
|
10
|
+
export { default as UnOrderedList } from './UnOrderedList';
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.c-medialist__body {
|
|
31
|
-
@include
|
|
31
|
+
@include font-size(14px, 24px);
|
|
32
32
|
@include mq(tablet) {
|
|
33
33
|
max-width: 70% !important;
|
|
34
34
|
}
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
.c-medialist__title {
|
|
144
144
|
margin-top: 0;
|
|
145
145
|
margin-bottom: $spacing--small/2;
|
|
146
|
-
@include
|
|
146
|
+
@include font-size(16px, 1.5);
|
|
147
147
|
color: $brand-color;
|
|
148
148
|
+ p {
|
|
149
149
|
margin-top: 0;
|
|
@@ -8,6 +8,7 @@ import { Switch } from '@ndla/switch';
|
|
|
8
8
|
import { uuid } from '@ndla/util';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import { HumanMaleBoard } from '@ndla/icons/common';
|
|
11
|
+
import { Heading } from '../Typography';
|
|
11
12
|
|
|
12
13
|
const StyledWrapper = styled.nav`
|
|
13
14
|
margin: 20px 0 34px;
|
|
@@ -18,19 +19,10 @@ const StyledHeadingWrapper = styled.div`
|
|
|
18
19
|
align-items: baseline;
|
|
19
20
|
`;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const StyledHeading = styled.h2<InvertItProps>`
|
|
26
|
-
${fonts.sizes('18px', '32px')};
|
|
27
|
-
text-transform: uppercase;
|
|
28
|
-
margin: 0 0 10px;
|
|
29
|
-
${(props) =>
|
|
30
|
-
props.invertedStyle &&
|
|
31
|
-
css`
|
|
32
|
-
color: #fff;
|
|
33
|
-
`}
|
|
22
|
+
const StyledHeading = styled(Heading)`
|
|
23
|
+
&[data-inverted='true'] {
|
|
24
|
+
color: ${colors.white};
|
|
25
|
+
}
|
|
34
26
|
`;
|
|
35
27
|
|
|
36
28
|
type listProps = {
|
|
@@ -216,7 +208,11 @@ export const NavigationBox = ({
|
|
|
216
208
|
return (
|
|
217
209
|
<StyledWrapper>
|
|
218
210
|
<StyledHeadingWrapper>
|
|
219
|
-
{heading &&
|
|
211
|
+
{heading && (
|
|
212
|
+
<StyledHeading element="h2" margin="small" headingStyle="list-title" data-inverted={invertedStyle}>
|
|
213
|
+
{heading}
|
|
214
|
+
</StyledHeading>
|
|
215
|
+
)}
|
|
220
216
|
{hasAdditionalResources && (
|
|
221
217
|
<Switch
|
|
222
218
|
id={uuid()}
|
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { breakpoints, colors, fonts, mq } from '@ndla/core';
|
|
4
|
+
import { Heading } from '../Typography';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const StyledH1 = styled.h1<InvertItProps>`
|
|
11
|
-
${fonts.sizes('24px', '28px')};
|
|
12
|
-
margin: 30px 0 20px 0;
|
|
13
|
-
font-weight: ${fonts.weight.bold};
|
|
14
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
15
|
-
margin: 40px 0 22px;
|
|
16
|
-
${fonts.sizes('40px', '48px')};
|
|
17
|
-
}
|
|
18
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
19
|
-
margin: 50px 0 24px;
|
|
20
|
-
${fonts.sizes('52px', '65px')};
|
|
6
|
+
const StyledHeading = styled(Heading)`
|
|
7
|
+
&[data-inverted='true'] {
|
|
8
|
+
color: ${colors.white};
|
|
21
9
|
}
|
|
22
|
-
${(props) =>
|
|
23
|
-
props.invertedStyle &&
|
|
24
|
-
css`
|
|
25
|
-
color: #fff;
|
|
26
|
-
`}
|
|
27
10
|
`;
|
|
28
11
|
const StyledMainText = styled.span`
|
|
29
12
|
display: block;
|
|
@@ -49,10 +32,18 @@ type Props = {
|
|
|
49
32
|
};
|
|
50
33
|
|
|
51
34
|
export const NavigationHeading = ({ subHeading, children, invertedStyle, headingId }: Props) => (
|
|
52
|
-
<
|
|
35
|
+
<StyledHeading
|
|
36
|
+
element="h1"
|
|
37
|
+
margin="xlarge"
|
|
38
|
+
headingStyle="h1"
|
|
39
|
+
serif
|
|
40
|
+
data-inverted={invertedStyle}
|
|
41
|
+
id={headingId}
|
|
42
|
+
tabIndex={-1}
|
|
43
|
+
>
|
|
53
44
|
{subHeading && <StyledSubText>{subHeading}</StyledSubText>}
|
|
54
45
|
<StyledMainText>{children}</StyledMainText>
|
|
55
|
-
</
|
|
46
|
+
</StyledHeading>
|
|
56
47
|
);
|
|
57
48
|
|
|
58
49
|
export default NavigationHeading;
|
package/src/Notion/Notion.tsx
CHANGED
|
@@ -83,7 +83,7 @@ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, chi
|
|
|
83
83
|
{imageElement}
|
|
84
84
|
{visualElement}
|
|
85
85
|
<TextWrapper hasVisualElement={!!(imageElement || visualElement)}>
|
|
86
|
-
{parseMarkdown(`**${title}** \u2013 ${text}`, 'body')}
|
|
86
|
+
{parseMarkdown(`**${title.trim()}** \u2013 ${text}`, 'body')}
|
|
87
87
|
{!!labels.length && (
|
|
88
88
|
<LabelsContainer>
|
|
89
89
|
{t('searchPage.resultType.notionLabels')}
|
|
@@ -77,15 +77,11 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
&__title {
|
|
80
|
-
@include font-size(18px);
|
|
80
|
+
@include font-size(18px, 1.33);
|
|
81
81
|
margin: 0 0 $spacing--small 0;
|
|
82
82
|
font-weight: $font-weight-semibold;
|
|
83
83
|
display: flex;
|
|
84
84
|
|
|
85
|
-
@include chinese() {
|
|
86
|
-
@include font-size(20px);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
85
|
.c-content-type-badge {
|
|
90
86
|
flex-shrink: 0;
|
|
91
87
|
margin-top: 1px;
|
|
@@ -93,16 +89,10 @@
|
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
&__description {
|
|
96
|
-
@include font-size(16px);
|
|
97
|
-
|
|
98
|
-
@include chinese() {
|
|
99
|
-
@include font-size(18px);
|
|
100
|
-
}
|
|
92
|
+
@include font-size(16px, 1.5);
|
|
101
93
|
|
|
102
94
|
span {
|
|
103
|
-
@include
|
|
104
|
-
@include font-size(18px);
|
|
105
|
-
}
|
|
95
|
+
@include font-size(16px, 1.5);
|
|
106
96
|
}
|
|
107
97
|
|
|
108
98
|
margin: 0;
|
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { colors, fonts, spacing } from '@ndla/core';
|
|
11
|
-
import React, {
|
|
11
|
+
import React, { ReactNode } from 'react';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { MenuButton } from '@ndla/button';
|
|
14
14
|
import SafeLink from '@ndla/safelink';
|
|
15
15
|
import { useNavigate } from 'react-router-dom';
|
|
16
16
|
import { HashTag } from '@ndla/icons/common';
|
|
17
17
|
import resourceTypeColor from '../utils/resourceTypeColor';
|
|
18
|
+
import { resourceTypeMapping } from '../model/ContentType';
|
|
19
|
+
|
|
18
20
|
export interface ResourceImageProps {
|
|
19
21
|
alt: string;
|
|
20
22
|
src: string;
|
|
@@ -196,7 +198,7 @@ export const ResourceTypeList = ({ resourceTypes }: ResourceTypeListProps) => {
|
|
|
196
198
|
<StyledResourceTypeList aria-label={t('navigation.topics')}>
|
|
197
199
|
{resourceTypes.map((resource, i) => (
|
|
198
200
|
<StyledResourceListElement key={resource.id}>
|
|
199
|
-
{resource.name}
|
|
201
|
+
{resourceTypeMapping[resource.id] ? t(`embed.type.${resourceTypeMapping[resource.id]}`) : resource.name}
|
|
200
202
|
{i !== resourceTypes.length - 1 && <StyledTopicDivider aria-hidden="true">•</StyledTopicDivider>}
|
|
201
203
|
</StyledResourceListElement>
|
|
202
204
|
))}
|