@ndla/ui 44.0.11 → 44.0.13
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/ArticleByline.js +8 -11
- package/es/BannerCard/BannerCard.js +7 -7
- package/es/ContactBlock/ContactBlock.js +13 -13
- package/es/LinkBlock/LinkBlock.js +6 -6
- package/es/Masthead/Masthead.js +13 -34
- package/es/Masthead/MastheadSearchModal.js +2 -4
- package/es/Masthead/index.js +2 -2
- package/es/Search/ToggleSearchButton.js +9 -24
- package/es/Table/Table.js +36 -30
- package/es/Table/index.js +1 -0
- package/es/User/UserInfo.js +6 -3
- package/es/User/parseUserObject.js +1 -1
- package/es/all.css +1 -1
- package/es/index.js +2 -2
- package/es/locale/messages-en.js +1 -2
- package/es/locale/messages-nb.js +1 -2
- package/es/locale/messages-nn.js +1 -2
- package/es/locale/messages-se.js +1 -2
- package/es/locale/messages-sma.js +1 -2
- package/lib/Article/ArticleByline.js +8 -11
- package/lib/BannerCard/BannerCard.js +7 -7
- package/lib/ContactBlock/ContactBlock.js +13 -13
- package/lib/LinkBlock/LinkBlock.js +6 -6
- package/lib/Masthead/Masthead.d.ts +0 -6
- package/lib/Masthead/Masthead.js +14 -36
- package/lib/Masthead/MastheadSearchModal.d.ts +1 -2
- package/lib/Masthead/MastheadSearchModal.js +2 -4
- package/lib/Masthead/index.d.ts +2 -2
- package/lib/Masthead/index.js +1 -10
- package/lib/Search/ToggleSearchButton.d.ts +0 -2
- package/lib/Search/ToggleSearchButton.js +8 -23
- package/lib/Table/Table.d.ts +1 -0
- package/lib/Table/Table.js +43 -36
- package/lib/Table/index.d.ts +1 -0
- package/lib/Table/index.js +10 -2
- package/lib/User/UserInfo.js +6 -3
- package/lib/User/parseUserObject.d.ts +1 -1
- package/lib/User/parseUserObject.js +1 -1
- package/lib/all.css +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +7 -7
- package/lib/locale/messages-en.d.ts +1 -2
- package/lib/locale/messages-en.js +1 -2
- package/lib/locale/messages-nb.d.ts +1 -2
- package/lib/locale/messages-nb.js +1 -2
- package/lib/locale/messages-nn.d.ts +1 -2
- package/lib/locale/messages-nn.js +1 -2
- package/lib/locale/messages-se.d.ts +1 -2
- package/lib/locale/messages-se.js +1 -2
- package/lib/locale/messages-sma.d.ts +1 -2
- package/lib/locale/messages-sma.js +1 -2
- package/package.json +16 -16
- package/src/Article/ArticleByline.tsx +6 -8
- package/src/BannerCard/BannerCard.tsx +1 -1
- package/src/ContactBlock/ContactBlock.tsx +1 -0
- package/src/LinkBlock/LinkBlock.tsx +1 -0
- package/src/Masthead/Masthead.tsx +6 -38
- package/src/Masthead/MastheadSearchModal.tsx +2 -3
- package/src/Masthead/index.ts +2 -2
- package/src/Search/ToggleSearchButton.tsx +21 -38
- package/src/Table/Table.tsx +166 -19
- package/src/Table/index.ts +1 -0
- package/src/User/UserInfo.tsx +3 -1
- package/src/User/__tests__/parseUserObject-test.ts +1 -1
- package/src/User/parseUserObject.ts +1 -1
- package/src/index.ts +2 -2
- package/src/locale/messages-en.ts +1 -2
- package/src/locale/messages-nb.ts +1 -2
- package/src/locale/messages-nn.ts +1 -2
- package/src/locale/messages-se.ts +1 -2
- package/src/locale/messages-sma.ts +1 -2
- package/src/main.scss +0 -1
- package/src/Table/component.tables.scss +0 -218
package/lib/index.d.ts
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
export { default as SectionHeading } from './SectionHeading';
|
|
9
9
|
export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, } from './Embed';
|
|
10
10
|
export { ArticleByline, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, default as Article, } from './Article';
|
|
11
|
-
export { default as Table } from './Table';
|
|
11
|
+
export { default as Table, TableStyling } from './Table';
|
|
12
12
|
export { default as ResourcesWrapper, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
13
13
|
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
14
14
|
export { default as NoContentBox } from './NoContentBox';
|
|
15
|
-
export { default as Masthead,
|
|
15
|
+
export { default as Masthead, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
|
|
16
16
|
export { default as ContentLoader } from './ContentLoader';
|
|
17
17
|
export { default as RelatedArticleList, RelatedArticle, RelatedArticleListV2 } from './RelatedArticleList';
|
|
18
18
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
|
package/lib/index.js
CHANGED
|
@@ -706,12 +706,6 @@ Object.defineProperty(exports, "Masthead", {
|
|
|
706
706
|
return _Masthead.default;
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
|
-
Object.defineProperty(exports, "MastheadItem", {
|
|
710
|
-
enumerable: true,
|
|
711
|
-
get: function get() {
|
|
712
|
-
return _Masthead.MastheadItem;
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
709
|
Object.defineProperty(exports, "MastheadSearchModal", {
|
|
716
710
|
enumerable: true,
|
|
717
711
|
get: function get() {
|
|
@@ -1102,6 +1096,12 @@ Object.defineProperty(exports, "Table", {
|
|
|
1102
1096
|
return _Table.default;
|
|
1103
1097
|
}
|
|
1104
1098
|
});
|
|
1099
|
+
Object.defineProperty(exports, "TableStyling", {
|
|
1100
|
+
enumerable: true,
|
|
1101
|
+
get: function get() {
|
|
1102
|
+
return _Table.TableStyling;
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
1105
|
Object.defineProperty(exports, "TagSelector", {
|
|
1106
1106
|
enumerable: true,
|
|
1107
1107
|
get: function get() {
|
|
@@ -1279,7 +1279,7 @@ Object.defineProperty(exports, "useSnack", {
|
|
|
1279
1279
|
var _SectionHeading = _interopRequireDefault(require("./SectionHeading"));
|
|
1280
1280
|
var _Embed = require("./Embed");
|
|
1281
1281
|
var _Article = _interopRequireWildcard(require("./Article"));
|
|
1282
|
-
var _Table =
|
|
1282
|
+
var _Table = _interopRequireWildcard(require("./Table"));
|
|
1283
1283
|
var _ResourcesWrapper = _interopRequireWildcard(require("./ResourcesWrapper"));
|
|
1284
1284
|
var _createUniversalPortal = require("./utils/createUniversalPortal");
|
|
1285
1285
|
var _NoContentBox = _interopRequireDefault(require("./NoContentBox"));
|
|
@@ -29,8 +29,6 @@ declare const messages: {
|
|
|
29
29
|
loggedInAsButton: string;
|
|
30
30
|
role: {
|
|
31
31
|
employee: string;
|
|
32
|
-
faculty: string;
|
|
33
|
-
staff: string;
|
|
34
32
|
student: string;
|
|
35
33
|
};
|
|
36
34
|
buttonLogIn: string;
|
|
@@ -151,6 +149,7 @@ declare const messages: {
|
|
|
151
149
|
detailView: string;
|
|
152
150
|
shortView: string;
|
|
153
151
|
sharedFolder: {
|
|
152
|
+
folderCopied: string;
|
|
154
153
|
info: string;
|
|
155
154
|
firstShared: string;
|
|
156
155
|
learningpathUnsupported: string;
|
|
@@ -1032,8 +1032,6 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1032
1032
|
loggedInAsButton: 'You are logged in as {{role}}',
|
|
1033
1033
|
role: {
|
|
1034
1034
|
employee: 'Employee',
|
|
1035
|
-
faculty: 'Employee',
|
|
1036
|
-
staff: 'Employee',
|
|
1037
1035
|
student: 'Student'
|
|
1038
1036
|
},
|
|
1039
1037
|
buttonLogIn: 'Log in with Feide',
|
|
@@ -1154,6 +1152,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1154
1152
|
detailView: 'Detailed listview',
|
|
1155
1153
|
shortView: 'Card view',
|
|
1156
1154
|
sharedFolder: {
|
|
1155
|
+
folderCopied: 'The folder was copied.',
|
|
1157
1156
|
info: 'This folder contains learning resources and tasks from NDLA, gathered by a teacher.',
|
|
1158
1157
|
firstShared: 'The folder was shared for the first time {{date}}',
|
|
1159
1158
|
learningpathUnsupported: 'Learning paths and multidisciplinary cases cannot be shown directly in a shared folder. You can open the learning path in a new tab by clicking the link in the navigation menu to the left.',
|
|
@@ -29,8 +29,6 @@ declare const messages: {
|
|
|
29
29
|
loggedInAsButton: string;
|
|
30
30
|
role: {
|
|
31
31
|
employee: string;
|
|
32
|
-
faculty: string;
|
|
33
|
-
staff: string;
|
|
34
32
|
student: string;
|
|
35
33
|
};
|
|
36
34
|
buttonLogIn: string;
|
|
@@ -151,6 +149,7 @@ declare const messages: {
|
|
|
151
149
|
detailView: string;
|
|
152
150
|
shortView: string;
|
|
153
151
|
sharedFolder: {
|
|
152
|
+
folderCopied: string;
|
|
154
153
|
info: string;
|
|
155
154
|
firstShared: string;
|
|
156
155
|
learningpathUnsupported: string;
|
|
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1030
1030
|
loggedInAsButton: 'Du er pålogget som {{role}}',
|
|
1031
1031
|
role: {
|
|
1032
1032
|
employee: 'ansatt',
|
|
1033
|
-
faculty: 'ansatt',
|
|
1034
|
-
staff: 'ansatt',
|
|
1035
1033
|
student: 'elev'
|
|
1036
1034
|
},
|
|
1037
1035
|
buttonLogIn: 'Logg inn med Feide',
|
|
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1152
1150
|
detailView: 'Detaljert listevisning',
|
|
1153
1151
|
shortView: 'Kort visning',
|
|
1154
1152
|
sharedFolder: {
|
|
1153
|
+
folderCopied: 'Mappen har blitt kopiert.',
|
|
1155
1154
|
info: 'Denne mappa inneholder fagstoff og oppgaver fra NDLA, samlet av en lærer. ',
|
|
1156
1155
|
firstShared: 'Mappa ble delt første gang {{date}}',
|
|
1157
1156
|
learningpathUnsupported: 'Læringsstier og tverrfaglige caser kan ikke vises direkte i delte mapper. Dersom du trykker på lenka i navigasjonsmenyen til venstre, vil stien åpnes i en ny fane.',
|
|
@@ -29,8 +29,6 @@ declare const messages: {
|
|
|
29
29
|
loggedInAsButton: string;
|
|
30
30
|
role: {
|
|
31
31
|
employee: string;
|
|
32
|
-
faculty: string;
|
|
33
|
-
staff: string;
|
|
34
32
|
student: string;
|
|
35
33
|
};
|
|
36
34
|
buttonLogIn: string;
|
|
@@ -151,6 +149,7 @@ declare const messages: {
|
|
|
151
149
|
detailView: string;
|
|
152
150
|
shortView: string;
|
|
153
151
|
sharedFolder: {
|
|
152
|
+
folderCopied: string;
|
|
154
153
|
info: string;
|
|
155
154
|
firstShared: string;
|
|
156
155
|
drawerButton: string;
|
|
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1030
1030
|
loggedInAsButton: 'Du er pålogga som {{role}}',
|
|
1031
1031
|
role: {
|
|
1032
1032
|
employee: 'tilsett',
|
|
1033
|
-
faculty: 'tilsett',
|
|
1034
|
-
staff: 'tilsett',
|
|
1035
1033
|
student: 'elev'
|
|
1036
1034
|
},
|
|
1037
1035
|
buttonLogIn: 'Logg inn med Feide',
|
|
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1152
1150
|
detailView: 'Detaljert listevisning',
|
|
1153
1151
|
shortView: 'Kortvisning',
|
|
1154
1152
|
sharedFolder: {
|
|
1153
|
+
folderCopied: 'Mappa vart kopiert.',
|
|
1155
1154
|
info: 'Denne mappa inneheld fagstoff og oppgåver frå NDLA, samla av ein lærar.',
|
|
1156
1155
|
firstShared: 'Mappa vart delt første gong {{date}}',
|
|
1157
1156
|
drawerButton: 'Vis mapper og ressursar',
|
|
@@ -29,8 +29,6 @@ declare const messages: {
|
|
|
29
29
|
loggedInAsButton: string;
|
|
30
30
|
role: {
|
|
31
31
|
employee: string;
|
|
32
|
-
faculty: string;
|
|
33
|
-
staff: string;
|
|
34
32
|
student: string;
|
|
35
33
|
};
|
|
36
34
|
buttonLogIn: string;
|
|
@@ -151,6 +149,7 @@ declare const messages: {
|
|
|
151
149
|
detailView: string;
|
|
152
150
|
shortView: string;
|
|
153
151
|
sharedFolder: {
|
|
152
|
+
folderCopied: string;
|
|
154
153
|
info: string;
|
|
155
154
|
firstShared: string;
|
|
156
155
|
drawerButton: string;
|
|
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1030
1030
|
loggedInAsButton: 'Don leat sisaloggejuvvon {{role}}',
|
|
1031
1031
|
role: {
|
|
1032
1032
|
employee: 'bargi',
|
|
1033
|
-
faculty: 'bargi',
|
|
1034
|
-
staff: 'bargi',
|
|
1035
1033
|
student: 'oahppi'
|
|
1036
1034
|
},
|
|
1037
1035
|
buttonLogIn: 'Logge sisa Feide bokte',
|
|
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1152
1150
|
detailView: 'Bienalaš oppalašlistu',
|
|
1153
1151
|
shortView: 'Oanehis listu',
|
|
1154
1152
|
sharedFolder: {
|
|
1153
|
+
folderCopied: 'Mappen har blitt kopiert.',
|
|
1155
1154
|
info: 'Dán máhpas lea NDLA fágasisdoallu ja bargobihtát, čohkkejuvvon oahpaheaddjis.',
|
|
1156
1155
|
firstShared: 'Máhppa juogaduvvui vuosttaš geardde {{date}}',
|
|
1157
1156
|
drawerButton: 'Čájet máhpaid ja resurssaid',
|
|
@@ -29,8 +29,6 @@ declare const messages: {
|
|
|
29
29
|
loggedInAsButton: string;
|
|
30
30
|
role: {
|
|
31
31
|
employee: string;
|
|
32
|
-
faculty: string;
|
|
33
|
-
staff: string;
|
|
34
32
|
student: string;
|
|
35
33
|
};
|
|
36
34
|
buttonLogIn: string;
|
|
@@ -151,6 +149,7 @@ declare const messages: {
|
|
|
151
149
|
detailView: string;
|
|
152
150
|
shortView: string;
|
|
153
151
|
sharedFolder: {
|
|
152
|
+
folderCopied: string;
|
|
154
153
|
info: string;
|
|
155
154
|
firstShared: string;
|
|
156
155
|
drawerButton: string;
|
|
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1030
1030
|
loggedInAsButton: 'Datne tjaangeme goh {{role}}',
|
|
1031
1031
|
role: {
|
|
1032
1032
|
employee: 'barkije',
|
|
1033
|
-
faculty: 'barkije',
|
|
1034
|
-
staff: 'barkije',
|
|
1035
1033
|
student: 'learohke'
|
|
1036
1034
|
},
|
|
1037
1035
|
buttonLogIn: 'Tjaangh Feidine',
|
|
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1152
1150
|
detailView: 'Detaljert listevisning',
|
|
1153
1151
|
shortView: 'Kort visning',
|
|
1154
1152
|
sharedFolder: {
|
|
1153
|
+
folderCopied: 'Mappen har blitt kopiert.',
|
|
1155
1154
|
info: 'Denne mappa inneheld fagstoff og oppgåver frå NDLA, samla av ein lærar.',
|
|
1156
1155
|
firstShared: 'Mappa vart delt første gong {{date}}',
|
|
1157
1156
|
drawerButton: 'Vis mapper og ressursar',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "44.0.
|
|
3
|
+
"version": "44.0.13",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/accordion": "^2.2.
|
|
34
|
+
"@ndla/accordion": "^2.2.20",
|
|
35
35
|
"@ndla/article-scripts": "^3.0.20",
|
|
36
|
-
"@ndla/button": "^11.0.
|
|
37
|
-
"@ndla/carousel": "^3.1.
|
|
38
|
-
"@ndla/core": "^4.1.
|
|
39
|
-
"@ndla/dropdown-menu": "^1.0.
|
|
40
|
-
"@ndla/forms": "^4.3.
|
|
36
|
+
"@ndla/button": "^11.0.5",
|
|
37
|
+
"@ndla/carousel": "^3.1.15",
|
|
38
|
+
"@ndla/core": "^4.1.6",
|
|
39
|
+
"@ndla/dropdown-menu": "^1.0.4",
|
|
40
|
+
"@ndla/forms": "^4.3.20",
|
|
41
41
|
"@ndla/hooks": "^2.0.9",
|
|
42
|
-
"@ndla/icons": "^4.0.
|
|
42
|
+
"@ndla/icons": "^4.0.5",
|
|
43
43
|
"@ndla/licenses": "^7.1.3",
|
|
44
|
-
"@ndla/modal": "^4.0.
|
|
45
|
-
"@ndla/notion": "^5.0.
|
|
46
|
-
"@ndla/safelink": "^4.1.
|
|
47
|
-
"@ndla/select": "^2.4.
|
|
48
|
-
"@ndla/switch": "^1.1.
|
|
49
|
-
"@ndla/tabs": "^3.0.
|
|
50
|
-
"@ndla/tooltip": "^4.1.
|
|
44
|
+
"@ndla/modal": "^4.0.4",
|
|
45
|
+
"@ndla/notion": "^5.0.19",
|
|
46
|
+
"@ndla/safelink": "^4.1.19",
|
|
47
|
+
"@ndla/select": "^2.4.11",
|
|
48
|
+
"@ndla/switch": "^1.1.11",
|
|
49
|
+
"@ndla/tabs": "^3.0.7",
|
|
50
|
+
"@ndla/tooltip": "^4.1.17",
|
|
51
51
|
"@ndla/util": "^3.1.15",
|
|
52
52
|
"@radix-ui/react-popover": "^1.0.6",
|
|
53
53
|
"@radix-ui/react-slider": "^1.1.2",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "385f883c00df1b1a5818d687cb27373981783ec6"
|
|
87
87
|
}
|
|
@@ -139,7 +139,6 @@ const ArticleByline = ({
|
|
|
139
139
|
const license = getLicenseByAbbreviation(licenseString, locale);
|
|
140
140
|
|
|
141
141
|
const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
|
|
142
|
-
const showSecondaryContributors = suppliers.length > 0 && authors.length > 0;
|
|
143
142
|
|
|
144
143
|
return (
|
|
145
144
|
<Wrapper>
|
|
@@ -148,12 +147,12 @@ const ArticleByline = ({
|
|
|
148
147
|
<LicenseLink license={license} />
|
|
149
148
|
{showPrimaryContributors && (
|
|
150
149
|
<PrimaryContributorsWrapper>
|
|
151
|
-
{authors.length > 0
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
{authors.length > 0 &&
|
|
151
|
+
`${t('article.authorsLabel', {
|
|
152
|
+
names: renderContributors(authors, t),
|
|
153
|
+
interpolation: { escapeValue: false },
|
|
154
|
+
})}. `}
|
|
155
|
+
{getSuppliersText(suppliers, t)}
|
|
157
156
|
</PrimaryContributorsWrapper>
|
|
158
157
|
)}
|
|
159
158
|
</LicenseWrapper>
|
|
@@ -161,7 +160,6 @@ const ArticleByline = ({
|
|
|
161
160
|
{t('article.lastUpdated')} {published}
|
|
162
161
|
</div>
|
|
163
162
|
</TextWrapper>
|
|
164
|
-
{showSecondaryContributors && <TextWrapper>{getSuppliersText(suppliers, t)}</TextWrapper>}
|
|
165
163
|
<AccordionRoot type="multiple" onValueChange={setOpenAccordions} value={openAccordions}>
|
|
166
164
|
{licenseBox && (
|
|
167
165
|
<AccordionItem value="rulesForUse">
|
|
@@ -34,6 +34,7 @@ const StyledSafeLink = styled(SafeLink)`
|
|
|
34
34
|
align-items: center;
|
|
35
35
|
box-shadow: none;
|
|
36
36
|
color: inherit;
|
|
37
|
+
background-color: ${colors.white};
|
|
37
38
|
border: 1px solid ${colors.brand.lighter};
|
|
38
39
|
padding: ${spacing.normal};
|
|
39
40
|
${mq.range({ from: breakpoints.tabletWide })} {
|
|
@@ -13,52 +13,20 @@ import { ReactNode } from 'react';
|
|
|
13
13
|
import { MessageBanner } from '../Messages';
|
|
14
14
|
import SkipToMainContent from './SkipToMainContent';
|
|
15
15
|
|
|
16
|
-
interface MastheadItemProps {
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
right?: boolean;
|
|
19
|
-
left?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const LeftMastheadItem = styled.div`
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
button {
|
|
26
|
-
white-space: nowrap;
|
|
27
|
-
}
|
|
28
|
-
> div:last-child {
|
|
29
|
-
flex-grow: 1;
|
|
30
|
-
}
|
|
31
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
32
|
-
flex-grow: 1;
|
|
33
|
-
text-align: left;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const RightMastheadItem = styled.div`
|
|
38
|
-
display: flex;
|
|
39
|
-
gap: ${spacing.small};
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: flex-end;
|
|
42
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
43
|
-
padding: ${spacing.small} 0;
|
|
44
|
-
padding: 0;
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
export const MastheadItem = ({ children, left = false, right = false }: MastheadItemProps) => {
|
|
49
|
-
const Wrapper = left ? LeftMastheadItem : right ? RightMastheadItem : 'div';
|
|
50
|
-
return <Wrapper>{children}</Wrapper>;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
16
|
const MastheadContent = styled.div`
|
|
54
17
|
justify-content: center;
|
|
55
18
|
align-items: center;
|
|
56
19
|
text-align: center;
|
|
57
|
-
padding: ${spacing.small};
|
|
20
|
+
padding: ${spacing.small} ${spacing.normal};
|
|
58
21
|
font-weight: ${fonts.weight.normal};
|
|
59
22
|
display: flex;
|
|
60
23
|
height: 84px;
|
|
61
24
|
justify-content: space-between;
|
|
25
|
+
gap: ${spacing.xsmall};
|
|
26
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
27
|
+
padding: ${spacing.small};
|
|
28
|
+
gap: ${spacing.xsmall};
|
|
29
|
+
}
|
|
62
30
|
`;
|
|
63
31
|
|
|
64
32
|
interface StyledMastheadProps {
|
|
@@ -10,7 +10,6 @@ import ToggleSearchButton from '../Search/ToggleSearchButton';
|
|
|
10
10
|
interface Props {
|
|
11
11
|
onClose: VoidFunction;
|
|
12
12
|
children: (arg: () => void) => ReactNode;
|
|
13
|
-
hideOnNarrowScreen?: boolean;
|
|
14
13
|
ndlaFilm?: boolean;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -60,7 +59,7 @@ const StyledHeader = styled.div`
|
|
|
60
59
|
}
|
|
61
60
|
`;
|
|
62
61
|
|
|
63
|
-
const MastheadSearchModal = ({ onClose: onSearchClose, children,
|
|
62
|
+
const MastheadSearchModal = ({ onClose: onSearchClose, children, ndlaFilm }: Props) => {
|
|
64
63
|
const { t } = useTranslation();
|
|
65
64
|
const [isOpen, setIsOpen] = useState(false);
|
|
66
65
|
|
|
@@ -72,7 +71,7 @@ const MastheadSearchModal = ({ onClose: onSearchClose, children, hideOnNarrowScr
|
|
|
72
71
|
return (
|
|
73
72
|
<Modal open={isOpen} onOpenChange={setIsOpen}>
|
|
74
73
|
<ModalTrigger>
|
|
75
|
-
<ToggleSearchButton
|
|
74
|
+
<ToggleSearchButton onClick={() => setIsOpen(true)} ndlaFilm={ndlaFilm}>
|
|
76
75
|
{t('masthead.menu.search')}
|
|
77
76
|
</ToggleSearchButton>
|
|
78
77
|
</ModalTrigger>
|
package/src/Masthead/index.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import Masthead
|
|
9
|
+
import Masthead from './Masthead';
|
|
10
10
|
|
|
11
11
|
import { getMastheadHeight, useMastheadHeight } from './utils';
|
|
12
12
|
import { default as SkipToMainContent } from './SkipToMainContent';
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { getMastheadHeight, useMastheadHeight, SkipToMainContent };
|
|
15
15
|
|
|
16
16
|
export default Masthead;
|
|
@@ -7,48 +7,37 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef } from 'react';
|
|
10
|
-
import { spacing,
|
|
10
|
+
import { spacing, breakpoints, mq, misc, fonts, colors } from '@ndla/core';
|
|
11
11
|
import { Search } from '@ndla/icons/common';
|
|
12
12
|
import { ButtonProps, ButtonV2 } from '@ndla/button';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
|
|
15
15
|
interface Props extends ButtonProps {
|
|
16
|
-
hideOnNarrowScreen?: boolean;
|
|
17
|
-
hideOnWideScreen?: boolean;
|
|
18
16
|
ndlaFilm?: boolean;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
hideOnNarrowScreen?: boolean;
|
|
23
|
-
hideOnWideScreen?: boolean;
|
|
24
|
-
ndlaFilm?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const props = ['hideOnNarrowScreen', 'hideOnWideScreen', 'ndlaFilm'];
|
|
28
|
-
|
|
29
|
-
const shouldForwardProp = (p: string) => !props.includes(p);
|
|
30
|
-
|
|
31
|
-
const StyledButton = styled(ButtonV2, { shouldForwardProp })<StyledButtonProps>`
|
|
32
|
-
background: ${(p) => (p.ndlaFilm ? colors.ndlaFilm.filmColorBright : colors.brand.greyLighter)};
|
|
19
|
+
const StyledButton = styled(ButtonV2)`
|
|
33
20
|
border-radius: ${misc.borderRadius};
|
|
34
21
|
border: 0;
|
|
35
|
-
|
|
36
|
-
color: ${(p) => (p.ndlaFilm ? '#fff' : colors.brand.primary)};
|
|
37
|
-
padding: ${spacing.small} ${spacingUnit * 0.75}px ${spacing.small} ${spacing.normal};
|
|
22
|
+
color: ${colors.brand.primary};
|
|
38
23
|
align-items: center;
|
|
39
|
-
|
|
24
|
+
background: transparent;
|
|
40
25
|
|
|
41
|
-
|
|
26
|
+
svg {
|
|
42
27
|
height: 24px;
|
|
43
28
|
width: 24px;
|
|
44
29
|
}
|
|
45
30
|
|
|
46
31
|
${fonts.sizes('16px', '32px')};
|
|
47
32
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
&[data-film='true'] {
|
|
34
|
+
background: ${colors.ndlaFilm.filmColorBright};
|
|
35
|
+
color: ${colors.white};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${mq.range({ from: breakpoints.tabletWide })} {
|
|
51
39
|
padding: ${spacing.small} ${spacing.normal};
|
|
40
|
+
background: ${colors.brand.greyLighter};
|
|
52
41
|
}
|
|
53
42
|
&:hover,
|
|
54
43
|
&:focus,
|
|
@@ -60,22 +49,16 @@ const StyledButton = styled(ButtonV2, { shouldForwardProp })<StyledButtonProps>`
|
|
|
60
49
|
const StyledSpan = styled.span`
|
|
61
50
|
margin-right: ${spacing.normal};
|
|
62
51
|
font-weight: ${fonts.weight.normal};
|
|
52
|
+
${mq.range({ until: breakpoints.tabletWide })} {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
63
55
|
`;
|
|
64
56
|
|
|
65
|
-
const ToggleSearchButton = forwardRef<HTMLButtonElement, Props>(
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
type="button"
|
|
72
|
-
ref={ref}
|
|
73
|
-
{...rest}
|
|
74
|
-
>
|
|
75
|
-
<StyledSpan>{children}</StyledSpan>
|
|
76
|
-
<Search />
|
|
77
|
-
</StyledButton>
|
|
78
|
-
),
|
|
79
|
-
);
|
|
57
|
+
const ToggleSearchButton = forwardRef<HTMLButtonElement, Props>(({ children, ndlaFilm, ...rest }, ref) => (
|
|
58
|
+
<StyledButton data-film={ndlaFilm} type="button" ref={ref} {...rest}>
|
|
59
|
+
<StyledSpan>{children}</StyledSpan>
|
|
60
|
+
<Search />
|
|
61
|
+
</StyledButton>
|
|
62
|
+
));
|
|
80
63
|
|
|
81
64
|
export default ToggleSearchButton;
|