@ndla/ui 35.0.19 → 35.0.21
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/BlogPost/BlogPost.js +54 -0
- package/es/BlogPost/index.js +9 -0
- package/es/TreeStructure/AddFolderButton.js +2 -2
- package/es/TreeStructure/ComboboxButton.js +3 -3
- package/es/TreeStructure/FolderItem.js +5 -5
- package/es/TreeStructure/FolderItems.js +2 -2
- package/es/TreeStructure/TreeStructure.js +7 -7
- package/es/index.js +2 -1
- package/lib/BlogPost/BlogPost.d.ts +24 -0
- package/lib/BlogPost/BlogPost.js +61 -0
- package/lib/BlogPost/index.d.ts +8 -0
- package/lib/BlogPost/index.js +13 -0
- package/lib/TreeStructure/AddFolderButton.d.ts +1 -1
- package/lib/TreeStructure/AddFolderButton.js +2 -2
- package/lib/TreeStructure/ComboboxButton.d.ts +1 -1
- package/lib/TreeStructure/ComboboxButton.js +3 -3
- package/lib/TreeStructure/FolderItem.d.ts +1 -1
- package/lib/TreeStructure/FolderItem.js +5 -5
- package/lib/TreeStructure/FolderItems.d.ts +1 -1
- package/lib/TreeStructure/FolderItems.js +2 -2
- package/lib/TreeStructure/TreeStructure.d.ts +1 -1
- package/lib/TreeStructure/TreeStructure.js +7 -7
- package/lib/TreeStructure/arrowNavigation.d.ts +1 -1
- package/lib/TreeStructure/helperFunctions.d.ts +1 -1
- package/lib/TreeStructure/types.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/package.json +13 -14
- package/src/BlogPost/BlogPost.stories.tsx +37 -0
- package/src/BlogPost/BlogPost.tsx +102 -0
- package/src/BlogPost/index.ts +9 -0
- package/src/Embed/AudioEmbed.tsx +1 -1
- package/src/TreeStructure/AddFolderButton.tsx +1 -1
- package/src/TreeStructure/ComboboxButton.tsx +2 -2
- package/src/TreeStructure/FolderItem.tsx +1 -1
- package/src/TreeStructure/FolderItems.tsx +1 -1
- package/src/TreeStructure/TreeStructure.tsx +1 -1
- package/src/TreeStructure/arrowNavigation.ts +1 -1
- package/src/TreeStructure/helperFunctions.ts +1 -1
- package/src/TreeStructure/types.ts +1 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1,102 @@
|
|
|
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 { css } from '@emotion/react';
|
|
11
|
+
import SafeLink from '@ndla/safelink';
|
|
12
|
+
import { colors, fonts, misc, spacing } from '@ndla/core';
|
|
13
|
+
import { Quote } from '@ndla/icons/editor';
|
|
14
|
+
import { HeadingLevel } from '../types';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
title: {
|
|
18
|
+
title: string;
|
|
19
|
+
language: string;
|
|
20
|
+
};
|
|
21
|
+
author?: string;
|
|
22
|
+
url: string;
|
|
23
|
+
headingLevel?: HeadingLevel;
|
|
24
|
+
size?: 'normal' | 'large';
|
|
25
|
+
metaImage: {
|
|
26
|
+
url: string;
|
|
27
|
+
alt: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const Container = styled(SafeLink)`
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
color: ${colors.text.primary};
|
|
35
|
+
max-width: 350px;
|
|
36
|
+
min-width: 350px;
|
|
37
|
+
max-height: 415px;
|
|
38
|
+
min-height: 415px;
|
|
39
|
+
gap: ${spacing.nsmall};
|
|
40
|
+
box-shadow: none;
|
|
41
|
+
border: 1px solid ${colors.brand.lightest};
|
|
42
|
+
border-radius: ${misc.borderRadius};
|
|
43
|
+
padding: ${spacing.normal} ${spacing.medium};
|
|
44
|
+
&[data-size='large'] {
|
|
45
|
+
min-width: 532px;
|
|
46
|
+
max-width: 532px;
|
|
47
|
+
min-height: 550px;
|
|
48
|
+
max-height: 550px;
|
|
49
|
+
}
|
|
50
|
+
&:hover,
|
|
51
|
+
&:focus-within {
|
|
52
|
+
.blog-title {
|
|
53
|
+
box-shadow: inset 0 -1px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const headingCss = css`
|
|
59
|
+
display: inline-block;
|
|
60
|
+
width: fit-content;
|
|
61
|
+
margin: 0;
|
|
62
|
+
font-weight: ${fonts.weight.semibold};
|
|
63
|
+
${fonts.sizes('26px', '36px')};
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
const AuthorContainer = styled.div`
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: ${spacing.xsmall};
|
|
70
|
+
svg {
|
|
71
|
+
color: rgba(78, 81, 242, 1);
|
|
72
|
+
}
|
|
73
|
+
text-transform: uppercase;
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
const StyledImg = styled.img`
|
|
77
|
+
border-radius: ${misc.borderRadius};
|
|
78
|
+
flex: 1;
|
|
79
|
+
object-fit: cover;
|
|
80
|
+
width: 100%;
|
|
81
|
+
height: 100%;
|
|
82
|
+
border: 0;
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const BlogPost = ({ title, author, url, metaImage, headingLevel: Heading = 'h3', size = 'normal' }: Props) => {
|
|
86
|
+
return (
|
|
87
|
+
<Container data-size={size} to={url}>
|
|
88
|
+
<Heading className="blog-title" css={headingCss} lang={title.language}>
|
|
89
|
+
{title.title}
|
|
90
|
+
</Heading>
|
|
91
|
+
<StyledImg src={metaImage.url} alt={metaImage.alt} />
|
|
92
|
+
{!!author && (
|
|
93
|
+
<AuthorContainer>
|
|
94
|
+
<Quote />
|
|
95
|
+
{author}
|
|
96
|
+
</AuthorContainer>
|
|
97
|
+
)}
|
|
98
|
+
</Container>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default BlogPost;
|
package/src/Embed/AudioEmbed.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import Tooltip from '@ndla/tooltip';
|
|
|
12
12
|
import styled from '@emotion/styled';
|
|
13
13
|
import { ButtonV2 as Button } from '@ndla/button';
|
|
14
14
|
import { Plus } from '@ndla/icons/action';
|
|
15
|
-
import { IFolder } from '@ndla/types-learningpath-api';
|
|
15
|
+
import { IFolder } from '@ndla/types-backend/learningpath-api';
|
|
16
16
|
|
|
17
17
|
interface AddFolderButtonProps {
|
|
18
18
|
canAddFolder: boolean;
|
|
@@ -11,7 +11,7 @@ import styled from '@emotion/styled';
|
|
|
11
11
|
import { useForwardedRef } from '@ndla/util';
|
|
12
12
|
import { breakpoints, colors, mq, spacing } from '@ndla/core';
|
|
13
13
|
import { ChevronUp, ChevronDown } from '@ndla/icons/common';
|
|
14
|
-
import { IFolder } from '@ndla/types-learningpath-api';
|
|
14
|
+
import { IFolder } from '@ndla/types-backend/learningpath-api';
|
|
15
15
|
import { ButtonV2 as Button, IconButtonV2 as IconButton } from '@ndla/button';
|
|
16
16
|
import { treestructureId } from './helperFunctions';
|
|
17
17
|
import { TreeStructureType } from './types';
|
|
@@ -144,7 +144,7 @@ const ComboboxButton = forwardRef<HTMLButtonElement, Props>(
|
|
|
144
144
|
onKeyDown={onKeyDown}
|
|
145
145
|
onClick={() => {
|
|
146
146
|
innerRef.current?.focus();
|
|
147
|
-
onToggleTree(
|
|
147
|
+
onToggleTree(showTree);
|
|
148
148
|
}}
|
|
149
149
|
>
|
|
150
150
|
{selectedFolder?.name}
|
|
@@ -14,7 +14,7 @@ import { Done } from '@ndla/icons/editor';
|
|
|
14
14
|
import { ButtonV2 as Button } from '@ndla/button';
|
|
15
15
|
import { colors, spacing, animations, spacingUnit, misc, fonts } from '@ndla/core';
|
|
16
16
|
import SafeLink from '@ndla/safelink';
|
|
17
|
-
import { IFolder } from '@ndla/types-learningpath-api';
|
|
17
|
+
import { IFolder } from '@ndla/types-backend/learningpath-api';
|
|
18
18
|
import { CommonFolderItemsProps } from './types';
|
|
19
19
|
import { arrowNavigation } from './arrowNavigation';
|
|
20
20
|
import { treestructureId } from './helperFunctions';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import React, { ReactNode } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { animations } from '@ndla/core';
|
|
12
|
-
import { IFolder } from '@ndla/types-learningpath-api';
|
|
12
|
+
import { IFolder } from '@ndla/types-backend/learningpath-api';
|
|
13
13
|
import FolderItem from './FolderItem';
|
|
14
14
|
import { CommonFolderItemsProps, NewFolderInputFunc, OnCreatedFunc, TreeStructureType } from './types';
|
|
15
15
|
import { treestructureId } from './helperFunctions';
|
|
@@ -11,7 +11,7 @@ import styled from '@emotion/styled';
|
|
|
11
11
|
import { colors, fonts, misc, utils } from '@ndla/core';
|
|
12
12
|
import { css } from '@emotion/react';
|
|
13
13
|
import uniq from 'lodash/uniq';
|
|
14
|
-
import { IFolder } from '@ndla/types-learningpath-api';
|
|
14
|
+
import { IFolder } from '@ndla/types-backend/learningpath-api';
|
|
15
15
|
import FolderItems from './FolderItems';
|
|
16
16
|
import { flattenFolders, treestructureId } from './helperFunctions';
|
|
17
17
|
import { CommonTreeStructureProps, NewFolderInputFunc, TreeStructureType } from './types';
|
package/src/index.ts
CHANGED
|
@@ -269,3 +269,4 @@ export type { TreeStructureProps } from './TreeStructure';
|
|
|
269
269
|
|
|
270
270
|
export { SearchField, SearchResultList, SearchResultItem, ActiveFilters, ToggleSearchButton } from './Search';
|
|
271
271
|
export { default as LetterFilter } from './LetterFilter';
|
|
272
|
+
export { BlogPostV2 } from './BlogPost';
|