@ndla/ui 34.3.5 → 34.4.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/es/Article/ArticleByline.js +6 -5
- package/es/BlogPosts/BlogPost.js +6 -5
- package/es/CompetenceGoalTab/CompetenceGoalTab.js +4 -3
- package/es/ContentTypeBadge/ContentTypeBadge.js +3 -6
- package/es/Figure/Figure.js +1 -1
- package/es/Figure/FigureLicense.js +1 -1
- package/es/LearningPaths/LearningPathInformation.js +5 -4
- package/es/LearningPaths/LearningPathMenuAsideCopyright.js +4 -3
- package/es/MediaList/MediaList.js +2 -1
- package/es/SearchTypeResult/ResultNavigation.js +7 -5
- package/es/SearchTypeResult/SearchItem.js +51 -89
- package/es/SearchTypeResult/SearchItems.js +14 -10
- package/es/SearchTypeResult/SearchTypeHeader.js +14 -12
- package/es/SearchTypeResult/SearchTypeResult.js +6 -4
- package/es/SearchTypeResult/components/ItemContexts.js +12 -14
- package/es/SearchTypeResult/components/ItemResourceHeader.js +35 -33
- package/es/SearchTypeResult/components/ItemTopicHeader.js +6 -6
- package/lib/Article/ArticleByline.js +6 -5
- package/lib/BlogPosts/BlogPost.js +6 -5
- package/lib/CompetenceGoalTab/CompetenceGoalTab.js +4 -3
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +3 -8
- package/lib/ContentTypeBadge/ContentTypeBadge.js +3 -6
- package/lib/Figure/Figure.js +2 -2
- package/lib/Figure/FigureLicense.js +2 -2
- package/lib/LearningPaths/LearningPathInformation.js +5 -4
- package/lib/LearningPaths/LearningPathMenuAsideCopyright.js +4 -3
- package/lib/MediaList/MediaList.js +2 -1
- package/lib/SearchTypeResult/ResultNavigation.d.ts +4 -1
- package/lib/SearchTypeResult/ResultNavigation.js +7 -5
- package/lib/SearchTypeResult/SearchItem.d.ts +4 -4
- package/lib/SearchTypeResult/SearchItem.js +62 -88
- package/lib/SearchTypeResult/SearchItems.d.ts +2 -2
- package/lib/SearchTypeResult/SearchItems.js +14 -10
- package/lib/SearchTypeResult/SearchTypeHeader.js +14 -12
- package/lib/SearchTypeResult/SearchTypeResult.js +6 -4
- package/lib/SearchTypeResult/components/ItemContexts.js +12 -14
- package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +2 -2
- package/lib/SearchTypeResult/components/ItemResourceHeader.js +35 -33
- package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +2 -2
- package/lib/SearchTypeResult/components/ItemTopicHeader.js +6 -6
- package/package.json +5 -5
- package/src/Article/ArticleByline.tsx +2 -1
- package/src/BlogPosts/BlogPost.tsx +2 -1
- package/src/CompetenceGoalTab/CompetenceGoalTab.tsx +2 -1
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +4 -9
- package/src/Figure/Figure.tsx +1 -1
- package/src/Figure/FigureLicense.tsx +1 -1
- package/src/LearningPaths/LearningPathInformation.tsx +2 -1
- package/src/LearningPaths/LearningPathMenuAsideCopyright.tsx +2 -1
- package/src/MediaList/MediaList.tsx +1 -1
- package/src/SearchTypeResult/ResultNavigation.tsx +6 -2
- package/src/SearchTypeResult/SearchItem.tsx +61 -77
- package/src/SearchTypeResult/SearchItems.tsx +25 -16
- package/src/SearchTypeResult/SearchTypeHeader.tsx +9 -3
- package/src/SearchTypeResult/SearchTypeResult.tsx +2 -2
- package/src/SearchTypeResult/components/ItemContexts.tsx +9 -9
- package/src/SearchTypeResult/components/ItemResourceHeader.tsx +33 -31
- package/src/SearchTypeResult/components/ItemTopicHeader.tsx +9 -15
|
@@ -18,29 +18,20 @@ import { SearchItemType } from '../SearchItem';
|
|
|
18
18
|
import resourceTypeColor from '../../utils/resourceTypeColor';
|
|
19
19
|
import ContentTypeBadge from '../../ContentTypeBadge';
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
interface ItemTypeProps {
|
|
22
22
|
contentType?: ContentType;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
|
|
25
25
|
const ImageElement = styled.img`
|
|
26
26
|
width: 100%;
|
|
27
27
|
height: 100%;
|
|
28
28
|
object-fit: cover;
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const ImageWrapper = styled.div`
|
|
32
|
-
flex: 1;
|
|
33
|
-
border-top-left-radius: 5px;
|
|
34
|
-
border-top-right-radius: 5px;
|
|
35
29
|
overflow: hidden;
|
|
36
30
|
`;
|
|
37
31
|
|
|
38
32
|
const NoImageElement = styled.div<ItemTypeProps>`
|
|
39
|
-
border-top-left-radius: 5px;
|
|
40
|
-
border-top-right-radius: 5px;
|
|
41
33
|
flex: 1;
|
|
42
34
|
background: ${(props) => props.contentType && `${resourceTypeColor(props.contentType)}`};
|
|
43
|
-
position: relative;
|
|
44
35
|
display: flex;
|
|
45
36
|
align-items: center;
|
|
46
37
|
justify-content: center;
|
|
@@ -59,7 +50,6 @@ const NoImageElement = styled.div<ItemTypeProps>`
|
|
|
59
50
|
const ContentTypeWrapper = styled.div<ItemTypeProps>`
|
|
60
51
|
height: 48px;
|
|
61
52
|
background: ${(props) => props.contentType && `${resourceTypeColor(props.contentType)}`};
|
|
62
|
-
flex: 0 0 auto;
|
|
63
53
|
position: relative;
|
|
64
54
|
display: flex;
|
|
65
55
|
align-items: center;
|
|
@@ -69,47 +59,59 @@ const ContentTypeWrapper = styled.div<ItemTypeProps>`
|
|
|
69
59
|
`;
|
|
70
60
|
|
|
71
61
|
const ContentTypeIcon = styled.span<ItemTypeProps>`
|
|
62
|
+
display: flex;
|
|
72
63
|
position: absolute;
|
|
73
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='78' height='23' viewBox='17 0 78 23' fill='none'%3E%3Cpath d='M35.6874 10.8284C37.0999 8.9889 38.405 7.28934 40 6C44.8452 2.08335 48.9078 0 56 0C63.0922 0 67.6548 2.5833 72.5 6.49995C74.0499 7.75284 75.2937 9.39082 76.6385 11.1617C80.0028 15.5921 83.9988 20.8545 95 23H17C27.9865 20.8573 32.1701 15.409 35.6874 10.8284ZM352' fill='${(
|
|
74
|
-
props,
|
|
75
|
-
) => props.contentType && `${encodeURIComponent(resourceTypeColor(props.contentType))}`}'/%3E%3C/svg%3E");
|
|
76
|
-
background-position: top;
|
|
77
|
-
background-repeat: no-repeat;
|
|
78
|
-
left: 17px;
|
|
79
64
|
top: -23px;
|
|
80
|
-
|
|
81
|
-
width: 78px;
|
|
82
|
-
display: flex;
|
|
65
|
+
margin-left: ${spacing.small};
|
|
83
66
|
justify-content: center;
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
::before {
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
height: 23px;
|
|
71
|
+
width: 78px;
|
|
72
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='78' height='23' viewBox='17 0 78 23' fill='none'%3E%3Cpath d='M35.6874 10.8284C37.0999 8.9889 38.405 7.28934 40 6C44.8452 2.08335 48.9078 0 56 0C63.0922 0 67.6548 2.5833 72.5 6.49995C74.0499 7.75284 75.2937 9.39082 76.6385 11.1617C80.0028 15.5921 83.9988 20.8545 95 23H17C27.9865 20.8573 32.1701 15.409 35.6874 10.8284ZM352' fill='${(
|
|
73
|
+
props,
|
|
74
|
+
) => props.contentType && `${encodeURIComponent(resourceTypeColor(props.contentType))}`}'/%3E%3C/svg%3E");
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
const StyledContentTypeBadge = styled(ContentTypeBadge)`
|
|
79
|
+
z-index: 1;
|
|
80
|
+
margin-top: ${spacing.xxsmall};
|
|
81
|
+
|
|
86
82
|
svg {
|
|
87
83
|
width: 20px;
|
|
88
84
|
height: 20px;
|
|
89
85
|
}
|
|
90
86
|
`;
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
const Wrapper = styled.header`
|
|
89
|
+
display: grid;
|
|
90
|
+
grid-template-rows: 1fr auto;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
height: 180px;
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
interface Props {
|
|
93
97
|
labels: SearchItemType['item']['labels'];
|
|
94
98
|
img?: SearchItemType['item']['img'] | null;
|
|
95
99
|
type?: ContentType;
|
|
96
|
-
}
|
|
100
|
+
}
|
|
97
101
|
|
|
98
102
|
const ItemResourceHeader = ({ labels = [], img, type }: Props) => {
|
|
99
103
|
const { t } = useTranslation();
|
|
100
104
|
return (
|
|
101
|
-
|
|
105
|
+
<Wrapper>
|
|
102
106
|
{img ? (
|
|
103
|
-
<
|
|
104
|
-
<ImageElement src={img.url} alt={img.alt} />
|
|
105
|
-
</ImageWrapper>
|
|
107
|
+
<ImageElement src={img.url} alt={img.alt} />
|
|
106
108
|
) : (
|
|
107
109
|
<NoImageElement contentType={type}>{type && <ContentTypeBadge type={type} border={false} />}</NoImageElement>
|
|
108
110
|
)}
|
|
109
111
|
<ContentTypeWrapper className="resource-type-wrapper" contentType={type}>
|
|
110
112
|
{img && type && (
|
|
111
113
|
<ContentTypeIcon className="resource-icon-wrapper" contentType={type}>
|
|
112
|
-
<
|
|
114
|
+
<StyledContentTypeBadge type={type} border={false} />
|
|
113
115
|
</ContentTypeIcon>
|
|
114
116
|
)}
|
|
115
117
|
{type && t(`contentTypes.${type}`)}
|
|
@@ -124,7 +126,7 @@ const ItemResourceHeader = ({ labels = [], img, type }: Props) => {
|
|
|
124
126
|
</>
|
|
125
127
|
)}
|
|
126
128
|
</ContentTypeWrapper>
|
|
127
|
-
|
|
129
|
+
</Wrapper>
|
|
128
130
|
);
|
|
129
131
|
};
|
|
130
132
|
|
|
@@ -15,11 +15,8 @@ import { SearchItemType } from '../SearchItem';
|
|
|
15
15
|
import ContentTypeBadge from '../../ContentTypeBadge';
|
|
16
16
|
import { ContentType } from '../SearchTypeResult';
|
|
17
17
|
|
|
18
|
-
const Wrapper = styled.
|
|
19
|
-
padding: ${spacing.small} ${spacing.normal};
|
|
20
|
-
position: relative;
|
|
21
|
-
min-height: 0;
|
|
22
|
-
flex: 1;
|
|
18
|
+
const Wrapper = styled.header`
|
|
19
|
+
padding: ${spacing.small} ${spacing.normal} 0;
|
|
23
20
|
`;
|
|
24
21
|
|
|
25
22
|
const Label = styled.div`
|
|
@@ -28,7 +25,7 @@ const Label = styled.div`
|
|
|
28
25
|
height: 26px;
|
|
29
26
|
display: flex;
|
|
30
27
|
align-items: center;
|
|
31
|
-
margin
|
|
28
|
+
margin: ${spacing.small} 0;
|
|
32
29
|
|
|
33
30
|
.c-content-type-badge {
|
|
34
31
|
width: 26px;
|
|
@@ -46,15 +43,11 @@ const Label = styled.div`
|
|
|
46
43
|
const TopicHeaderVisualElementWrapper = styled.div`
|
|
47
44
|
float: right;
|
|
48
45
|
margin-left: ${spacing.small};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
height: 112px;
|
|
46
|
+
width: 110px;
|
|
47
|
+
height: 110px;
|
|
52
48
|
display: flex;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
align-items: center;
|
|
55
49
|
overflow: hidden;
|
|
56
50
|
border-radius: 50%;
|
|
57
|
-
-webkit-mask-image: -webkit-radial-gradient(white, black);
|
|
58
51
|
`;
|
|
59
52
|
|
|
60
53
|
const TopicHeaderImage = styled.img`
|
|
@@ -64,18 +57,19 @@ const TopicHeaderImage = styled.img`
|
|
|
64
57
|
max-width: unset;
|
|
65
58
|
`;
|
|
66
59
|
|
|
67
|
-
|
|
60
|
+
interface Props {
|
|
68
61
|
children: ReactNode;
|
|
69
62
|
image?: SearchItemType['item']['img'] | null;
|
|
70
63
|
type?: ContentType;
|
|
71
|
-
}
|
|
64
|
+
}
|
|
65
|
+
|
|
72
66
|
const ItemTopicHeader = ({ children, image, type }: Props) => {
|
|
73
67
|
const { t } = useTranslation();
|
|
74
68
|
return (
|
|
75
69
|
<Wrapper>
|
|
76
70
|
{image && (
|
|
77
71
|
<TopicHeaderVisualElementWrapper>
|
|
78
|
-
<TopicHeaderImage className="topic-header-image" src={image.url} alt=
|
|
72
|
+
<TopicHeaderImage className="topic-header-image" src={image.url} alt="" />
|
|
79
73
|
</TopicHeaderVisualElementWrapper>
|
|
80
74
|
)}
|
|
81
75
|
<Label className="topic-label">
|