@ndla/ui 47.4.0 → 48.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.
Files changed (144) hide show
  1. package/es/Search/SearchField.js +4 -9
  2. package/es/Subject/index.js +1 -4
  3. package/es/index.js +1 -6
  4. package/es/locale/messages-nb.js +1 -1
  5. package/es/locale/messages-nn.js +1 -1
  6. package/lib/Search/SearchField.d.ts +1 -2
  7. package/lib/Search/SearchField.js +4 -9
  8. package/lib/Subject/index.d.ts +0 -3
  9. package/lib/Subject/index.js +0 -63
  10. package/lib/index.d.ts +1 -6
  11. package/lib/index.js +0 -143
  12. package/lib/locale/messages-nb.js +1 -1
  13. package/lib/locale/messages-nn.js +1 -1
  14. package/package.json +4 -4
  15. package/src/Search/SearchField.tsx +1 -5
  16. package/src/Subject/index.ts +0 -13
  17. package/src/index.ts +1 -32
  18. package/src/locale/messages-nb.ts +1 -1
  19. package/src/locale/messages-nn.ts +1 -1
  20. package/es/BlogPosts/BlogPost.js +0 -96
  21. package/es/BlogPosts/BlogPostWrapper.js +0 -28
  22. package/es/BlogPosts/index.js +0 -11
  23. package/es/Frontpage/FrontpageFilm.js +0 -66
  24. package/es/Frontpage/FrontpageHeader.js +0 -50
  25. package/es/Frontpage/FrontpageInfo.js +0 -23
  26. package/es/Frontpage/FrontpageMultidisciplinarySubject.js +0 -99
  27. package/es/Frontpage/FrontpageProgramMenu.js +0 -86
  28. package/es/Frontpage/FrontpageSearch.js +0 -157
  29. package/es/Frontpage/FrontpageToolbox.js +0 -57
  30. package/es/Frontpage/illustrations/Fellesfag.js +0 -99
  31. package/es/Frontpage/illustrations/FrontpageHeaderIllustration.js +0 -113
  32. package/es/Frontpage/illustrations/FrontpageIllustrations.js +0 -21
  33. package/es/Frontpage/illustrations/FrontpageSubjectIllustration.js +0 -184
  34. package/es/Frontpage/illustrations/MenuFellesfag.js +0 -80
  35. package/es/Frontpage/illustrations/MenuStudiespesialiserende.js +0 -77
  36. package/es/Frontpage/illustrations/MenuYrkesfag.js +0 -107
  37. package/es/Frontpage/illustrations/Studiespesialiserende.js +0 -87
  38. package/es/Frontpage/illustrations/Yrkesfag.js +0 -118
  39. package/es/Frontpage/illustrations/index.js +0 -18
  40. package/es/Frontpage/index.js +0 -9
  41. package/es/Frontpage/sortCategories.js +0 -25
  42. package/es/InfoBlock/InfoBlock.js +0 -58
  43. package/es/InfoBlock/index.js +0 -1
  44. package/es/InfoBox/InfoBox.js +0 -16
  45. package/es/InfoBox/index.js +0 -1
  46. package/es/InfoWidget/InfoWidget.js +0 -103
  47. package/es/InfoWidget/index.js +0 -2
  48. package/es/Subject/Subject.js +0 -143
  49. package/es/Subject/SubjectNewContent.js +0 -102
  50. package/es/Subject/SubjectSocial.js +0 -33
  51. package/lib/BlogPosts/BlogPost.d.ts +0 -22
  52. package/lib/BlogPosts/BlogPost.js +0 -103
  53. package/lib/BlogPosts/BlogPostWrapper.d.ts +0 -14
  54. package/lib/BlogPosts/BlogPostWrapper.js +0 -37
  55. package/lib/BlogPosts/index.d.ts +0 -10
  56. package/lib/BlogPosts/index.js +0 -20
  57. package/lib/Frontpage/FrontpageFilm.d.ts +0 -6
  58. package/lib/Frontpage/FrontpageFilm.js +0 -73
  59. package/lib/Frontpage/FrontpageHeader.d.ts +0 -8
  60. package/lib/Frontpage/FrontpageHeader.js +0 -57
  61. package/lib/Frontpage/FrontpageInfo.d.ts +0 -6
  62. package/lib/Frontpage/FrontpageInfo.js +0 -31
  63. package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +0 -33
  64. package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +0 -114
  65. package/lib/Frontpage/FrontpageProgramMenu.d.ts +0 -9
  66. package/lib/Frontpage/FrontpageProgramMenu.js +0 -93
  67. package/lib/Frontpage/FrontpageSearch.d.ts +0 -21
  68. package/lib/Frontpage/FrontpageSearch.js +0 -164
  69. package/lib/Frontpage/FrontpageToolbox.d.ts +0 -8
  70. package/lib/Frontpage/FrontpageToolbox.js +0 -64
  71. package/lib/Frontpage/illustrations/Fellesfag.d.ts +0 -9
  72. package/lib/Frontpage/illustrations/Fellesfag.js +0 -105
  73. package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.d.ts +0 -9
  74. package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.js +0 -119
  75. package/lib/Frontpage/illustrations/FrontpageIllustrations.d.ts +0 -9
  76. package/lib/Frontpage/illustrations/FrontpageIllustrations.js +0 -30
  77. package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.d.ts +0 -9
  78. package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.js +0 -188
  79. package/lib/Frontpage/illustrations/MenuFellesfag.d.ts +0 -9
  80. package/lib/Frontpage/illustrations/MenuFellesfag.js +0 -86
  81. package/lib/Frontpage/illustrations/MenuStudiespesialiserende.d.ts +0 -9
  82. package/lib/Frontpage/illustrations/MenuStudiespesialiserende.js +0 -83
  83. package/lib/Frontpage/illustrations/MenuYrkesfag.d.ts +0 -9
  84. package/lib/Frontpage/illustrations/MenuYrkesfag.js +0 -113
  85. package/lib/Frontpage/illustrations/Studiespesialiserende.d.ts +0 -9
  86. package/lib/Frontpage/illustrations/Studiespesialiserende.js +0 -93
  87. package/lib/Frontpage/illustrations/Yrkesfag.d.ts +0 -9
  88. package/lib/Frontpage/illustrations/Yrkesfag.js +0 -124
  89. package/lib/Frontpage/illustrations/index.d.ts +0 -18
  90. package/lib/Frontpage/illustrations/index.js +0 -68
  91. package/lib/Frontpage/index.d.ts +0 -9
  92. package/lib/Frontpage/index.js +0 -99
  93. package/lib/Frontpage/sortCategories.d.ts +0 -9
  94. package/lib/Frontpage/sortCategories.js +0 -32
  95. package/lib/InfoBlock/InfoBlock.d.ts +0 -8
  96. package/lib/InfoBlock/InfoBlock.js +0 -64
  97. package/lib/InfoBlock/index.d.ts +0 -1
  98. package/lib/InfoBlock/index.js +0 -12
  99. package/lib/InfoBox/InfoBox.d.ts +0 -6
  100. package/lib/InfoBox/InfoBox.js +0 -24
  101. package/lib/InfoBox/index.d.ts +0 -1
  102. package/lib/InfoBox/index.js +0 -13
  103. package/lib/InfoWidget/InfoWidget.d.ts +0 -21
  104. package/lib/InfoWidget/InfoWidget.js +0 -110
  105. package/lib/InfoWidget/index.d.ts +0 -2
  106. package/lib/InfoWidget/index.js +0 -10
  107. package/lib/Subject/Subject.d.ts +0 -32
  108. package/lib/Subject/Subject.js +0 -156
  109. package/lib/Subject/SubjectNewContent.d.ts +0 -13
  110. package/lib/Subject/SubjectNewContent.js +0 -109
  111. package/lib/Subject/SubjectSocial.d.ts +0 -12
  112. package/lib/Subject/SubjectSocial.js +0 -41
  113. package/src/BlogPosts/BlogPost.tsx +0 -192
  114. package/src/BlogPosts/BlogPostWrapper.tsx +0 -49
  115. package/src/BlogPosts/index.ts +0 -12
  116. package/src/Frontpage/FrontpageFilm.tsx +0 -97
  117. package/src/Frontpage/FrontpageHeader.tsx +0 -72
  118. package/src/Frontpage/FrontpageInfo.tsx +0 -45
  119. package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +0 -110
  120. package/src/Frontpage/FrontpageProgramMenu.tsx +0 -86
  121. package/src/Frontpage/FrontpageSearch.tsx +0 -200
  122. package/src/Frontpage/FrontpageToolbox.tsx +0 -70
  123. package/src/Frontpage/__tests__/Frontpage-test.js +0 -158
  124. package/src/Frontpage/illustrations/Fellesfag.tsx +0 -99
  125. package/src/Frontpage/illustrations/FrontpageHeaderIllustration.tsx +0 -131
  126. package/src/Frontpage/illustrations/FrontpageIllustrations.tsx +0 -28
  127. package/src/Frontpage/illustrations/FrontpageSubjectIllustration.tsx +0 -151
  128. package/src/Frontpage/illustrations/MenuFellesfag.tsx +0 -73
  129. package/src/Frontpage/illustrations/MenuStudiespesialiserende.tsx +0 -70
  130. package/src/Frontpage/illustrations/MenuYrkesfag.tsx +0 -82
  131. package/src/Frontpage/illustrations/Studiespesialiserende.tsx +0 -79
  132. package/src/Frontpage/illustrations/Yrkesfag.tsx +0 -122
  133. package/src/Frontpage/illustrations/index.ts +0 -31
  134. package/src/Frontpage/index.ts +0 -17
  135. package/src/Frontpage/sortCategories.ts +0 -23
  136. package/src/InfoBlock/InfoBlock.tsx +0 -61
  137. package/src/InfoBlock/index.ts +0 -1
  138. package/src/InfoBox/InfoBox.tsx +0 -31
  139. package/src/InfoBox/index.ts +0 -1
  140. package/src/InfoWidget/InfoWidget.tsx +0 -127
  141. package/src/InfoWidget/index.ts +0 -3
  142. package/src/Subject/Subject.tsx +0 -199
  143. package/src/Subject/SubjectNewContent.tsx +0 -111
  144. package/src/Subject/SubjectSocial.tsx +0 -36
