@codecademy/brand 1.19.0-alpha.ceb3c1b495.0 → 1.19.0-alpha.d7b0b48c59.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/dist/AppHeader/AppHeaderElements/AppHeaderLinkSections/index.js +0 -0
- package/dist/LearningOutcomeTile/index.js +5 -3
- package/dist/LearningOutcomeTile/types.d.ts +13 -8
- package/dist/LearningOutcomeTile/types.js +6 -1
- package/dist/stories/Molecules/LearningOutcomeTile.stories.js +54 -5
- package/package.json +1 -1
|
File without changes
|
|
@@ -40,15 +40,17 @@ export const LearningOutcomeTile = ({
|
|
|
40
40
|
'aria-describedby': `${id}-popover`
|
|
41
41
|
} : {};
|
|
42
42
|
const lowLatestAssessment = Boolean(latestScore != null && latestScore < 70);
|
|
43
|
-
const showLowAssessmentDot = lowLatestAssessment && size !== 'small';
|
|
44
43
|
const progress = progressState(percentComplete);
|
|
44
|
+
const isCompleted = progress === Progress.completed;
|
|
45
|
+
const isSmall = size === 'small';
|
|
46
|
+
const showLowAssessmentDot = lowLatestAssessment && !isSmall;
|
|
45
47
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
48
|
children: [/*#__PURE__*/_jsxs(Tile, {
|
|
47
49
|
hover: hover,
|
|
48
50
|
progress: progress,
|
|
49
51
|
size: size,
|
|
50
52
|
...hoverProps,
|
|
51
|
-
children: [
|
|
53
|
+
children: [isCompleted ? /*#__PURE__*/_jsx(SmallCheckIcon, {
|
|
52
54
|
size: size === 'small' ? 12 : 16,
|
|
53
55
|
textColor: "background-contrast"
|
|
54
56
|
}) : /*#__PURE__*/_jsx(Text, {
|
|
@@ -66,7 +68,7 @@ export const LearningOutcomeTile = ({
|
|
|
66
68
|
activeElRef: activeElRef,
|
|
67
69
|
isOpen: isOpen,
|
|
68
70
|
setIsOpen: setIsOpen,
|
|
69
|
-
horizontalOffset:
|
|
71
|
+
horizontalOffset: isSmall && isCompleted ? 159 : isSmall ? 153 : 150,
|
|
70
72
|
learningOutcomeDetails: learningOutcomeDetails
|
|
71
73
|
})]
|
|
72
74
|
});
|
|
@@ -22,17 +22,22 @@ export interface LearningOutcomePopoverDetailsProps {
|
|
|
22
22
|
latestScore?: number;
|
|
23
23
|
highestScore?: number;
|
|
24
24
|
}
|
|
25
|
-
interface
|
|
25
|
+
interface WithHoverAndWithPopover {
|
|
26
26
|
learningOutcomeDetails: LearningOutcomePopoverDetailsProps;
|
|
27
|
-
hover
|
|
27
|
+
hover: true;
|
|
28
28
|
popover: true;
|
|
29
|
-
size?: SizeType;
|
|
30
29
|
}
|
|
31
|
-
interface
|
|
30
|
+
interface WithHoverAndWithoutPopover {
|
|
32
31
|
learningOutcomeDetails: LearningOutcomeTileDetailsProps;
|
|
33
|
-
hover
|
|
34
|
-
popover
|
|
35
|
-
size?: SizeType;
|
|
32
|
+
hover: true;
|
|
33
|
+
popover: false;
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
interface WithoutHoverAndWithoutPopover {
|
|
36
|
+
learningOutcomeDetails: LearningOutcomeTileDetailsProps;
|
|
37
|
+
hover?: false;
|
|
38
|
+
popover?: false;
|
|
39
|
+
}
|
|
40
|
+
export type LearningOutcomeTileProps = {
|
|
41
|
+
size?: SizeType;
|
|
42
|
+
} & (WithHoverAndWithPopover | WithHoverAndWithoutPopover | WithoutHoverAndWithoutPopover);
|
|
38
43
|
export {};
|
|
@@ -3,4 +3,9 @@ export let Progress = /*#__PURE__*/function (Progress) {
|
|
|
3
3
|
Progress["inProgress"] = "inProgress";
|
|
4
4
|
Progress["completed"] = "completed";
|
|
5
5
|
return Progress;
|
|
6
|
-
}({});
|
|
6
|
+
}({});
|
|
7
|
+
|
|
8
|
+
/* The following interfaces define the props for the LearningOutcomeTile component based on different states of hover and popover.
|
|
9
|
+
When hover is true, popover prop is required (either true or false).
|
|
10
|
+
When hover is false, popover prop is optional and defaults to false.
|
|
11
|
+
*/
|
|
@@ -18,6 +18,7 @@ export const Default = {
|
|
|
18
18
|
gap: 16,
|
|
19
19
|
children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
20
20
|
...args,
|
|
21
|
+
popover: false,
|
|
21
22
|
hover: true
|
|
22
23
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
23
24
|
...args,
|
|
@@ -25,6 +26,7 @@ export const Default = {
|
|
|
25
26
|
id: '2',
|
|
26
27
|
percentComplete: 50
|
|
27
28
|
},
|
|
29
|
+
popover: false,
|
|
28
30
|
hover: true
|
|
29
31
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
30
32
|
...args,
|
|
@@ -32,6 +34,7 @@ export const Default = {
|
|
|
32
34
|
id: '3',
|
|
33
35
|
percentComplete: 100
|
|
34
36
|
},
|
|
37
|
+
popover: false,
|
|
35
38
|
hover: true
|
|
36
39
|
})]
|
|
37
40
|
}),
|
|
@@ -47,6 +50,7 @@ export const WithLowAssessments = {
|
|
|
47
50
|
percentComplete: 0,
|
|
48
51
|
latestScore: 50
|
|
49
52
|
},
|
|
53
|
+
popover: false,
|
|
50
54
|
hover: true
|
|
51
55
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
52
56
|
...args,
|
|
@@ -55,6 +59,7 @@ export const WithLowAssessments = {
|
|
|
55
59
|
percentComplete: 50,
|
|
56
60
|
latestScore: 50
|
|
57
61
|
},
|
|
62
|
+
popover: false,
|
|
58
63
|
hover: true
|
|
59
64
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
60
65
|
...args,
|
|
@@ -63,6 +68,7 @@ export const WithLowAssessments = {
|
|
|
63
68
|
percentComplete: 100,
|
|
64
69
|
latestScore: 50
|
|
65
70
|
},
|
|
71
|
+
popover: false,
|
|
66
72
|
hover: true
|
|
67
73
|
})]
|
|
68
74
|
}),
|
|
@@ -114,23 +120,60 @@ export const Small = {
|
|
|
114
120
|
gap: 16,
|
|
115
121
|
children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
116
122
|
...args,
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
size: "small",
|
|
124
|
+
popover: false,
|
|
125
|
+
hover: true
|
|
119
126
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
120
127
|
...args,
|
|
128
|
+
size: "small",
|
|
121
129
|
learningOutcomeDetails: {
|
|
122
130
|
id: '2',
|
|
123
131
|
percentComplete: 50
|
|
124
132
|
},
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
popover: false,
|
|
134
|
+
hover: true
|
|
127
135
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
128
136
|
...args,
|
|
137
|
+
size: "small",
|
|
129
138
|
learningOutcomeDetails: {
|
|
130
139
|
id: '3',
|
|
131
140
|
percentComplete: 100
|
|
132
141
|
},
|
|
133
|
-
|
|
142
|
+
popover: false,
|
|
143
|
+
hover: true
|
|
144
|
+
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
145
|
+
...args,
|
|
146
|
+
size: "small",
|
|
147
|
+
learningOutcomeDetails: {
|
|
148
|
+
id: '2',
|
|
149
|
+
percentComplete: 0,
|
|
150
|
+
outcome: 'Apply programming fundamentals',
|
|
151
|
+
level: 2
|
|
152
|
+
},
|
|
153
|
+
hover: true,
|
|
154
|
+
popover: true
|
|
155
|
+
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
156
|
+
...args,
|
|
157
|
+
size: "small",
|
|
158
|
+
learningOutcomeDetails: {
|
|
159
|
+
id: '2',
|
|
160
|
+
percentComplete: 50,
|
|
161
|
+
outcome: 'Apply programming fundamentals',
|
|
162
|
+
level: 2
|
|
163
|
+
},
|
|
164
|
+
hover: true,
|
|
165
|
+
popover: true
|
|
166
|
+
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
167
|
+
...args,
|
|
168
|
+
size: "small",
|
|
169
|
+
learningOutcomeDetails: {
|
|
170
|
+
id: '3',
|
|
171
|
+
percentComplete: 100,
|
|
172
|
+
outcome: 'Apply programming fundamentals',
|
|
173
|
+
level: 2
|
|
174
|
+
},
|
|
175
|
+
hover: true,
|
|
176
|
+
popover: true
|
|
134
177
|
})]
|
|
135
178
|
}),
|
|
136
179
|
name: 'Learning Outcome Tile - Small'
|
|
@@ -148,6 +191,7 @@ export const DarkMode = {
|
|
|
148
191
|
percentComplete: 0,
|
|
149
192
|
latestScore: 50
|
|
150
193
|
},
|
|
194
|
+
popover: false,
|
|
151
195
|
hover: true
|
|
152
196
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
153
197
|
...args,
|
|
@@ -156,6 +200,7 @@ export const DarkMode = {
|
|
|
156
200
|
percentComplete: 50,
|
|
157
201
|
latestScore: 50
|
|
158
202
|
},
|
|
203
|
+
popover: false,
|
|
159
204
|
hover: true
|
|
160
205
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
161
206
|
...args,
|
|
@@ -164,6 +209,7 @@ export const DarkMode = {
|
|
|
164
209
|
percentComplete: 100,
|
|
165
210
|
latestScore: 50
|
|
166
211
|
},
|
|
212
|
+
popover: false,
|
|
167
213
|
hover: true
|
|
168
214
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
169
215
|
...args,
|
|
@@ -173,6 +219,7 @@ export const DarkMode = {
|
|
|
173
219
|
latestScore: 50
|
|
174
220
|
},
|
|
175
221
|
size: "small",
|
|
222
|
+
popover: false,
|
|
176
223
|
hover: true
|
|
177
224
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
178
225
|
...args,
|
|
@@ -182,6 +229,7 @@ export const DarkMode = {
|
|
|
182
229
|
latestScore: 50
|
|
183
230
|
},
|
|
184
231
|
size: "small",
|
|
232
|
+
popover: false,
|
|
185
233
|
hover: true
|
|
186
234
|
}), /*#__PURE__*/_jsx(LearningOutcomeTile, {
|
|
187
235
|
...args,
|
|
@@ -191,6 +239,7 @@ export const DarkMode = {
|
|
|
191
239
|
latestScore: 50
|
|
192
240
|
},
|
|
193
241
|
size: "small",
|
|
242
|
+
popover: false,
|
|
194
243
|
hover: true
|
|
195
244
|
})]
|
|
196
245
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/brand",
|
|
3
3
|
"description": "Brand component library for Codecademy",
|
|
4
|
-
"version": "1.19.0-alpha.
|
|
4
|
+
"version": "1.19.0-alpha.d7b0b48c59.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@emotion/is-prop-valid": "^1.2.1",
|