@ndla/ui 30.2.3 → 30.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "30.2.3",
3
+ "version": "30.3.0",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "8bd050dca0276504378fdd458176281399c58db7"
89
+ "gitHead": "f9ee8725e9d18a8bf738babad7d4b65ee50a9cab"
90
90
  }
@@ -90,9 +90,10 @@ type Props = {
90
90
  children: ReactNode;
91
91
  totalCardCount: number;
92
92
  hideCards?: boolean;
93
+ id?: string;
93
94
  };
94
95
 
95
- export const MultidisciplinarySubject = ({ cards, children, totalCardCount, hideCards }: Props) => {
96
+ export const MultidisciplinarySubject = ({ cards, children, totalCardCount, hideCards, id }: Props) => {
96
97
  const { t } = useTranslation();
97
98
  return (
98
99
  <StyledWrapper>
@@ -100,7 +101,9 @@ export const MultidisciplinarySubject = ({ cards, children, totalCardCount, hide
100
101
  <OneColumn wide>
101
102
  <Header>
102
103
  <LayoutItem layout="extend">
103
- <Heading>{t('frontpageMultidisciplinarySubject.heading')}</Heading>
104
+ <Heading id={id} tabIndex={-1}>
105
+ {t('frontpageMultidisciplinarySubject.heading')}
106
+ </Heading>
104
107
  <InfoText>{t('frontpageMultidisciplinarySubject.text')}</InfoText>
105
108
  </LayoutItem>
106
109
  <Illustration />
@@ -39,18 +39,21 @@ const Introduction = styled.p`
39
39
  }
40
40
  `;
41
41
 
42
- type Props = {
42
+ interface Props {
43
+ id?: string;
43
44
  title: string;
44
45
  introduction: string;
45
46
  topics: ItemProps[];
46
47
  onSelectTopic?: (event: MouseEvent<HTMLElement>, id?: string) => void;
47
- };
48
+ }
48
49
 
49
- const ToolboxInfo = ({ title, introduction, topics, onSelectTopic }: Props) => {
50
+ const ToolboxInfo = ({ title, introduction, topics, onSelectTopic, id }: Props) => {
50
51
  const { t } = useTranslation();
51
52
  return (
52
53
  <>
53
- <Heading>{title}</Heading>
54
+ <Heading id={id} tabIndex={-1}>
55
+ {title}
56
+ </Heading>
54
57
  <Introduction>{introduction}</Introduction>
55
58
  <NavigationBox
56
59
  items={topics}
@@ -215,6 +215,7 @@ type VisualElementProps = {
215
215
  };
216
216
 
217
217
  export type TopicProps = {
218
+ id?: string;
218
219
  topic?: {
219
220
  title: string;
220
221
  introduction: string;
@@ -241,6 +242,7 @@ export type TopicProps = {
241
242
  };
242
243
 
243
244
  const Topic = ({
245
+ id,
244
246
  topic,
245
247
  subTopics,
246
248
  onSubTopicSelected,
@@ -323,7 +325,7 @@ const Topic = ({
323
325
  )}
324
326
  </TopicHeaderVisualElementWrapper>
325
327
  )}
326
- <TopicHeading invertedStyle={invertedStyle}>
328
+ <TopicHeading invertedStyle={invertedStyle} id={id} tabIndex={-1}>
327
329
  <StyledHeadingText>{topic.title}</StyledHeadingText>
328
330
  {isAdditionalTopic && (
329
331
  <StyledAdditionalResource>