@ndla/ui 50.15.2 → 51.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/Embed/ImageEmbed.js +7 -5
- package/es/Embed/index.js +1 -1
- package/es/Footer/FooterBlock.js +17 -0
- package/es/Footer/index.js +1 -4
- package/es/Subject/index.js +0 -1
- package/es/all.css +1 -1
- package/es/index.js +3 -3
- package/es/locale/messages-en.js +3 -1
- package/es/locale/messages-nb.js +3 -1
- package/es/locale/messages-nn.js +3 -1
- package/es/locale/messages-se.js +3 -1
- package/es/locale/messages-sma.js +3 -1
- package/lib/Embed/ImageEmbed.d.ts +3 -1
- package/lib/Embed/ImageEmbed.js +7 -5
- package/lib/Embed/index.d.ts +1 -1
- package/lib/Embed/index.js +15 -3
- package/lib/Footer/FooterBlock.d.ts +13 -0
- package/lib/Footer/FooterBlock.js +24 -0
- package/lib/Footer/index.d.ts +1 -4
- package/lib/Footer/index.js +3 -18
- package/lib/Subject/index.d.ts +0 -1
- package/lib/Subject/index.js +0 -7
- package/lib/all.css +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +14 -20
- package/lib/locale/messages-en.d.ts +2 -0
- package/lib/locale/messages-en.js +3 -1
- package/lib/locale/messages-nb.d.ts +2 -0
- package/lib/locale/messages-nb.js +3 -1
- package/lib/locale/messages-nn.d.ts +2 -0
- package/lib/locale/messages-nn.js +3 -1
- package/lib/locale/messages-se.d.ts +2 -0
- package/lib/locale/messages-se.js +3 -1
- package/lib/locale/messages-sma.d.ts +2 -0
- package/lib/locale/messages-sma.js +3 -1
- package/package.json +19 -19
- package/src/Embed/ImageEmbed.tsx +5 -1
- package/src/Embed/index.ts +1 -1
- package/src/Footer/Footer.stories.tsx +7 -105
- package/src/Footer/FooterBlock.tsx +30 -0
- package/src/Footer/index.ts +1 -5
- package/src/Subject/index.ts +0 -1
- package/src/index.ts +4 -2
- package/src/locale/messages-en.ts +2 -0
- package/src/locale/messages-nb.ts +2 -0
- package/src/locale/messages-nn.ts +2 -0
- package/src/locale/messages-se.ts +2 -0
- package/src/locale/messages-sma.ts +2 -0
- package/es/Footer/EditorName.js +0 -20
- package/es/Footer/Footer.js +0 -83
- package/es/Footer/FooterLinks.js +0 -108
- package/es/Footer/FooterText.js +0 -25
- package/es/Subject/SubjectHeader.js +0 -66
- package/lib/Footer/EditorName.d.ts +0 -13
- package/lib/Footer/EditorName.js +0 -27
- package/lib/Footer/Footer.d.ts +0 -30
- package/lib/Footer/Footer.js +0 -88
- package/lib/Footer/FooterLinks.d.ts +0 -26
- package/lib/Footer/FooterLinks.js +0 -115
- package/lib/Footer/FooterText.d.ts +0 -13
- package/lib/Footer/FooterText.js +0 -33
- package/lib/Subject/SubjectHeader.d.ts +0 -17
- package/lib/Subject/SubjectHeader.js +0 -73
- package/src/Footer/EditorName.tsx +0 -19
- package/src/Footer/Footer.tsx +0 -107
- package/src/Footer/FooterLinks.tsx +0 -144
- package/src/Footer/FooterText.tsx +0 -35
- package/src/Subject/SubjectHeader.tsx +0 -100
package/src/Footer/Footer.tsx
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-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 { colors, spacing, stackOrder } from "@ndla/core";
|
|
13
|
-
import { Heading } from "@ndla/typography";
|
|
14
|
-
import FooterLinks from "./FooterLinks";
|
|
15
|
-
import { OneColumn } from "../Layout";
|
|
16
|
-
import { Locale } from "../types";
|
|
17
|
-
|
|
18
|
-
type Props = {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
lang: Locale;
|
|
21
|
-
commonLinks?: {
|
|
22
|
-
to: string;
|
|
23
|
-
text: string;
|
|
24
|
-
external: boolean;
|
|
25
|
-
}[];
|
|
26
|
-
links?: {
|
|
27
|
-
to: string;
|
|
28
|
-
text: string;
|
|
29
|
-
icon: ReactNode;
|
|
30
|
-
}[];
|
|
31
|
-
privacyLinks?: {
|
|
32
|
-
url: string;
|
|
33
|
-
label: string;
|
|
34
|
-
}[];
|
|
35
|
-
auth?: ReactNode;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const StyledColumns = styled.div`
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
align-items: center;
|
|
42
|
-
gap: ${spacing.normal};
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
const StyledHeading = styled(Heading)`
|
|
46
|
-
text-align: center;
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
const StyledDiv = styled.div`
|
|
50
|
-
color: ${colors.white};
|
|
51
|
-
position: relative;
|
|
52
|
-
background: ${colors.brand.dark};
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
z-index: ${stackOrder.base};
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
const StyledOneColumn = styled(OneColumn)`
|
|
58
|
-
z-index: ${stackOrder.offsetSingle};
|
|
59
|
-
position: relative;
|
|
60
|
-
padding: ${spacing.large} ${spacing.large} ${spacing.xlarge};
|
|
61
|
-
max-width: 1196px;
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
const StyledBackground = styled.div`
|
|
65
|
-
display: block;
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 0;
|
|
68
|
-
bottom: 0;
|
|
69
|
-
left: 0;
|
|
70
|
-
right: 0;
|
|
71
|
-
background: ${colors.brand.dark};
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
const Footer = ({ children, commonLinks, links, auth, privacyLinks }: Props) => {
|
|
75
|
-
const { t } = useTranslation();
|
|
76
|
-
|
|
77
|
-
const mainContent = <>{children}</>;
|
|
78
|
-
|
|
79
|
-
const footerContent =
|
|
80
|
-
links || commonLinks ? (
|
|
81
|
-
<>
|
|
82
|
-
<StyledColumns>
|
|
83
|
-
<StyledHeading element="span" headingStyle="h2" margin="none">
|
|
84
|
-
{t("footer.vision")}
|
|
85
|
-
</StyledHeading>
|
|
86
|
-
<FooterLinks commonLinks={commonLinks} links={links} privacyLinks={privacyLinks} />
|
|
87
|
-
</StyledColumns>
|
|
88
|
-
{mainContent}
|
|
89
|
-
</>
|
|
90
|
-
) : (
|
|
91
|
-
mainContent
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<>
|
|
96
|
-
<footer>
|
|
97
|
-
<StyledDiv>
|
|
98
|
-
<StyledOneColumn>{footerContent}</StyledOneColumn>
|
|
99
|
-
<StyledBackground />
|
|
100
|
-
</StyledDiv>
|
|
101
|
-
{auth}
|
|
102
|
-
</footer>
|
|
103
|
-
</>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export default Footer;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019-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 { spacing, fonts, colors, mq, breakpoints } from "@ndla/core";
|
|
13
|
-
import { Launch } from "@ndla/icons/common";
|
|
14
|
-
import { SafeLink } from "@ndla/safelink";
|
|
15
|
-
import { Heading } from "@ndla/typography";
|
|
16
|
-
|
|
17
|
-
type FooterLinksProps = {
|
|
18
|
-
commonLinks?: {
|
|
19
|
-
to: string;
|
|
20
|
-
text: string;
|
|
21
|
-
external: boolean;
|
|
22
|
-
}[];
|
|
23
|
-
links?: {
|
|
24
|
-
to: string;
|
|
25
|
-
text: string;
|
|
26
|
-
icon: ReactNode;
|
|
27
|
-
}[];
|
|
28
|
-
privacyLinks?: {
|
|
29
|
-
url: string;
|
|
30
|
-
label: string;
|
|
31
|
-
}[];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const FooterLinkContainer = styled.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-wrap: wrap;
|
|
37
|
-
align-items: flex-start;
|
|
38
|
-
justify-content: space-between;
|
|
39
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
flex-wrap: nowrap;
|
|
42
|
-
align-self: flex-start;
|
|
43
|
-
}
|
|
44
|
-
width: 100%;
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
const LinkColumnWrapper = styled.div`
|
|
48
|
-
padding-right: ${spacing.large};
|
|
49
|
-
padding-top: ${spacing.normal};
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
const LastLinkColumnWrapper = styled.div`
|
|
53
|
-
padding-top: ${spacing.normal};
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const StyledNav = styled.nav`
|
|
57
|
-
display: flex;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
color: ${colors.white};
|
|
60
|
-
gap: ${spacing.xsmall};
|
|
61
|
-
padding-top: ${spacing.small};
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
const StyledSafeLink = styled(SafeLink)`
|
|
65
|
-
color: ${colors.white};
|
|
66
|
-
${fonts.size.text.content};
|
|
67
|
-
svg {
|
|
68
|
-
margin-left: ${spacing.xsmall};
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
|
|
72
|
-
const StyledSocialMediaIcon = styled.span`
|
|
73
|
-
margin-right: ${spacing.small};
|
|
74
|
-
svg {
|
|
75
|
-
width: 20px;
|
|
76
|
-
height: 20px;
|
|
77
|
-
color: ${colors.white};
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
const StyledLaunch = styled(Launch)`
|
|
82
|
-
margin-left: ${spacing.xsmall};
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const FooterLinks = ({ links, commonLinks, privacyLinks }: FooterLinksProps) => {
|
|
86
|
-
const { t } = useTranslation();
|
|
87
|
-
return (
|
|
88
|
-
<>
|
|
89
|
-
<FooterLinkContainer>
|
|
90
|
-
<LinkColumnWrapper>
|
|
91
|
-
<Heading element="span" headingStyle="list-title">
|
|
92
|
-
{t("footer.followUs")}
|
|
93
|
-
</Heading>
|
|
94
|
-
<StyledNav aria-label={t("footer.socialMedia")}>
|
|
95
|
-
{links?.map((link) => (
|
|
96
|
-
<div key={link.to}>
|
|
97
|
-
<StyledSocialMediaIcon>{link.icon}</StyledSocialMediaIcon>
|
|
98
|
-
<StyledSafeLink key={link.to} to={link.to}>
|
|
99
|
-
{link.text}
|
|
100
|
-
</StyledSafeLink>
|
|
101
|
-
</div>
|
|
102
|
-
))}
|
|
103
|
-
</StyledNav>
|
|
104
|
-
</LinkColumnWrapper>
|
|
105
|
-
<LinkColumnWrapper>
|
|
106
|
-
<Heading element="span" headingStyle="list-title">
|
|
107
|
-
{t("footer.linksHeader")}
|
|
108
|
-
</Heading>
|
|
109
|
-
<StyledNav aria-label={t("footer.linksHeader")}>
|
|
110
|
-
{commonLinks?.map((link) => (
|
|
111
|
-
<div key={link.to}>
|
|
112
|
-
<StyledSafeLink
|
|
113
|
-
key={link.text}
|
|
114
|
-
aria-label={link.text}
|
|
115
|
-
to={link.to}
|
|
116
|
-
target={link.external ? "_blank" : ""}
|
|
117
|
-
rel="noopener noreferrer"
|
|
118
|
-
>
|
|
119
|
-
{link.text}
|
|
120
|
-
</StyledSafeLink>
|
|
121
|
-
{link.external && <StyledLaunch />}
|
|
122
|
-
</div>
|
|
123
|
-
))}
|
|
124
|
-
</StyledNav>
|
|
125
|
-
</LinkColumnWrapper>
|
|
126
|
-
<LastLinkColumnWrapper>
|
|
127
|
-
<Heading element="span" headingStyle="list-title">
|
|
128
|
-
{t("footer.aboutWebsite")}
|
|
129
|
-
</Heading>
|
|
130
|
-
<StyledNav aria-label={t("footer.aboutWebsite")}>
|
|
131
|
-
{privacyLinks &&
|
|
132
|
-
privacyLinks.map((link) => (
|
|
133
|
-
<div key={link.label}>
|
|
134
|
-
<StyledSafeLink to={link.url}>{link.label}</StyledSafeLink>
|
|
135
|
-
</div>
|
|
136
|
-
))}
|
|
137
|
-
</StyledNav>
|
|
138
|
-
</LastLinkColumnWrapper>
|
|
139
|
-
</FooterLinkContainer>
|
|
140
|
-
</>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export default FooterLinks;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-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 styled from "@emotion/styled";
|
|
11
|
-
import { spacing, fonts, mq, breakpoints } from "@ndla/core";
|
|
12
|
-
|
|
13
|
-
const StyledFooterText = styled.p`
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
align-items: end;
|
|
17
|
-
gap: ${spacing.xsmall};
|
|
18
|
-
> span {
|
|
19
|
-
padding: ${spacing.xsmall} 0 0;
|
|
20
|
-
text-align: center;
|
|
21
|
-
}
|
|
22
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
23
|
-
${fonts.size.text.content};
|
|
24
|
-
> span {
|
|
25
|
-
padding: 0;
|
|
26
|
-
}
|
|
27
|
-
align-items: start;
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
type FooterTextProps = {
|
|
32
|
-
children: ReactNode;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const FooterText = ({ children }: FooterTextProps) => <StyledFooterText>{children}</StyledFooterText>;
|
|
@@ -1,100 +0,0 @@
|
|
|
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 { css } from "@emotion/react";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { colors, fonts, mq, spacing, breakpoints } from "@ndla/core";
|
|
12
|
-
import OneColumn from "../Layout/OneColumn";
|
|
13
|
-
|
|
14
|
-
type Types = "mobile" | "tablet" | "desktop" | "wide";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
images: {
|
|
18
|
-
url: string;
|
|
19
|
-
types: Types[];
|
|
20
|
-
}[];
|
|
21
|
-
heading: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const StyledHeader = styled.header`
|
|
25
|
-
width: 100%;
|
|
26
|
-
position: relative;
|
|
27
|
-
min-height: 180px;
|
|
28
|
-
display: flex;
|
|
29
|
-
justify-content: flex-start;
|
|
30
|
-
background: ${colors.brand.primary};
|
|
31
|
-
|
|
32
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
33
|
-
height: 320px;
|
|
34
|
-
align-items: center;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
const typeMap: Record<Types, { from?: string; until?: string }> = {
|
|
39
|
-
mobile: { from: breakpoints.mobile, until: breakpoints.tablet },
|
|
40
|
-
tablet: { from: breakpoints.tablet, until: breakpoints.desktop },
|
|
41
|
-
desktop: { from: breakpoints.desktop, until: breakpoints.wide },
|
|
42
|
-
wide: { from: breakpoints.wide },
|
|
43
|
-
};
|
|
44
|
-
interface StyledBackgroundProps {
|
|
45
|
-
type: Types;
|
|
46
|
-
imageUrl: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const StyledBackground = styled.div<StyledBackgroundProps>`
|
|
50
|
-
position: absolute;
|
|
51
|
-
width: 100%;
|
|
52
|
-
height: 100%;
|
|
53
|
-
top: 0%;
|
|
54
|
-
background-size: cover;
|
|
55
|
-
background-repeat: no-repeat;
|
|
56
|
-
background-position: center right;
|
|
57
|
-
opacity: 0.5;
|
|
58
|
-
background-image: url(${(p) => p.imageUrl});
|
|
59
|
-
${(p) =>
|
|
60
|
-
p.type &&
|
|
61
|
-
css`
|
|
62
|
-
display: none;
|
|
63
|
-
${mq.range(typeMap[p.type])} {
|
|
64
|
-
display: block;
|
|
65
|
-
}
|
|
66
|
-
`};
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
const StyledHeading = styled.h1`
|
|
70
|
-
${fonts.sizes("24px", "28px")};
|
|
71
|
-
color: ${colors.white};
|
|
72
|
-
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
|
73
|
-
margin: ${spacing.medium} 0 ${spacing.normal} 0;
|
|
74
|
-
font-weight: ${fonts.weight.bold};
|
|
75
|
-
padding: 0 ${spacing.normal};
|
|
76
|
-
|
|
77
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
78
|
-
margin: 0;
|
|
79
|
-
${fonts.sizes("40px", "40px")};
|
|
80
|
-
padding: 0 0 0 ${spacing.xlarge};
|
|
81
|
-
}
|
|
82
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
83
|
-
margin: 0;
|
|
84
|
-
${fonts.sizes("52px", "52px")};
|
|
85
|
-
padding: 0 0 0 ${spacing.xlarge};
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
const SubjectHeader = ({ images = [], heading }: Props) => (
|
|
90
|
-
<StyledHeader>
|
|
91
|
-
{images?.map((image) =>
|
|
92
|
-
image.types.map((type) => <StyledBackground key={`${image.url}${type}`} imageUrl={image.url} type={type} />),
|
|
93
|
-
)}
|
|
94
|
-
<OneColumn noPadding>
|
|
95
|
-
<StyledHeading>{heading}</StyledHeading>
|
|
96
|
-
</OneColumn>
|
|
97
|
-
</StyledHeader>
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
export default SubjectHeader;
|