@ndla/ui 50.5.0 → 50.5.2
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/Aside/Aside.js +55 -17
- package/es/ContentTypeBadge/ContentTypeBadge.js +162 -83
- package/es/FramedContent/FramedContent.js +7 -11
- package/es/ResourceGroup/ResourceItem.js +9 -9
- package/es/SearchTypeResult/components/ItemResourceHeader.js +6 -6
- package/es/SearchTypeResult/components/ItemTopicHeader.js +4 -4
- package/es/all.css +1 -1
- package/es/locale/messages-en.js +8 -4
- package/es/locale/messages-nb.js +8 -4
- package/es/locale/messages-nn.js +8 -4
- package/es/locale/messages-se.js +8 -4
- package/es/locale/messages-sma.js +8 -4
- package/lib/Aside/Aside.d.ts +3 -7
- package/lib/Aside/Aside.js +55 -19
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +3 -2
- package/lib/ContentTypeBadge/ContentTypeBadge.js +162 -85
- package/lib/FramedContent/FramedContent.d.ts +1 -1
- package/lib/FramedContent/FramedContent.js +8 -11
- package/lib/ResourceGroup/ResourceItem.js +9 -9
- package/lib/SearchTypeResult/components/ItemResourceHeader.js +6 -6
- package/lib/SearchTypeResult/components/ItemTopicHeader.js +4 -4
- package/lib/all.css +1 -1
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +8 -4
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +8 -4
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +8 -4
- package/lib/locale/messages-se.d.ts +4 -0
- package/lib/locale/messages-se.js +8 -4
- package/lib/locale/messages-sma.d.ts +4 -0
- package/lib/locale/messages-sma.js +8 -4
- package/package.json +2 -2
- package/src/Article/component.article.scss +1 -1
- package/src/Aside/Aside.tsx +95 -30
- package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +81 -0
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +169 -71
- package/src/FramedContent/FramedContent.tsx +37 -14
- package/src/ResourceGroup/ResourceItem.tsx +5 -5
- package/src/SearchTypeResult/components/ItemResourceHeader.tsx +1 -1
- package/src/SearchTypeResult/components/ItemTopicHeader.tsx +1 -1
- package/src/locale/messages-en.ts +7 -4
- package/src/locale/messages-nb.ts +7 -4
- package/src/locale/messages-nn.ts +7 -4
- package/src/locale/messages-se.ts +7 -4
- package/src/locale/messages-sma.ts +7 -4
- package/src/main.scss +0 -3
- package/src/Aside/component.aside.scss +0 -91
- package/src/ContentTypeBadge/component.content-type-badge.scss +0 -223
- package/src/global/components/component.bodybox.scss +0 -60
|
@@ -942,6 +942,7 @@ declare const messages: {
|
|
|
942
942
|
category: {
|
|
943
943
|
title: string;
|
|
944
944
|
posts: string;
|
|
945
|
+
posts_plural: string;
|
|
945
946
|
};
|
|
946
947
|
new: {
|
|
947
948
|
post: string;
|
|
@@ -975,10 +976,12 @@ declare const messages: {
|
|
|
975
976
|
topic: {
|
|
976
977
|
isDeleted: string;
|
|
977
978
|
responses: string;
|
|
979
|
+
responses_plural: string;
|
|
978
980
|
topicContent: string;
|
|
979
981
|
fetchMore: string;
|
|
980
982
|
};
|
|
981
983
|
posts: {
|
|
984
|
+
title: string;
|
|
982
985
|
notify: string;
|
|
983
986
|
dropdownMenu: {
|
|
984
987
|
report: string;
|
|
@@ -986,6 +989,7 @@ declare const messages: {
|
|
|
986
989
|
delete: string;
|
|
987
990
|
};
|
|
988
991
|
fetchMore: string;
|
|
992
|
+
deleted: string;
|
|
989
993
|
};
|
|
990
994
|
flag: {
|
|
991
995
|
title: string;
|
|
@@ -960,7 +960,8 @@ const messages = {
|
|
|
960
960
|
title: 'Arena',
|
|
961
961
|
category: {
|
|
962
962
|
title: 'Categories',
|
|
963
|
-
posts: '
|
|
963
|
+
posts: 'post',
|
|
964
|
+
posts_plural: 'posts'
|
|
964
965
|
},
|
|
965
966
|
new: {
|
|
966
967
|
post: 'Write a reply',
|
|
@@ -993,18 +994,21 @@ const messages = {
|
|
|
993
994
|
publish: 'Publish',
|
|
994
995
|
topic: {
|
|
995
996
|
isDeleted: 'The topic has been deleted and can not be displayed.',
|
|
996
|
-
responses: '
|
|
997
|
+
responses: 'response',
|
|
998
|
+
responses_plural: 'responses',
|
|
997
999
|
topicContent: 'Write your topic here',
|
|
998
1000
|
fetchMore: 'Fetch more topics'
|
|
999
1001
|
},
|
|
1000
1002
|
posts: {
|
|
1003
|
+
title: 'Posts',
|
|
1001
1004
|
notify: 'Get notified of new answers',
|
|
1002
1005
|
dropdownMenu: {
|
|
1003
1006
|
report: 'Report post to moderator',
|
|
1004
1007
|
edit: 'Edit post',
|
|
1005
1008
|
delete: 'Delete post'
|
|
1006
1009
|
},
|
|
1007
|
-
fetchMore: 'Fetch more answers'
|
|
1010
|
+
fetchMore: 'Fetch more answers',
|
|
1011
|
+
deleted: 'This post has been deleted by the author.'
|
|
1008
1012
|
},
|
|
1009
1013
|
flag: {
|
|
1010
1014
|
title: 'Report post / comment',
|
|
@@ -1018,7 +1022,7 @@ const messages = {
|
|
|
1018
1022
|
maxLength: 'The maximum length for the text field is reached',
|
|
1019
1023
|
error: 'The field is required'
|
|
1020
1024
|
},
|
|
1021
|
-
bottomText: 'Are you missing a category?
|
|
1025
|
+
bottomText: 'Are you missing a category? Let our moderator know at moderator@ndla.no',
|
|
1022
1026
|
notification: {
|
|
1023
1027
|
title: 'Notifications',
|
|
1024
1028
|
showAll: 'View all notifications',
|
|
@@ -942,6 +942,7 @@ declare const messages: {
|
|
|
942
942
|
category: {
|
|
943
943
|
title: string;
|
|
944
944
|
posts: string;
|
|
945
|
+
posts_plural: string;
|
|
945
946
|
};
|
|
946
947
|
publish: string;
|
|
947
948
|
new: {
|
|
@@ -975,10 +976,12 @@ declare const messages: {
|
|
|
975
976
|
topic: {
|
|
976
977
|
isDeleted: string;
|
|
977
978
|
responses: string;
|
|
979
|
+
responses_plural: string;
|
|
978
980
|
topicContent: string;
|
|
979
981
|
fetchMore: string;
|
|
980
982
|
};
|
|
981
983
|
posts: {
|
|
984
|
+
title: string;
|
|
982
985
|
notify: string;
|
|
983
986
|
dropdownMenu: {
|
|
984
987
|
report: string;
|
|
@@ -986,6 +989,7 @@ declare const messages: {
|
|
|
986
989
|
delete: string;
|
|
987
990
|
};
|
|
988
991
|
fetchMore: string;
|
|
992
|
+
deleted: string;
|
|
989
993
|
};
|
|
990
994
|
flag: {
|
|
991
995
|
title: string;
|
|
@@ -960,7 +960,8 @@ const messages = {
|
|
|
960
960
|
title: 'Arena',
|
|
961
961
|
category: {
|
|
962
962
|
title: 'Kategorier',
|
|
963
|
-
posts: '
|
|
963
|
+
posts: 'innlegg',
|
|
964
|
+
posts_plural: 'innlegg'
|
|
964
965
|
},
|
|
965
966
|
publish: 'Publiser',
|
|
966
967
|
new: {
|
|
@@ -993,18 +994,21 @@ const messages = {
|
|
|
993
994
|
},
|
|
994
995
|
topic: {
|
|
995
996
|
isDeleted: 'Innlegget har blitt slettet og kan ikke vises.',
|
|
996
|
-
responses: '
|
|
997
|
+
responses: 'svar',
|
|
998
|
+
responses_plural: 'svar',
|
|
997
999
|
topicContent: 'Skriv innlegget ditt her',
|
|
998
1000
|
fetchMore: 'Hent flere innlegg'
|
|
999
1001
|
},
|
|
1000
1002
|
posts: {
|
|
1003
|
+
title: 'Innlegg',
|
|
1001
1004
|
notify: 'Få varsel om nye svar',
|
|
1002
1005
|
dropdownMenu: {
|
|
1003
1006
|
report: 'Rapporter innlegg til moderator',
|
|
1004
1007
|
edit: 'Rediger innlegg',
|
|
1005
1008
|
delete: 'Slett innlegget'
|
|
1006
1009
|
},
|
|
1007
|
-
fetchMore: 'Hent flere svar'
|
|
1010
|
+
fetchMore: 'Hent flere svar',
|
|
1011
|
+
deleted: 'Dette innlegget er slettet av forfatteren.'
|
|
1008
1012
|
},
|
|
1009
1013
|
flag: {
|
|
1010
1014
|
title: 'Rapporter innlegg / kommentar',
|
|
@@ -1018,7 +1022,7 @@ const messages = {
|
|
|
1018
1022
|
maxLength: 'Maksimal lengde for tekstfeltet er nådd',
|
|
1019
1023
|
error: 'Feltet er påkrevd'
|
|
1020
1024
|
},
|
|
1021
|
-
bottomText: 'Savner du en kategori?
|
|
1025
|
+
bottomText: 'Savner du en kategori? Gi vår moderator beskjed på moderator@ndla.no',
|
|
1022
1026
|
notification: {
|
|
1023
1027
|
title: 'Varslinger',
|
|
1024
1028
|
showAll: 'Se alle varslinger',
|
|
@@ -942,6 +942,7 @@ declare const messages: {
|
|
|
942
942
|
category: {
|
|
943
943
|
title: string;
|
|
944
944
|
posts: string;
|
|
945
|
+
posts_plural: string;
|
|
945
946
|
};
|
|
946
947
|
publish: string;
|
|
947
948
|
new: {
|
|
@@ -967,6 +968,7 @@ declare const messages: {
|
|
|
967
968
|
topic: {
|
|
968
969
|
isDeleted: string;
|
|
969
970
|
responses: string;
|
|
971
|
+
responses_plural: string;
|
|
970
972
|
topicContent: string;
|
|
971
973
|
fetchMore: string;
|
|
972
974
|
};
|
|
@@ -979,6 +981,7 @@ declare const messages: {
|
|
|
979
981
|
topic: string;
|
|
980
982
|
};
|
|
981
983
|
posts: {
|
|
984
|
+
title: string;
|
|
982
985
|
notify: string;
|
|
983
986
|
dropdownMenu: {
|
|
984
987
|
report: string;
|
|
@@ -986,6 +989,7 @@ declare const messages: {
|
|
|
986
989
|
delete: string;
|
|
987
990
|
};
|
|
988
991
|
fetchMore: string;
|
|
992
|
+
deleted: string;
|
|
989
993
|
};
|
|
990
994
|
flag: {
|
|
991
995
|
title: string;
|
|
@@ -960,7 +960,8 @@ const messages = {
|
|
|
960
960
|
title: 'Arena',
|
|
961
961
|
category: {
|
|
962
962
|
title: 'Kategoriar',
|
|
963
|
-
posts: '
|
|
963
|
+
posts: 'innlegg',
|
|
964
|
+
posts_plural: 'innlegg'
|
|
964
965
|
},
|
|
965
966
|
publish: 'Publiser',
|
|
966
967
|
new: {
|
|
@@ -985,7 +986,8 @@ const messages = {
|
|
|
985
986
|
},
|
|
986
987
|
topic: {
|
|
987
988
|
isDeleted: 'Innlegget har vorte sletta og kan ikkje visast.',
|
|
988
|
-
responses: '
|
|
989
|
+
responses: 'svar',
|
|
990
|
+
responses_plural: 'svar',
|
|
989
991
|
topicContent: 'Skriv innlegget ditt her',
|
|
990
992
|
fetchMore: 'Hent fleire innlegg'
|
|
991
993
|
},
|
|
@@ -998,13 +1000,15 @@ const messages = {
|
|
|
998
1000
|
topic: 'Innlegget har blitt oppdatert.'
|
|
999
1001
|
},
|
|
1000
1002
|
posts: {
|
|
1003
|
+
title: 'Innlegg',
|
|
1001
1004
|
notify: 'Få varsel om nye svar',
|
|
1002
1005
|
dropdownMenu: {
|
|
1003
1006
|
report: 'Rapporter innlegg til moderator',
|
|
1004
1007
|
edit: 'Rediger innlegg',
|
|
1005
1008
|
delete: 'Slett innlegget'
|
|
1006
1009
|
},
|
|
1007
|
-
fetchMore: 'Hent fleire svar'
|
|
1010
|
+
fetchMore: 'Hent fleire svar',
|
|
1011
|
+
deleted: 'Dette innlegget er sletta av forfatteren.'
|
|
1008
1012
|
},
|
|
1009
1013
|
flag: {
|
|
1010
1014
|
title: 'Rapporter innlegg / kommentar',
|
|
@@ -1018,7 +1022,7 @@ const messages = {
|
|
|
1018
1022
|
maxLength: 'Maksimal lengd for tekstfeltet er nådd',
|
|
1019
1023
|
error: 'Feltet er påkravd'
|
|
1020
1024
|
},
|
|
1021
|
-
bottomText: 'Saknar du ein kategori?
|
|
1025
|
+
bottomText: 'Saknar du ein kategori? Gi moderatoren vår beskjed på moderator@ndla.no',
|
|
1022
1026
|
notification: {
|
|
1023
1027
|
title: 'Varslingar',
|
|
1024
1028
|
showAll: 'Sjå alle varslingar',
|
|
@@ -942,6 +942,7 @@ declare const messages: {
|
|
|
942
942
|
category: {
|
|
943
943
|
title: string;
|
|
944
944
|
posts: string;
|
|
945
|
+
posts_plural: string;
|
|
945
946
|
};
|
|
946
947
|
publish: string;
|
|
947
948
|
new: {
|
|
@@ -975,10 +976,12 @@ declare const messages: {
|
|
|
975
976
|
topic: {
|
|
976
977
|
isDeleted: string;
|
|
977
978
|
responses: string;
|
|
979
|
+
responses_plural: string;
|
|
978
980
|
topicContent: string;
|
|
979
981
|
fetchMore: string;
|
|
980
982
|
};
|
|
981
983
|
posts: {
|
|
984
|
+
title: string;
|
|
982
985
|
notify: string;
|
|
983
986
|
dropdownMenu: {
|
|
984
987
|
report: string;
|
|
@@ -986,6 +989,7 @@ declare const messages: {
|
|
|
986
989
|
delete: string;
|
|
987
990
|
};
|
|
988
991
|
fetchMore: string;
|
|
992
|
+
deleted: string;
|
|
989
993
|
};
|
|
990
994
|
flag: {
|
|
991
995
|
title: string;
|
|
@@ -960,7 +960,8 @@ const messages = {
|
|
|
960
960
|
title: 'Arena',
|
|
961
961
|
category: {
|
|
962
962
|
title: 'Lágit',
|
|
963
|
-
posts: '
|
|
963
|
+
posts: 'sáhkavuorru',
|
|
964
|
+
posts_plural: 'sáhkavuorru'
|
|
964
965
|
},
|
|
965
966
|
publish: 'Almmuheaddji',
|
|
966
967
|
new: {
|
|
@@ -993,18 +994,21 @@ const messages = {
|
|
|
993
994
|
},
|
|
994
995
|
topic: {
|
|
995
996
|
isDeleted: 'Čálus lea sihkojuvvon iige sáhte čájehuvvot.',
|
|
996
|
-
responses: '
|
|
997
|
+
responses: 'vástidan',
|
|
998
|
+
responses_plural: 'vástidan',
|
|
997
999
|
topicContent: 'Čále sáhkavuoru dása',
|
|
998
1000
|
fetchMore: 'Viečča eanet čállosiid'
|
|
999
1001
|
},
|
|
1000
1002
|
posts: {
|
|
1003
|
+
title: 'Sáhkavuorru',
|
|
1001
1004
|
notify: 'Oaččo dieđu ođđa vástádusaid birra',
|
|
1002
1005
|
dropdownMenu: {
|
|
1003
1006
|
report: 'Raportere čállosa moderatorii',
|
|
1004
1007
|
edit: 'Doaimmat čállosa',
|
|
1005
1008
|
delete: 'Sihko čállosa'
|
|
1006
1009
|
},
|
|
1007
|
-
fetchMore: 'Viečča eanet vástádusaid'
|
|
1010
|
+
fetchMore: 'Viečča eanet vástádusaid',
|
|
1011
|
+
deleted: 'Čálli lea sihkon dán sáhkavuoru.'
|
|
1008
1012
|
},
|
|
1009
1013
|
flag: {
|
|
1010
1014
|
title: 'Rapportere čállosa / kommentára',
|
|
@@ -1018,7 +1022,7 @@ const messages = {
|
|
|
1018
1022
|
maxLength: 'Teakstagieddeguhkkodat lea joavdan',
|
|
1019
1023
|
error: 'Fealta gáibiduvvo'
|
|
1020
1024
|
},
|
|
1021
|
-
bottomText: 'Váillahat go ovtta lági?
|
|
1025
|
+
bottomText: 'Váillahat go ovtta lági? Atte min moderatora dieđu dása moderator@ndla.no',
|
|
1022
1026
|
notification: {
|
|
1023
1027
|
title: 'Muittuhusat',
|
|
1024
1028
|
showAll: 'Čájet buot dieđuid',
|
|
@@ -942,6 +942,7 @@ declare const messages: {
|
|
|
942
942
|
category: {
|
|
943
943
|
title: string;
|
|
944
944
|
posts: string;
|
|
945
|
+
posts_plural: string;
|
|
945
946
|
};
|
|
946
947
|
publish: string;
|
|
947
948
|
new: {
|
|
@@ -975,10 +976,12 @@ declare const messages: {
|
|
|
975
976
|
topic: {
|
|
976
977
|
isDeleted: string;
|
|
977
978
|
responses: string;
|
|
979
|
+
responses_plural: string;
|
|
978
980
|
topicContent: string;
|
|
979
981
|
fetchMore: string;
|
|
980
982
|
};
|
|
981
983
|
posts: {
|
|
984
|
+
title: string;
|
|
982
985
|
notify: string;
|
|
983
986
|
dropdownMenu: {
|
|
984
987
|
report: string;
|
|
@@ -986,6 +989,7 @@ declare const messages: {
|
|
|
986
989
|
delete: string;
|
|
987
990
|
};
|
|
988
991
|
fetchMore: string;
|
|
992
|
+
deleted: string;
|
|
989
993
|
};
|
|
990
994
|
flag: {
|
|
991
995
|
title: string;
|
|
@@ -960,7 +960,8 @@ const messages = {
|
|
|
960
960
|
title: 'Sijjie',
|
|
961
961
|
category: {
|
|
962
962
|
title: 'Lïhtsh',
|
|
963
|
-
posts: '
|
|
963
|
+
posts: 'håaleme',
|
|
964
|
+
posts_plural: 'håaleme'
|
|
964
965
|
},
|
|
965
966
|
publish: 'Bæjhkoehtidh',
|
|
966
967
|
new: {
|
|
@@ -993,18 +994,21 @@ const messages = {
|
|
|
993
994
|
},
|
|
994
995
|
topic: {
|
|
995
996
|
isDeleted: 'Tjaalege lea sliejhteme jïh ij maehtieh dam vuesiehtidh.',
|
|
996
|
-
responses: '
|
|
997
|
+
responses: 'vaestiedasse',
|
|
998
|
+
responses_plural: 'vaestiedasse',
|
|
997
999
|
topicContent: 'Tjaelieh dov håalemem daesnie',
|
|
998
1000
|
fetchMore: 'Veedtjh jienebh saadtegh'
|
|
999
1001
|
},
|
|
1000
1002
|
posts: {
|
|
1003
|
+
title: 'Håaleme',
|
|
1001
1004
|
notify: 'Bïeljelh mejtie orre vaestiedassh',
|
|
1002
1005
|
dropdownMenu: {
|
|
1003
1006
|
report: 'Reekth håalemem moderatovrese',
|
|
1004
1007
|
edit: 'Jarkelimmie håalemistie',
|
|
1005
1008
|
delete: 'Slett innlegget'
|
|
1006
1009
|
},
|
|
1007
|
-
fetchMore: 'Jienebh vaestiedassh veedtjedh'
|
|
1010
|
+
fetchMore: 'Jienebh vaestiedassh veedtjedh',
|
|
1011
|
+
deleted: 'Daate tjaalege lea tjaalegen tjïrrh sliejhteme.'
|
|
1008
1012
|
},
|
|
1009
1013
|
flag: {
|
|
1010
1014
|
title: 'Påastem reektehtidh / kommentaarem',
|
|
@@ -1018,7 +1022,7 @@ const messages = {
|
|
|
1018
1022
|
maxLength: 'Jeenjemes gåhkoe tjaalegegievleste båateme',
|
|
1019
1023
|
error: 'Bielie daerpies'
|
|
1020
1024
|
},
|
|
1021
|
-
bottomText: 'Akte kategorije datne ohtsedh
|
|
1025
|
+
bottomText: 'Akte kategorije datne ohtsedh? Vedtieh mijjen moderatovrese bieljelimmiem moderatore@ndla.no',
|
|
1022
1026
|
notification: {
|
|
1023
1027
|
title: 'Bïeljelimmie',
|
|
1024
1028
|
showAll: 'Gaajhkh bæjhkoehtimmieh vuartasjidh',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "50.5.
|
|
3
|
+
"version": "50.5.2",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "6f4d9ec848fdae323b8bcb1dd0078599a616bfaa"
|
|
85
85
|
}
|
package/src/Aside/Aside.tsx
CHANGED
|
@@ -6,42 +6,107 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
interface Props {
|
|
18
|
-
dangerouslySetInnerHTML?: {
|
|
19
|
-
__html: string;
|
|
20
|
-
};
|
|
21
|
-
children?: ReactNode;
|
|
9
|
+
import { ComponentProps, useMemo } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import styled from '@emotion/styled';
|
|
12
|
+
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
13
|
+
|
|
14
|
+
interface Props extends ComponentProps<'aside'> {
|
|
22
15
|
narrowScreen?: boolean;
|
|
23
16
|
wideScreen?: boolean;
|
|
24
17
|
alwaysShow?: boolean;
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
const StyledAside = styled.aside`
|
|
21
|
+
position: relative;
|
|
22
|
+
margin: ${spacing.large} 0px;
|
|
23
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
24
|
+
max-width: 350px;
|
|
25
|
+
float: right;
|
|
26
|
+
clear: right;
|
|
27
|
+
width: 50%;
|
|
28
|
+
left: auto !important;
|
|
29
|
+
padding: 0;
|
|
30
|
+
padding-left: ${spacing.small};
|
|
31
|
+
${mq.range({ from: breakpoints.desktop })} {
|
|
32
|
+
width: 75%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
border-left: 4px solid ${colors.background.dark};
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const wideScreenStyle = css`
|
|
40
|
+
display: none;
|
|
41
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const narrowScreenStyle = css`
|
|
47
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const alwaysShowStyle = css`
|
|
53
|
+
display: block !important;
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const StyledAsideContent = styled.div`
|
|
57
|
+
color: ${colors.brand.greyDark};
|
|
58
|
+
padding: ${spacing.normal};
|
|
59
|
+
|
|
60
|
+
& > *:first-child {
|
|
61
|
+
margin-top: 0;
|
|
62
|
+
}
|
|
63
|
+
& > *:last-child {
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
h2,
|
|
68
|
+
h3,
|
|
69
|
+
h4,
|
|
70
|
+
h5 {
|
|
71
|
+
${fonts.size.text.metaText.small};
|
|
72
|
+
margin-top: ${spacing.normal};
|
|
73
|
+
margin-bottom: ${spacing.small};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
& > ul:not([class]),
|
|
77
|
+
:not(li) > ul:not([class]) {
|
|
78
|
+
${mq.range({ from: breakpoints.desktop })} {
|
|
79
|
+
margin-left: ${spacing.normal};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
& > ol:not([class]),
|
|
84
|
+
:not(li) > ol:not([class]) {
|
|
85
|
+
${mq.range({ from: breakpoints.desktop })} {
|
|
86
|
+
margin-left: ${spacing.large};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const Aside = ({ children, narrowScreen = false, wideScreen = false, alwaysShow = false, ...rest }: Props) => {
|
|
92
|
+
const styling = useMemo(() => {
|
|
93
|
+
const styles = [];
|
|
94
|
+
if (narrowScreen) {
|
|
95
|
+
styles.push(narrowScreenStyle);
|
|
96
|
+
}
|
|
97
|
+
if (wideScreen) {
|
|
98
|
+
styles.push(wideScreenStyle);
|
|
99
|
+
}
|
|
100
|
+
if (alwaysShow) {
|
|
101
|
+
styles.push(alwaysShowStyle);
|
|
102
|
+
}
|
|
103
|
+
return styles;
|
|
104
|
+
}, [alwaysShow, narrowScreen, wideScreen]);
|
|
105
|
+
|
|
39
106
|
return (
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
</div>
|
|
44
|
-
</aside>
|
|
107
|
+
<StyledAside css={styling} {...rest}>
|
|
108
|
+
<StyledAsideContent>{children}</StyledAsideContent>
|
|
109
|
+
</StyledAside>
|
|
45
110
|
);
|
|
46
111
|
};
|
|
47
112
|
|
|
@@ -0,0 +1,81 @@
|
|
|
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 styled from '@emotion/styled';
|
|
10
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react';
|
|
11
|
+
import { spacing } from '@ndla/core';
|
|
12
|
+
import { ContentTypeBadge } from './ContentTypeBadge';
|
|
13
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
14
|
+
import * as contentTypes from '../model/ContentType';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
title: 'Components/ContentTypeBadge',
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
parameters: {
|
|
20
|
+
inlineStories: true,
|
|
21
|
+
...defaultParameters,
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
size: 'small',
|
|
25
|
+
border: true,
|
|
26
|
+
type: 'subject-material',
|
|
27
|
+
background: true,
|
|
28
|
+
title: "I'm a badge",
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
children: { control: false },
|
|
32
|
+
},
|
|
33
|
+
component: ContentTypeBadge,
|
|
34
|
+
} as Meta<typeof ContentTypeBadge>;
|
|
35
|
+
|
|
36
|
+
export const Default: StoryObj<typeof ContentTypeBadge> = {};
|
|
37
|
+
|
|
38
|
+
export const Sizes: StoryFn<typeof ContentTypeBadge> = ({ ...args }) => (
|
|
39
|
+
<>
|
|
40
|
+
<ContentTypeBadge {...args} size="xx-small" />
|
|
41
|
+
<ContentTypeBadge {...args} size="x-small" />
|
|
42
|
+
<ContentTypeBadge {...args} size="small" />
|
|
43
|
+
<ContentTypeBadge {...args} size="large" />
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const NoBorder: StoryObj<typeof ContentTypeBadge> = {
|
|
48
|
+
args: {
|
|
49
|
+
border: false,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const NoBackground: StoryObj<typeof ContentTypeBadge> = {
|
|
54
|
+
args: {
|
|
55
|
+
background: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const BadgesWrapper = styled.div`
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: ${spacing.small};
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export const AllBadges: StoryFn<typeof ContentTypeBadge> = ({ ...args }) => (
|
|
66
|
+
<BadgesWrapper>
|
|
67
|
+
<ContentTypeBadge {...args} type={contentTypes.SUBJECT_MATERIAL} />
|
|
68
|
+
<ContentTypeBadge {...args} type={contentTypes.TASKS_AND_ACTIVITIES} />
|
|
69
|
+
<ContentTypeBadge {...args} type={contentTypes.ASSESSMENT_RESOURCES} />
|
|
70
|
+
<ContentTypeBadge {...args} type={contentTypes.SUBJECT} />
|
|
71
|
+
<ContentTypeBadge {...args} type={contentTypes.EXTERNAL_LEARNING_RESOURCES} />
|
|
72
|
+
<ContentTypeBadge {...args} type={contentTypes.SOURCE_MATERIAL} />
|
|
73
|
+
<ContentTypeBadge {...args} type={contentTypes.LEARNING_PATH} />
|
|
74
|
+
<ContentTypeBadge {...args} type={contentTypes.TOPIC} />
|
|
75
|
+
<ContentTypeBadge {...args} type={contentTypes.MULTIDISCIPLINARY_TOPIC} />
|
|
76
|
+
<ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.image} />
|
|
77
|
+
<ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.audio} />
|
|
78
|
+
<ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.video} />
|
|
79
|
+
<ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.concept} />
|
|
80
|
+
</BadgesWrapper>
|
|
81
|
+
);
|