@@ -1,61 +0,0 @@
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 { ReactNode } from 'react';
10
- import styled from '@emotion/styled';
11
- import { spacing, fonts, colors } from '@ndla/core';
12
-
13
- const InfoBlockWrapper = styled.div`
14
- border-bottom: 1px solid ${colors.brand.neutral7};
15
- padding: ${spacing.small} 0;
16
- `;
17
-
18
- const IconWrapper = styled.div`
19
- align-items: flex-start;
20
- display: flex;
21
-
22
- svg {
23
- height: 25px;
24
- width: 25px;
25
- }
26
- `;
27
-
28
- const StyledTextWrapper = styled.div`
29
- ${fonts.sizes(18)}
30
- `;
31
-
32
- const TitleWrapper = styled.div`
33
- display: flex;
34
-
35
- gap: ${spacing.small};
36
- `;
37
-
38
- const StyledTitle = styled.h2`
39
- ${fonts.sizes('18')}
40
- font-weight: 700;
41
- margin: 0;
42
- `;
43
-
44
- interface InfoBlockProps {
45
- icon?: ReactNode;
46
- title?: string;
47
- children?: ReactNode;
48
- }
49
- export const InfoBlock = ({ icon, title, children }: InfoBlockProps) => {
50
- return (
51
- <InfoBlockWrapper>
52
- <TitleWrapper>
53
- <IconWrapper>{icon}</IconWrapper>
54
- <StyledTitle>{title}</StyledTitle>
55
- </TitleWrapper>
56
- <StyledTextWrapper>{children}</StyledTextWrapper>
57
- </InfoBlockWrapper>
58
- );
59
- };
60
-
61
- export default InfoBlock;
@@ -1 +0,0 @@
1
- export { InfoBlock } from './InfoBlock';
@@ -1,31 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
3
- import { ReactNode } from 'react';
4
-
5
- interface Props {
6
- children?: ReactNode;
7
- }
8
-
9
- const StyledInfoBox = styled.div`
10
- background: ${colors.support.yellowLight};
11
- padding: ${spacing.small} ${spacing.normal};
12
- font-family: ${fonts.sans};
13
- ${fonts.sizes('14px', '18px')};
14
- margin-bottom: ${spacing.medium};
15
- ${mq.range({ from: breakpoints.tablet })} {
16
- ${fonts.sizes('16px', '20px')};
17
- padding: ${spacing.normal};
18
- }
19
-
20
- & > *:first-child {
21
- margin-top: 0;
22
- }
23
-
24
- & > *:last-child {
25
- margin-bottom: 0;
26
- }
27
- `;
28
-
29
- const InfoBox = ({ children }: Props) => <StyledInfoBox>{children}</StyledInfoBox>;
30
-
31
- export default InfoBox;
@@ -1 +0,0 @@
1
- export { default as InfoBox } from './InfoBox';
@@ -1,127 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { css } from '@emotion/react';
3
- import { ReactNode } from 'react';
4
- import { Forward } from '@ndla/icons/common';
5
- import SafeLink from '@ndla/safelink';
6
- import { colors, fonts, spacing } from '@ndla/core';
7
-
8
- import { HeadingLevel } from '@ndla/typography';
9
- import SectionHeading from '../SectionHeading';
10
-
11
- interface InfoWidgetSectionProps {
12
- center?: boolean;
13
- }
14
- const InfoWidgetSection = styled.section<InfoWidgetSectionProps>`
15
- max-width: 600px;
16
- margin: ${(p) => p.center && '0 auto'};
17
- `;
18
-
19
- const InfoWidgetDescription = styled.div`
20
- padding: ${spacing.normal};
21
- background: ${colors.brand.lighter};
22
- color: ${colors.brand.dark};
23
- ${fonts.sizes('18px', '26px')};
24
-
25
- p {
26
- margin-top: 0;
27
- &:last-child {
28
- margin-bottom: 0;
29
- }
30
- }
31
- `;
32
-
33
- const InfoWidgetLinksContainer = styled.div`
34
- display: flex;
35
- align-items: center;
36
- justify-content: flex-end;
37
- `;
38
-
39
- const iconLinkStyle = css`
40
- width: 47px;
41
- height: 47px;
42
- border-radius: 100%;
43
- background: ${colors.brand.lighter};
44
- color: ${colors.brand.dark};
45
- box-shadow: none;
46
- display: flex;
47
- justify-content: center;
48
- align-items: center;
49
- margin-right: ${spacing.small};
50
-
51
- .c-icon {
52
- width: 20px;
53
- height: 20px;
54
- }
55
- `;
56
-
57
- const IconSafeLink = styled(SafeLink)(iconLinkStyle);
58
-
59
- const IconAnchor = styled.a(iconLinkStyle);
60
- const IconSpan = styled.span(iconLinkStyle);
61
-
62
- const StyledMainLink = styled.a`
63
- color: ${colors.brand.dark};
64
- ${fonts.sizes('16px', '24px')};
65
- `;
66
- interface Props {
67
- heading: string;
68
- headingLevel: HeadingLevel;
69
- description: string;
70
- mainLink: {
71
- name: string;
72
- url?: string;
73
- href?: string;
74
- };
75
- iconLinks: {
76
- name: string;
77
- url?: string;
78
- href?: string;
79
- icon: ReactNode;
80
- }[];
81
- center?: boolean;
82
- }
83
-
84
- const InfoWidget = ({ heading, description, mainLink, iconLinks, headingLevel, center = false }: Props) => (
85
- <InfoWidgetSection center={center}>
86
- <SectionHeading headingLevel={headingLevel} large>
87
- {heading}
88
- </SectionHeading>
89
- <InfoWidgetDescription>
90
- <p>{description}</p>
91
- </InfoWidgetDescription>
92
- <InfoWidgetLinksContainer>
93
- {iconLinks?.map((link) => {
94
- if (link.url) {
95
- return (
96
- <IconSafeLink key={link.url} to={link.url} aria-label={link.name}>
97
- {link.icon}
98
- </IconSafeLink>
99
- );
100
- }
101
- if (link.href) {
102
- return (
103
- <IconAnchor key={link.href} href={link.href} aria-label={link.name}>
104
- {link.icon}
105
- </IconAnchor>
106
- );
107
- }
108
- return (
109
- <IconSpan key={link.name} aria-label={link.name}>
110
- {link.icon}
111
- </IconSpan>
112
- );
113
- })}
114
- {mainLink.url ? (
115
- <div className="o-text-link__wrapper o-text-link__wrapper--right">
116
- <SafeLink className="o-text-link" to={mainLink.url}>
117
- <span>{mainLink.name}</span> <Forward />
118
- </SafeLink>
119
- </div>
120
- ) : (
121
- <StyledMainLink href={mainLink.href}>{mainLink.name}</StyledMainLink>
122
- )}
123
- </InfoWidgetLinksContainer>
124
- </InfoWidgetSection>
125
- );
126
-
127
- export default InfoWidget;
@@ -1,3 +0,0 @@
1
- import InfoWidget from './InfoWidget';
2
-
3
- export default InfoWidget;
@@ -1,199 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import styled from '@emotion/styled';
3
- import { css } from '@emotion/react';
4
- import { breakpoints, colors, mq, spacing, spacingUnit } from '@ndla/core';
5
- import { HeadingLevel } from '@ndla/typography';
6
- import SectionHeading from '../SectionHeading';
7
-
8
- const SubjectContentWrapper = styled.div`
9
- ${mq.range({ from: breakpoints.tablet })} {
10
- margin-bottom: 100px;
11
- }
12
- `;
13
-
14
- const StyledBreadcrumb = styled.div`
15
- display: none;
16
- margin: ${spacing.medium} 0 0 0;
17
- ${mq.range({ from: breakpoints.tablet })} {
18
- display: block;
19
- margin-left: ${spacingUnit * 3}px;
20
- }
21
- `;
22
-
23
- interface StyledSubjectContentProps {
24
- twoColumns: boolean;
25
- }
26
- const StyledSubjectContent = styled.div<StyledSubjectContentProps>`
27
- display: block;
28
- flex-flow: column;
29
- margin-top: ${spacing.small};
30
- ${mq.range({ from: breakpoints.tablet })} {
31
- display: flex;
32
- flex-flow: row;
33
- margin-top: ${spacing.large};
34
- > *:not(:only-child):last-child {
35
- padding-left: ${spacingUnit * 3}px;
36
- }
37
- }
38
-
39
- & > *:first-child {
40
- margin-bottom: ${spacing.large};
41
- ${mq.range({ from: breakpoints.tablet })} {
42
- margin-right: 80px;
43
- }
44
- }
45
-
46
- ${(p) =>
47
- !p.twoColumns &&
48
- css`
49
- ${mq.range({ from: breakpoints.desktop })} {
50
- > *:not(:only-child) {
51
- max-width: 50%;
52
- }
53
- }
54
- ${mq.range({ until: breakpoints.desktop })} {
55
- flex-direction: column;
56
- }
57
- ${mq.range({ from: breakpoints.tablet, until: breakpoints.desktop })} {
58
- > *:not(:only-child):last-child {
59
- padding-left: $subject-margin;
60
- }
61
- }
62
- `};
63
-
64
- ${(p) =>
65
- p.twoColumns &&
66
- css`
67
- flex-flow: column;
68
- & > *:first-child {
69
- ${mq.range({ from: breakpoints.tablet })} {
70
- margin-right: 0;
71
- }
72
- }
73
- `};
74
- `;
75
- export const SubjectContent = ({
76
- children,
77
- breadcrumb,
78
- twoColumns = false,
79
- }: {
80
- children: ReactNode;
81
- breadcrumb: ReactNode;
82
- twoColumns?: boolean;
83
- }) => (
84
- <SubjectContentWrapper>
85
- <StyledBreadcrumb>{breadcrumb}</StyledBreadcrumb>
86
- <StyledSubjectContent twoColumns={twoColumns}>{children}</StyledSubjectContent>
87
- </SubjectContentWrapper>
88
- );
89
-
90
- const StyledSecondaryContent = styled.div`
91
- background: ${colors.brand.greyLightest};
92
- padding: ${spacing.large} 0;
93
- margin-top: ${spacing.large};
94
-
95
- ${mq.range({ from: breakpoints.tablet })} {
96
- padding: ${spacingUnit * 3}px 0 ${spacing.large};
97
- margin-bottom: 100px;
98
- margin-top: 0;
99
- }
100
- `;
101
-
102
- export const SubjectSecondaryContent = ({ children }: { children: ReactNode }) => (
103
- <StyledSecondaryContent>{children}</StyledSecondaryContent>
104
- );
105
-
106
- const StyledChildContent = styled.div`
107
- padding: 0 ${spacing.normal};
108
- `;
109
-
110
- export const SubjectChildContent = ({ children }: { children: ReactNode }) => (
111
- <StyledChildContent>{children}</StyledChildContent>
112
- );
113
-
114
- export const SubjectTopics = ({ messages, children }: { messages: { heading: string }; children: ReactNode }) => (
115
- <section>
116
- <header>
117
- <h1>{messages.heading}</h1>
118
- </header>
119
- <div>{children}</div>
120
- </section>
121
- );
122
-
123
- const SidebarWrapper = styled.div`
124
- display: block;
125
- margin: 0 ${spacing.normal};
126
-
127
- & > *:last-child {
128
- margin-bottom: 0;
129
- }
130
-
131
- ${mq.range({ from: breakpoints.tablet })} {
132
- flex-basis: 390px;
133
- flex-shrink: 0;
134
- margin: 0px 0 0 0;
135
- }
136
- `;
137
-
138
- export const SubjectSidebarWrapper = ({ children }: { children: ReactNode }) => (
139
- <SidebarWrapper>{children}</SidebarWrapper>
140
- );
141
-
142
- interface StyledSubjectFlexWrapperProps {
143
- noMargin: boolean;
144
- }
145
- const StyledSubjectFlexWrapper = styled.div<StyledSubjectFlexWrapperProps>`
146
- display: flex;
147
- flex-direction: column;
148
- margin-bottom: ${(p) => !p.noMargin && spacing.large};
149
-
150
- ${mq.range({ from: breakpoints.tablet })} {
151
- flex-direction: row;
152
- }
153
- `;
154
-
155
- export const SubjectFlexWrapper = ({ children, noMargin = false }: { children: ReactNode; noMargin?: boolean }) => (
156
- <StyledSubjectFlexWrapper noMargin={noMargin}>{children}</StyledSubjectFlexWrapper>
157
- );
158
-
159
- const StyledSubjectFlexChild = styled.div`
160
- box-sizing: border-box;
161
- padding: 0 ${spacing.small};
162
- ${mq.range({ from: breakpoints.tablet })} {
163
- flex-basis: 50%;
164
- flex-grow: 1;
165
- flex-direction: row;
166
- }
167
-
168
- &:last-child {
169
- & > * {
170
- ${mq.range({ until: breakpoints.tablet })} {
171
- margin-bottom: 0;
172
- }
173
- }
174
- }
175
- & > * {
176
- ${mq.range({ from: breakpoints.tablet })} {
177
- margin-bottom: o;
178
- }
179
- }
180
- `;
181
-
182
- const StyledSectionHeading = styled(SectionHeading)`
183
- margin: 0 0 ${spacing.small} 0;
184
-
185
- ${mq.range({ from: breakpoints.tablet })} {
186
- margin: 0 0 ${spacing.normal} 0;
187
- }
188
- `;
189
-
190
- interface SubjectSectionTitleProps {
191
- headingLevel: HeadingLevel;
192
- children: ReactNode;
193
- }
194
-
195
- export const SubjectSectionTitle = ({ children, headingLevel = 'h2' }: SubjectSectionTitleProps) => (
196
- <StyledSectionHeading large headingLevel={headingLevel}>
197
- {children}
198
- </StyledSectionHeading>
199
- );
@@ -1,111 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import SafeLink from '@ndla/safelink';
3
- import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
4
- import { HeadingLevel } from '@ndla/typography';
5
- import ContentTypeBadge from '../ContentTypeBadge';
6
- import { SubjectSectionTitle } from './Subject';
7
-
8
- interface Props {
9
- headingLevel: HeadingLevel;
10
- heading: string;
11
- content: {
12
- name: string;
13
- url: string;
14
- formattedDate: string;
15
- contentType: string;
16
- }[];
17
- }
18
-
19
- const StyledSection = styled.section`
20
- ${mq.range({ until: breakpoints.tablet })} {
21
- margin-bottom: ${spacing.large};
22
- }
23
- `;
24
-
25
- const StyledSubjectSectionTitle = styled(SubjectSectionTitle)`
26
- ${mq.range({ from: breakpoints.tabletWide })} {
27
- margin-left: ${spacing.large} !important;
28
- }
29
- `;
30
-
31
- const StyledUl = styled.ul`
32
- margin: 0;
33
- padding: 0;
34
- `;
35
-
36
- const StyledListItem = styled.li`
37
- display: flex;
38
- align-items: center;
39
- justify-content: space-between;
40
- &:last-child {
41
- margin-bottom: 0;
42
- }
43
- `;
44
-
45
- const LeftWrapper = styled.div`
46
- display: flex;
47
- justify-content: flex-start;
48
- align-items: flex-start;
49
-
50
- .c-icon {
51
- width: 14px;
52
- height: 14px;
53
- margin-left: ${spacing.xsmall};
54
- margin-right: ${spacing.xsmall};
55
- }
56
-
57
- .c-content-type-badge {
58
- margin-top: 23px;
59
- ${mq.range({ until: breakpoints.tabletWide })} {
60
- display: none;
61
- }
62
- }
63
- `;
64
-
65
- const ContentLinkWrapper = styled.div`
66
- ${mq.range({ from: breakpoints.tabletWide })} {
67
- padding-left: ${spacing.normal};
68
- }
69
- padding-bottom: ${spacing.small};
70
- `;
71
-
72
- const DateWrapper = styled.div`
73
- color: ${colors.text.light};
74
- ${fonts.sizes('14px', '18px')};
75
- ${mq.range({ from: breakpoints.tablet })} {
76
- ${fonts.sizes('16px', '20px')};
77
- }
78
- `;
79
-
80
- const StyledSafeLink = styled(SafeLink)`
81
- color: ${colors.brand.dark};
82
- font-weight: 600;
83
- ${fonts.sizes('16px', '20px')};
84
- margin-bottom: ${spacing.xsmall};
85
- ${mq.range({ from: breakpoints.tablet })} {
86
- ${fonts.sizes('18px', '30px')};
87
- }
88
- `;
89
-
90
- const SubjectNewContent = ({ heading, content, headingLevel }: Props) => (
91
- <StyledSection>
92
- <StyledSubjectSectionTitle headingLevel={headingLevel}>{heading}</StyledSubjectSectionTitle>
93
- <nav>
94
- <StyledUl>
95
- {content.map((item, index) => (
96
- <StyledListItem key={index}>
97
- <LeftWrapper>
98
- <ContentTypeBadge type={item.contentType} size="x-small" background border />
99
- <ContentLinkWrapper>
100
- <DateWrapper>{item.formattedDate}</DateWrapper>
101
- <StyledSafeLink to={item.url}>{item.name}</StyledSafeLink>
102
- </ContentLinkWrapper>
103
- </LeftWrapper>
104
- </StyledListItem>
105
- ))}
106
- </StyledUl>
107
- </nav>
108
- </StyledSection>
109
- );
110
-
111
- export default SubjectNewContent;
@@ -1,36 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { breakpoints, mq, spacing } from '@ndla/core';
3
- import { ReactNode } from 'react';
4
- import { HeadingLevel } from '@ndla/typography';
5
- import { SubjectSectionTitle } from './Subject';
6
-
7
- const StyledSubjectSocialContent = styled.div`
8
- display: none;
9
- ${mq.range({ from: breakpoints.tabletWide })} {
10
- display: flex;
11
- }
12
- `;
13
-
14
- export const SubjectSocialContent = ({ children }: { children: ReactNode }) => (
15
- <StyledSubjectSocialContent>{children}</StyledSubjectSocialContent>
16
- );
17
-
18
- const StyledSection = styled.section`
19
- flex-basis: 50%;
20
- &:nth-child(odd) {
21
- margin-right: ${spacing.normal};
22
- }
23
- `;
24
-
25
- interface SubjectSocialSectionProps {
26
- children: ReactNode;
27
- title?: string;
28
- headingLevel: HeadingLevel;
29
- }
30
-
31
- export const SubjectSocialSection = ({ children, title = '', headingLevel }: SubjectSocialSectionProps) => (
32
- <StyledSection>
33
- <SubjectSectionTitle headingLevel={headingLevel}>{title}</SubjectSectionTitle>
34
- {children}
35
- </StyledSection>
36
- );