@ndla/ui 50.9.7 → 50.9.9
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/AudioPlayer/AudioPlayer.js +34 -34
- package/es/Embed/ContentLinkEmbed.js +2 -2
- package/es/Embed/IframeEmbed.js +11 -4
- package/es/Embed/UuDisclaimerEmbed.js +75 -0
- package/es/Embed/index.js +2 -1
- package/es/ExpandableBox/ExpandableBox.js +8 -2
- package/es/Filter/ToggleItem.js +31 -9
- package/es/Filter/index.js +0 -3
- package/es/Logo/Logo.js +44 -20
- package/es/Logo/SvgLogo.js +7 -3
- package/es/Messages/MessageBox.js +6 -6
- package/es/RelatedArticleList/RelatedArticleList.js +8 -8
- package/es/all.css +1 -1
- package/es/index.js +2 -2
- package/es/locale/messages-en.js +3 -0
- package/es/locale/messages-nb.js +3 -0
- package/es/locale/messages-nn.js +3 -0
- package/es/locale/messages-se.js +3 -0
- package/es/locale/messages-sma.js +3 -0
- package/lib/AudioPlayer/AudioPlayer.js +34 -34
- package/lib/Embed/ContentLinkEmbed.js +2 -2
- package/lib/Embed/IframeEmbed.js +12 -4
- package/lib/Embed/UuDisclaimerEmbed.d.ts +15 -0
- package/lib/Embed/UuDisclaimerEmbed.js +78 -0
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/index.js +7 -0
- package/lib/ExpandableBox/ExpandableBox.js +8 -1
- package/lib/Filter/ToggleItem.d.ts +1 -2
- package/lib/Filter/ToggleItem.js +32 -9
- package/lib/Filter/index.d.ts +0 -3
- package/lib/Filter/index.js +0 -21
- package/lib/Logo/Logo.d.ts +0 -2
- package/lib/Logo/Logo.js +45 -22
- package/lib/Logo/SvgLogo.js +8 -3
- package/lib/Messages/MessageBox.d.ts +1 -1
- package/lib/Messages/MessageBox.js +6 -6
- package/lib/RelatedArticleList/RelatedArticleList.js +8 -8
- package/lib/all.css +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +6 -12
- package/lib/locale/messages-en.d.ts +3 -0
- package/lib/locale/messages-en.js +3 -0
- package/lib/locale/messages-nb.d.ts +3 -0
- package/lib/locale/messages-nb.js +3 -0
- package/lib/locale/messages-nn.d.ts +3 -0
- package/lib/locale/messages-nn.js +3 -0
- package/lib/locale/messages-se.d.ts +3 -0
- package/lib/locale/messages-se.js +3 -0
- package/lib/locale/messages-sma.d.ts +3 -0
- package/lib/locale/messages-sma.js +3 -0
- package/package.json +12 -12
- package/src/AudioPlayer/AudioPlayer.tsx +13 -27
- package/src/CampaignBlock/CampaignBlock.stories.tsx +15 -0
- package/src/Embed/BrightcoveEmbed.stories.tsx +1 -1
- package/src/Embed/ContentLinkEmbed.tsx +1 -1
- package/src/Embed/ExternalEmbed.stories.tsx +93 -0
- package/src/Embed/IframeEmbed.tsx +8 -3
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +150 -0
- package/src/Embed/UuDisclaimerEmbed.tsx +62 -0
- package/src/Embed/index.ts +1 -0
- package/src/ExpandableBox/ExpandableBox.stories.tsx +10 -1
- package/src/ExpandableBox/ExpandableBox.tsx +11 -1
- package/src/Figure/component.figure.scss +0 -56
- package/src/Filter/ToggleItem.tsx +131 -9
- package/src/Filter/index.ts +0 -3
- package/src/Logo/Logo.tsx +36 -16
- package/src/Logo/SvgLogo.tsx +8 -9
- package/src/Messages/MessageBox.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/locale/messages-en.ts +3 -0
- package/src/locale/messages-nb.ts +3 -0
- package/src/locale/messages-nn.ts +3 -0
- package/src/locale/messages-se.ts +3 -0
- package/src/locale/messages-sma.ts +3 -0
- package/src/main.scss +0 -2
- package/es/Filter/FilterList.js +0 -100
- package/es/Filter/FilterListPhone.js +0 -224
- package/es/Filter/filterClasses.js +0 -13
- package/lib/Filter/FilterList.d.ts +0 -32
- package/lib/Filter/FilterList.js +0 -105
- package/lib/Filter/FilterListPhone.d.ts +0 -38
- package/lib/Filter/FilterListPhone.js +0 -229
- package/lib/Filter/filterClasses.d.ts +0 -9
- package/lib/Filter/filterClasses.js +0 -20
- package/src/Filter/FilterList.tsx +0 -137
- package/src/Filter/FilterListPhone.tsx +0 -278
- package/src/Filter/component.filter.scss +0 -503
- package/src/Filter/filterClasses.ts +0 -14
- package/src/Logo/component.logo.scss +0 -28
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-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 { ReactNode } from "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import styled from "@emotion/styled";
|
|
12
|
+
import { InformationOutline } from "@ndla/icons/common";
|
|
13
|
+
import SafeLink from "@ndla/safelink";
|
|
14
|
+
import { UuDisclaimerMetaData } from "@ndla/types-embed";
|
|
15
|
+
import { MessageBox } from "../Messages";
|
|
16
|
+
interface Props {
|
|
17
|
+
embed: UuDisclaimerMetaData;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const StyledMessageBox = styled(MessageBox)`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-align: center;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const Disclaimer = styled.div`
|
|
27
|
+
display: flow;
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const UuDisclaimerEmbed = ({ embed, children }: Props) => {
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
|
|
33
|
+
if (embed.status === "error") {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { embedData, data } = embed;
|
|
38
|
+
|
|
39
|
+
const disclaimerLink = data?.disclaimerLink ? (
|
|
40
|
+
<>
|
|
41
|
+
{` ${t("uuDisclaimer.alternative")} `}
|
|
42
|
+
<SafeLink to={data.disclaimerLink.href} target="_blank" rel="noopener noreferrer">
|
|
43
|
+
{data.disclaimerLink.text}
|
|
44
|
+
</SafeLink>
|
|
45
|
+
</>
|
|
46
|
+
) : null;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<StyledMessageBox type="info">
|
|
51
|
+
<InformationOutline />
|
|
52
|
+
<Disclaimer contentEditable={false}>
|
|
53
|
+
{embedData.disclaimer}
|
|
54
|
+
{disclaimerLink}
|
|
55
|
+
</Disclaimer>
|
|
56
|
+
</StyledMessageBox>
|
|
57
|
+
{children}
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default UuDisclaimerEmbed;
|
package/src/Embed/index.ts
CHANGED
|
@@ -20,4 +20,5 @@ export { ConceptNotionV2 } from "./conceptComponents";
|
|
|
20
20
|
export { default as ConceptListEmbed } from "./ConceptListEmbed";
|
|
21
21
|
export { default as UnknownEmbed } from "./UnknownEmbed";
|
|
22
22
|
export { InlineConcept, BlockConcept } from "./ConceptEmbed";
|
|
23
|
+
export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
|
|
23
24
|
export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from "./types";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
9
|
+
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
10
10
|
import { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
|
|
11
11
|
import { defaultParameters } from "../../../../stories/defaults";
|
|
12
12
|
|
|
@@ -32,3 +32,12 @@ export default {
|
|
|
32
32
|
} as Meta<typeof ExpandableBox>;
|
|
33
33
|
|
|
34
34
|
export const Default: StoryObj<typeof ExpandableBox> = {};
|
|
35
|
+
|
|
36
|
+
export const WithHeader: StoryFn<typeof ExpandableBox> = ({ ...args }) => (
|
|
37
|
+
<ExpandableBox {...args}>
|
|
38
|
+
<ExpandableBoxSummary>
|
|
39
|
+
<h2>Open me as header text</h2>
|
|
40
|
+
</ExpandableBoxSummary>
|
|
41
|
+
Everything here is only visible when the box is open
|
|
42
|
+
</ExpandableBox>
|
|
43
|
+
);
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { HTMLAttributes } from "react";
|
|
10
|
+
import styled from "@emotion/styled";
|
|
11
|
+
import { fonts } from "@ndla/core";
|
|
10
12
|
|
|
11
13
|
interface Props extends HTMLAttributes<HTMLDetailsElement> {}
|
|
12
14
|
|
|
@@ -16,6 +18,14 @@ export const ExpandableBox = ({ children, ...rest }: Props) => {
|
|
|
16
18
|
|
|
17
19
|
interface SummaryProps extends HTMLAttributes<HTMLElement> {}
|
|
18
20
|
|
|
21
|
+
const StyledSummary = styled.summary`
|
|
22
|
+
& > * {
|
|
23
|
+
display: inline;
|
|
24
|
+
font-size: ${fonts.size.text.metaText.medium};
|
|
25
|
+
font-weight: ${fonts.weight.normal};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
19
29
|
export const ExpandableBoxSummary = ({ children, ...rest }: SummaryProps) => {
|
|
20
|
-
return <
|
|
30
|
+
return <StyledSummary {...rest}>{children}</StyledSummary>;
|
|
21
31
|
};
|
|
@@ -90,35 +90,8 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
.c-figure__licensetag {
|
|
94
|
-
display: none;
|
|
95
|
-
}
|
|
96
93
|
.c-figure__byline {
|
|
97
94
|
text-align: left;
|
|
98
|
-
|
|
99
|
-
.c-figure__toggleAlternativeVideo {
|
|
100
|
-
margin-left: 10px;
|
|
101
|
-
span.hidden {
|
|
102
|
-
display: none;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.c-figure__byline-author-buttons {
|
|
108
|
-
flex: 1 1 auto;
|
|
109
|
-
display: flex;
|
|
110
|
-
align-items: center;
|
|
111
|
-
justify-content: space-between;
|
|
112
|
-
color: $primary-color;
|
|
113
|
-
}
|
|
114
|
-
.c-figure__byline-author-buttons--no-siblings {
|
|
115
|
-
//styling for button in licensewrapper when there are no other elements in it. Places the button to the right
|
|
116
|
-
justify-content: flex-end;
|
|
117
|
-
}
|
|
118
|
-
.c-figure__byline-authors {
|
|
119
|
-
@include font-size(14px, 20px);
|
|
120
|
-
margin-right: $spacing--small;
|
|
121
|
-
font-family: $font;
|
|
122
95
|
}
|
|
123
96
|
|
|
124
97
|
.c-figure__info {
|
|
@@ -235,40 +208,11 @@
|
|
|
235
208
|
}
|
|
236
209
|
|
|
237
210
|
.c-figure {
|
|
238
|
-
&__link-wrapper {
|
|
239
|
-
margin-top: $spacing--small;
|
|
240
|
-
|
|
241
|
-
[data-icon] {
|
|
242
|
-
margin-left: $spacing--xsmall;
|
|
243
|
-
width: 18px;
|
|
244
|
-
height: 18px;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
211
|
&__link {
|
|
249
212
|
color: $brand-color;
|
|
250
213
|
box-shadow: none;
|
|
251
214
|
display: flex;
|
|
252
215
|
align-items: center;
|
|
253
216
|
@include font-size(14px, 25px);
|
|
254
|
-
|
|
255
|
-
&:hover,
|
|
256
|
-
&:active,
|
|
257
|
-
&:focus {
|
|
258
|
-
.c-figure__link-text {
|
|
259
|
-
box-shadow: $link--hover;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
&__link-text {
|
|
265
|
-
box-shadow: $link;
|
|
266
|
-
display: block;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
&__link-description {
|
|
270
|
-
margin-top: $spacing--xsmall !important;
|
|
271
|
-
margin-bottom: 0;
|
|
272
|
-
@include font-size(14px, 25px);
|
|
273
217
|
}
|
|
274
218
|
}
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ChangeEvent, ElementType } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { css } from "@emotion/react";
|
|
11
|
+
import styled from "@emotion/styled";
|
|
12
|
+
import { breakpoints, colors, fonts, misc, mq, spacing, stackOrder } from "@ndla/core";
|
|
11
13
|
|
|
12
14
|
interface Props {
|
|
13
15
|
id: string;
|
|
@@ -16,16 +18,137 @@ interface Props {
|
|
|
16
18
|
checked?: boolean;
|
|
17
19
|
disabled?: boolean;
|
|
18
20
|
tabIndex?: number;
|
|
19
|
-
modifiers?: string[] | string;
|
|
20
21
|
value?: string;
|
|
21
22
|
component?: ElementType;
|
|
22
23
|
hits?: number;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
const StyledText = styled.span`
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
z-index: ${stackOrder.offsetDouble};
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
const StyledInput = styled.input`
|
|
32
|
+
position: absolute;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
z-index: ${stackOrder.trigger};
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
|
|
37
|
+
&:checked {
|
|
38
|
+
& + label [data-checkbox] {
|
|
39
|
+
border: 2px solid ${colors.brand.primary};
|
|
40
|
+
background: ${colors.brand.primary};
|
|
41
|
+
::before {
|
|
42
|
+
background: white;
|
|
43
|
+
width: 5px;
|
|
44
|
+
}
|
|
45
|
+
::after {
|
|
46
|
+
background: white;
|
|
47
|
+
width: 10px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const StyledItemCheckbox = styled.span`
|
|
54
|
+
content: "";
|
|
55
|
+
display: inline-block;
|
|
56
|
+
position: relative;
|
|
57
|
+
width: ${spacing.normal};
|
|
58
|
+
height: ${spacing.normal};
|
|
59
|
+
padding: 0;
|
|
60
|
+
background: ${colors.white};
|
|
61
|
+
border: 2px solid ${colors.brand.tertiary};
|
|
62
|
+
margin: 2px ${spacing.small} 2px 3px;
|
|
63
|
+
border-radius: 2px;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
66
|
+
width: 20px;
|
|
67
|
+
height: 20px;
|
|
68
|
+
margin: 4px ${spacing.small} 4px 3px;
|
|
69
|
+
}
|
|
70
|
+
&::before {
|
|
71
|
+
content: "";
|
|
72
|
+
width: 0px;
|
|
73
|
+
height: 2px;
|
|
74
|
+
border-radius: 2px;
|
|
75
|
+
background: ${colors.brand.tertiary};
|
|
76
|
+
position: absolute;
|
|
77
|
+
transform: rotate(45deg);
|
|
78
|
+
top: 10px;
|
|
79
|
+
left: 7px;
|
|
80
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
81
|
+
top: 8px;
|
|
82
|
+
left: 5px;
|
|
83
|
+
}
|
|
84
|
+
transition: width 50ms ease 50ms;
|
|
85
|
+
transform-origin: 0% 0%;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&::after {
|
|
89
|
+
content: "";
|
|
90
|
+
width: 0;
|
|
91
|
+
height: 2px;
|
|
92
|
+
border-radius: 2px;
|
|
93
|
+
background: ${colors.brand.tertiary};
|
|
94
|
+
position: absolute;
|
|
95
|
+
transform: rotate(305deg);
|
|
96
|
+
top: 13px;
|
|
97
|
+
left: 8px;
|
|
98
|
+
|
|
99
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
100
|
+
top: 11px;
|
|
101
|
+
left: 6px;
|
|
102
|
+
}
|
|
103
|
+
transition: width 50ms ease;
|
|
104
|
+
transform-origin: 0% 0%;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
const toggleItemCss = css`
|
|
109
|
+
display: inline-block;
|
|
110
|
+
position: relative;
|
|
111
|
+
margin: 0 ${spacing.small} 0 2px;
|
|
112
|
+
color: ${colors.brand.primary};
|
|
113
|
+
border-radius: ${misc.borderRadius};
|
|
114
|
+
transition: all 0.2s cubic-bezier(0.17, 0.04, 0.03, 0.94);
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
${fonts.sizes("16px", "18px")};
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
[data-checkbox] {
|
|
120
|
+
border: 2px solid ${colors.brand.tertiary};
|
|
121
|
+
}
|
|
122
|
+
[data-checkbox]::before {
|
|
123
|
+
width: 5px;
|
|
124
|
+
transition: width 100ms ease;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
[data-checkbox]::after {
|
|
128
|
+
width: 10px;
|
|
129
|
+
transition: width 150ms ease 100ms;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
label {
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
${mq.range({ until: breakpoints.tabletWide })} {
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
139
|
+
${mq.range({ until: breakpoints.mobileWide })} {
|
|
140
|
+
width: 100%;
|
|
141
|
+
padding: $spacing--xsmall 0;
|
|
142
|
+
justify-content: space-between;
|
|
143
|
+
min-height: 52px;
|
|
144
|
+
align-items: center;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
|
|
25
149
|
const ToggleItem = ({
|
|
26
150
|
id,
|
|
27
151
|
checked = false,
|
|
28
|
-
modifiers,
|
|
29
152
|
label,
|
|
30
153
|
component: Component = "li",
|
|
31
154
|
onChange,
|
|
@@ -34,9 +157,8 @@ const ToggleItem = ({
|
|
|
34
157
|
disabled,
|
|
35
158
|
hits,
|
|
36
159
|
}: Props) => (
|
|
37
|
-
<Component {
|
|
38
|
-
<
|
|
39
|
-
{...classes("input")}
|
|
160
|
+
<Component css={toggleItemCss}>
|
|
161
|
+
<StyledInput
|
|
40
162
|
type="checkbox"
|
|
41
163
|
id={id}
|
|
42
164
|
value={value}
|
|
@@ -46,11 +168,11 @@ const ToggleItem = ({
|
|
|
46
168
|
onChange={onChange}
|
|
47
169
|
/>
|
|
48
170
|
<label htmlFor={id}>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
171
|
+
<StyledItemCheckbox data-checkbox="" />
|
|
172
|
+
<StyledText>
|
|
51
173
|
{label}
|
|
52
174
|
{hits !== undefined && ` (${hits})`}
|
|
53
|
-
</
|
|
175
|
+
</StyledText>
|
|
54
176
|
</label>
|
|
55
177
|
</Component>
|
|
56
178
|
);
|
package/src/Filter/index.ts
CHANGED
|
@@ -6,8 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { default as FilterList } from "./FilterList";
|
|
10
|
-
export { default as FilterListPhone } from "./FilterListPhone";
|
|
11
9
|
export { default as ToggleItem } from "./ToggleItem";
|
|
12
|
-
export { classes as filterClasses } from "./filterClasses";
|
|
13
10
|
export { default as FilterButtons } from "./FilterButtons";
|
package/src/Logo/Logo.tsx
CHANGED
|
@@ -5,17 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
/* eslint-disable max-len */
|
|
9
8
|
|
|
10
|
-
import
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { SerializedStyles, css } from "@emotion/react";
|
|
11
|
+
import styled from "@emotion/styled";
|
|
12
|
+
import { colors } from "@ndla/core";
|
|
11
13
|
import SafeLink from "@ndla/safelink";
|
|
12
14
|
import SvgLogo from "./SvgLogo";
|
|
13
15
|
|
|
14
|
-
export const logoClasses = new BEMHelper({
|
|
15
|
-
name: "logo",
|
|
16
|
-
prefix: "c-",
|
|
17
|
-
});
|
|
18
|
-
|
|
19
16
|
interface Props {
|
|
20
17
|
to?:
|
|
21
18
|
| string
|
|
@@ -32,23 +29,46 @@ interface Props {
|
|
|
32
29
|
color?: string;
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (cssModifier) {
|
|
39
|
-
modifiers[cssModifier] = true;
|
|
32
|
+
const StyledLogoWrapper = styled.div`
|
|
33
|
+
a {
|
|
34
|
+
box-shadow: none;
|
|
40
35
|
}
|
|
36
|
+
width: 120px;
|
|
37
|
+
margin: 0;
|
|
38
|
+
position: relative;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const modifierStyles: Record<string, SerializedStyles> = {
|
|
42
|
+
large: css`
|
|
43
|
+
width: 287px;
|
|
44
|
+
`,
|
|
45
|
+
white: css`
|
|
46
|
+
svg {
|
|
47
|
+
fill: ${colors.white};
|
|
48
|
+
}
|
|
49
|
+
`,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Logo = ({ name = true, to, cssModifier, color, large = false, locale, label }: Props) => {
|
|
53
|
+
const modifiers = useMemo(() => {
|
|
54
|
+
const mods = [];
|
|
55
|
+
if (large) {
|
|
56
|
+
mods.push(modifierStyles.large);
|
|
57
|
+
}
|
|
58
|
+
if (cssModifier && modifierStyles[cssModifier]) {
|
|
59
|
+
mods.push(modifierStyles[cssModifier]);
|
|
60
|
+
}
|
|
61
|
+
return mods;
|
|
62
|
+
}, [large, cssModifier]);
|
|
41
63
|
|
|
42
64
|
const logo = to ? (
|
|
43
65
|
<SafeLink to={to} aria-label={label} title={label}>
|
|
44
66
|
<SvgLogo name={name} color={color} locale={locale} />
|
|
45
67
|
</SafeLink>
|
|
46
68
|
) : (
|
|
47
|
-
|
|
48
|
-
<SvgLogo name={name} color={color} locale={locale} />
|
|
49
|
-
</>
|
|
69
|
+
<SvgLogo name={name} color={color} locale={locale} />
|
|
50
70
|
);
|
|
51
|
-
return <
|
|
71
|
+
return <StyledLogoWrapper css={modifiers}>{logo}</StyledLogoWrapper>;
|
|
52
72
|
};
|
|
53
73
|
|
|
54
74
|
export default Logo;
|
package/src/Logo/SvgLogo.tsx
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/* eslint-disable max-len */
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import styled from "@emotion/styled";
|
|
11
|
+
import { colors } from "@ndla/core";
|
|
11
12
|
|
|
12
13
|
const LogoText = (locale?: string) => {
|
|
13
14
|
if (locale === "en") {
|
|
@@ -30,20 +31,18 @@ interface Props {
|
|
|
30
31
|
locale?: string;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
const StyledSvg = styled.svg`
|
|
35
|
+
fill: ${colors.brand.primary};
|
|
36
|
+
`;
|
|
37
|
+
|
|
33
38
|
export const SvgLogo = ({ name = true, color = "#000000", locale }: Props) => (
|
|
34
|
-
<svg
|
|
35
|
-
{...logoClasses("graphic")}
|
|
36
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
-
viewBox="0 0 376 152"
|
|
38
|
-
fill={color}
|
|
39
|
-
fillRule="evenodd"
|
|
40
|
-
>
|
|
39
|
+
<StyledSvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 376 152" fill={color} fillRule="evenodd">
|
|
41
40
|
<path d="M355 67h-84v51h102V51h-18v16zm0 14h-66v19h66V81zm-84-48v18h84V33h-84z" />
|
|
42
41
|
<rect width="18" height="118" x="236" transform="matrix(-1 0 0 1 490 0)" />
|
|
43
42
|
<path d="M201 100V51h-65v49h65zm18 18V0h-18v33h-83v85h101z" />
|
|
44
43
|
<polygon points="18 51 18 118 0 118 0 33 101 33 101 118 83 118 83 51" />
|
|
45
44
|
{name && LogoText(locale)}
|
|
46
|
-
</
|
|
45
|
+
</StyledSvg>
|
|
47
46
|
);
|
|
48
47
|
|
|
49
48
|
export default SvgLogo;
|
|
@@ -13,7 +13,7 @@ import { CloseButton } from "@ndla/button";
|
|
|
13
13
|
import { breakpoints, colors, fonts, mq, spacing } from "@ndla/core";
|
|
14
14
|
import { Forward } from "@ndla/icons/common";
|
|
15
15
|
|
|
16
|
-
type MessageBoxType = "ghost" | "danger";
|
|
16
|
+
type MessageBoxType = "ghost" | "danger" | "info";
|
|
17
17
|
|
|
18
18
|
interface LinkProps {
|
|
19
19
|
href?: string;
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export {
|
|
|
27
27
|
UnknownEmbed,
|
|
28
28
|
InlineConcept,
|
|
29
29
|
BlockConcept,
|
|
30
|
+
UuDisclaimerEmbed,
|
|
30
31
|
} from "./Embed";
|
|
31
32
|
|
|
32
33
|
export { LicenseLink } from "./LicenseByline";
|
|
@@ -79,7 +80,7 @@ export {
|
|
|
79
80
|
HeroContent,
|
|
80
81
|
} from "./Hero";
|
|
81
82
|
|
|
82
|
-
export {
|
|
83
|
+
export { FilterButtons, ToggleItem } from "./Filter";
|
|
83
84
|
|
|
84
85
|
export { Footer, EditorName, FooterText } from "./Footer";
|
|
85
86
|
|
|
@@ -1355,6 +1355,9 @@ const messages = {
|
|
|
1355
1355
|
pinyin: "Pinyin",
|
|
1356
1356
|
},
|
|
1357
1357
|
},
|
|
1358
|
+
uuDisclaimer: {
|
|
1359
|
+
alternative: "You can find alternative content in the article",
|
|
1360
|
+
},
|
|
1358
1361
|
wordClass: {
|
|
1359
1362
|
[wordClass.wordClass.adjective]: "Adjective",
|
|
1360
1363
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1353,6 +1353,9 @@ const messages = {
|
|
|
1353
1353
|
pinyin: "Pinyin",
|
|
1354
1354
|
},
|
|
1355
1355
|
},
|
|
1356
|
+
uuDisclaimer: {
|
|
1357
|
+
alternative: "Du kan finne alternativt innhold i artikkelen",
|
|
1358
|
+
},
|
|
1356
1359
|
wordClass: {
|
|
1357
1360
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1358
1361
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1353,6 +1353,9 @@ const messages = {
|
|
|
1353
1353
|
pinyin: "Pinyin",
|
|
1354
1354
|
},
|
|
1355
1355
|
},
|
|
1356
|
+
uuDisclaimer: {
|
|
1357
|
+
alternative: "Du kan finne alternativt innhald i artikkelen",
|
|
1358
|
+
},
|
|
1356
1359
|
wordClass: {
|
|
1357
1360
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1358
1361
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1355,6 +1355,9 @@ const messages = {
|
|
|
1355
1355
|
pinyin: "Pinyin",
|
|
1356
1356
|
},
|
|
1357
1357
|
},
|
|
1358
|
+
uuDisclaimer: {
|
|
1359
|
+
alternative: "Du kan finne alternativt innhold i artikkelen",
|
|
1360
|
+
},
|
|
1358
1361
|
wordClass: {
|
|
1359
1362
|
[wordClass.wordClass.adjective]: "Adjektiivvat",
|
|
1360
1363
|
[wordClass.wordClass.adverb]: "Advearba",
|
|
@@ -1357,6 +1357,9 @@ const messages = {
|
|
|
1357
1357
|
pinyin: "Pinyin",
|
|
1358
1358
|
},
|
|
1359
1359
|
},
|
|
1360
|
+
uuDisclaimer: {
|
|
1361
|
+
alternative: "Du kan finne alternativt innhold i artikkelen",
|
|
1362
|
+
},
|
|
1360
1363
|
wordClass: {
|
|
1361
1364
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1362
1365
|
[wordClass.wordClass.adverb]: "Adverb",
|