richie-education 2.25.0-b2.dev129 → 2.25.0-b2.dev131
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/cunningham.cjs +4 -0
- package/js/api/lms/dummy.ts +2 -2
- package/js/api/lms/openedx-hawthorn.ts +2 -2
- package/js/types/api.ts +4 -4
- package/js/types/index.ts +1 -2
- package/js/utils/StringHelper/index.ts +19 -0
- package/js/utils/cunningham-tokens.ts +202 -0
- package/js/utils/test/factories/richie.ts +1 -17
- package/js/widgets/Dashboard/components/DashboardAvatar/index.tsx +3 -0
- package/js/widgets/Dashboard/components/DashboardListAvatar/index.stories.tsx +134 -0
- package/js/widgets/Dashboard/components/DashboardListAvatar/index.tsx +13 -2
- package/package.json +2 -2
- package/scss/vendors/cunningham-tokens.scss +4 -0
package/cunningham.cjs
CHANGED
package/js/api/lms/dummy.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AuthenticationBackend, LMSBackend } from 'types/commonDataProps';
|
|
|
2
2
|
import { Maybe, Nullable } from 'types/utils';
|
|
3
3
|
import { User } from 'types/User';
|
|
4
4
|
import { APILms } from 'types/api';
|
|
5
|
-
import {
|
|
5
|
+
import { UnknownEnrollment, OpenEdXEnrollment } from 'types';
|
|
6
6
|
import { location } from 'utils/indirection/window';
|
|
7
7
|
import { CURRENT_JOANIE_DEV_DEMO_USER, RICHIE_USER_TOKEN } from 'settings';
|
|
8
8
|
import { base64Decode } from 'utils/base64Parser';
|
|
@@ -139,7 +139,7 @@ const API = (APIConf: LMSBackend | AuthenticationBackend): APILms => {
|
|
|
139
139
|
}
|
|
140
140
|
resolve(null);
|
|
141
141
|
}),
|
|
142
|
-
isEnrolled: async (enrollment: Maybe<Nullable<
|
|
142
|
+
isEnrolled: async (enrollment: Maybe<Nullable<UnknownEnrollment>>) =>
|
|
143
143
|
new Promise((resolve) => resolve(!!(enrollment as OpenEdXEnrollment)?.is_active)),
|
|
144
144
|
set: (url: string, user: User): Promise<boolean> =>
|
|
145
145
|
new Promise((resolve) => {
|
|
@@ -7,7 +7,7 @@ import { APILms, APIOptions } from 'types/api';
|
|
|
7
7
|
import { location } from 'utils/indirection/window';
|
|
8
8
|
import { handle } from 'utils/errors/handle';
|
|
9
9
|
import { EDX_CSRF_TOKEN_COOKIE_NAME } from 'settings';
|
|
10
|
-
import {
|
|
10
|
+
import { UnknownEnrollment, OpenEdXEnrollment } from 'types';
|
|
11
11
|
import { HttpError, HttpStatusCode } from 'utils/errors/HttpError';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -88,7 +88,7 @@ const API = (APIConf: AuthenticationBackend | LMSBackend, options?: APIOptions):
|
|
|
88
88
|
throw new HttpError(response.status, response.statusText);
|
|
89
89
|
});
|
|
90
90
|
},
|
|
91
|
-
isEnrolled: async (enrollment: Maybe<Nullable<
|
|
91
|
+
isEnrolled: async (enrollment: Maybe<Nullable<UnknownEnrollment>>) => {
|
|
92
92
|
return new Promise((resolve) => resolve(!!(enrollment as OpenEdXEnrollment)?.is_active));
|
|
93
93
|
},
|
|
94
94
|
set: async (url: string, user: User): Promise<boolean> => {
|
package/js/types/api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe, Nullable } from 'types/utils';
|
|
2
2
|
import { User } from 'types/User';
|
|
3
|
-
import {
|
|
3
|
+
import { UnknownEnrollment } from 'types';
|
|
4
4
|
|
|
5
5
|
export interface APIListRequestParams {
|
|
6
6
|
[key: string]: Maybe<string | string[]>;
|
|
@@ -23,12 +23,12 @@ export interface APIAuthentication {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface APIEnrollment {
|
|
26
|
-
get(url: string, user: Nullable<User>): Promise<Nullable<
|
|
27
|
-
isEnrolled(enrollment: Maybe<Nullable<
|
|
26
|
+
get(url: string, user: Nullable<User>): Promise<Nullable<UnknownEnrollment>>;
|
|
27
|
+
isEnrolled(enrollment: Maybe<Nullable<UnknownEnrollment>>): Promise<Maybe<boolean>>;
|
|
28
28
|
set(
|
|
29
29
|
url: string,
|
|
30
30
|
user: User,
|
|
31
|
-
enrollment?: Maybe<Nullable<
|
|
31
|
+
enrollment?: Maybe<Nullable<UnknownEnrollment>>,
|
|
32
32
|
isActive?: boolean,
|
|
33
33
|
): Promise<boolean>;
|
|
34
34
|
meta?: {
|
package/js/types/index.ts
CHANGED
|
@@ -69,5 +69,4 @@ export interface OpenEdXEnrollment {
|
|
|
69
69
|
* Use an unknown type to make sure we do not depend on any LMS-specific fields
|
|
70
70
|
* on enrollment objects, just use HTTP response codes.
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
export type Enrollment = unknown;
|
|
72
|
+
export type UnknownEnrollment = unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Maybe, Nullable } from 'types/utils';
|
|
2
|
+
import { tokens } from 'utils/cunningham-tokens';
|
|
2
3
|
|
|
3
4
|
export class StringHelper {
|
|
4
5
|
static isString(input: any): boolean {
|
|
@@ -19,4 +20,22 @@ export class StringHelper {
|
|
|
19
20
|
.join('')
|
|
20
21
|
.toUpperCase();
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
static toColor(
|
|
25
|
+
string: string,
|
|
26
|
+
saturation = tokens.themes.default.components.dashboardListAvatar.saturation,
|
|
27
|
+
lightness = tokens.themes.default.components.dashboardListAvatar.lightness,
|
|
28
|
+
): string {
|
|
29
|
+
let hash = 0;
|
|
30
|
+
for (let i = 0; i < string.length; i++) {
|
|
31
|
+
// eslint-disable-next-line no-bitwise
|
|
32
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
33
|
+
// eslint-disable-next-line no-bitwise
|
|
34
|
+
hash &= hash;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const hue = hash % 360;
|
|
38
|
+
|
|
39
|
+
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
40
|
+
}
|
|
22
41
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export const tokens = {
|
|
2
|
+
themes: {
|
|
3
|
+
default: {
|
|
4
|
+
theme: {
|
|
5
|
+
colors: {
|
|
6
|
+
'secondary-text': '#555F6B',
|
|
7
|
+
'secondary-100': '#eff8ff',
|
|
8
|
+
'secondary-200': '#eaf3fd',
|
|
9
|
+
'secondary-300': '#e2ebf5',
|
|
10
|
+
'secondary-400': '#c0c9d3',
|
|
11
|
+
'secondary-500': '#a3abb4',
|
|
12
|
+
'secondary-600': '#79818a',
|
|
13
|
+
'secondary-700': '#656c75',
|
|
14
|
+
'secondary-800': '#454d55',
|
|
15
|
+
'secondary-900': '#242b32',
|
|
16
|
+
'info-text': '#FFFFFF',
|
|
17
|
+
'info-100': '#EBF2FC',
|
|
18
|
+
'info-200': '#8CB5EA',
|
|
19
|
+
'info-300': '#5894E1',
|
|
20
|
+
'info-400': '#377FDB',
|
|
21
|
+
'info-500': '#055FD2',
|
|
22
|
+
'info-600': '#0556BF',
|
|
23
|
+
'info-700': '#044395',
|
|
24
|
+
'info-800': '#033474',
|
|
25
|
+
'info-900': '#022858',
|
|
26
|
+
'greyscale-100': '#FAFAFB',
|
|
27
|
+
'greyscale-200': '#F3F4F4',
|
|
28
|
+
'greyscale-300': '#E7E8EA',
|
|
29
|
+
'greyscale-400': '#C2C6CA',
|
|
30
|
+
'greyscale-500': '#9EA3AA',
|
|
31
|
+
'greyscale-600': '#79818A',
|
|
32
|
+
'greyscale-700': '#555F6B',
|
|
33
|
+
'greyscale-800': '#303C4B',
|
|
34
|
+
'greyscale-900': '#0C1A2B',
|
|
35
|
+
'greyscale-000': '#FFFFFF',
|
|
36
|
+
'primary-100': '#ffcad1',
|
|
37
|
+
'primary-200': '#f19597',
|
|
38
|
+
'primary-300': '#e86a6f',
|
|
39
|
+
'primary-400': '#f2444b',
|
|
40
|
+
'primary-500': '#f72c30',
|
|
41
|
+
'primary-600': '#e81f2f',
|
|
42
|
+
'primary-700': '#d60f29',
|
|
43
|
+
'primary-800': '#c90022',
|
|
44
|
+
'primary-900': '#bb0014',
|
|
45
|
+
'success-100': '#EFFCD3',
|
|
46
|
+
'success-200': '#DBFAA9',
|
|
47
|
+
'success-300': '#BEF27C',
|
|
48
|
+
'success-400': '#A0E659',
|
|
49
|
+
'success-500': '#76D628',
|
|
50
|
+
'success-600': '#5AB81D',
|
|
51
|
+
'success-700': '#419A14',
|
|
52
|
+
'success-800': '#2C7C0C',
|
|
53
|
+
'success-900': '#1D6607',
|
|
54
|
+
'warning-100': '#FFF8CD',
|
|
55
|
+
'warning-200': '#FFEF9B',
|
|
56
|
+
'warning-300': '#FFE469',
|
|
57
|
+
'warning-400': '#FFDA43',
|
|
58
|
+
'warning-500': '#FFC805',
|
|
59
|
+
'warning-600': '#DBA603',
|
|
60
|
+
'warning-700': '#B78702',
|
|
61
|
+
'warning-800': '#936901',
|
|
62
|
+
'warning-900': '#7A5400',
|
|
63
|
+
'danger-100': '#F4B0B0',
|
|
64
|
+
'danger-200': '#EE8A8A',
|
|
65
|
+
'danger-300': '#E65454',
|
|
66
|
+
'danger-400': '#E13333',
|
|
67
|
+
'danger-500': '#DA0000',
|
|
68
|
+
'danger-600': '#C60000',
|
|
69
|
+
'danger-700': '#9B0000',
|
|
70
|
+
'danger-800': '#780000',
|
|
71
|
+
'danger-900': '#5C0000',
|
|
72
|
+
'primary-text': '#FFFFFF',
|
|
73
|
+
'success-text': '#FFFFFF',
|
|
74
|
+
'warning-text': '#FFFFFF',
|
|
75
|
+
'danger-text': '#FFFFFF',
|
|
76
|
+
black: '#090909',
|
|
77
|
+
'dark-grey': '#232323',
|
|
78
|
+
charcoal: '#29303b',
|
|
79
|
+
'slate-grey': '#686868',
|
|
80
|
+
'battleship-grey': '#686f7a',
|
|
81
|
+
'light-grey': '#d2d2d2',
|
|
82
|
+
silver: '#d5dbe0',
|
|
83
|
+
azure2: '#eceff1',
|
|
84
|
+
smoke: '#fdfdfd',
|
|
85
|
+
white: '#ffffff',
|
|
86
|
+
denim: '#0067b7',
|
|
87
|
+
firebrick6: '#f72c30',
|
|
88
|
+
'purplish-grey': '#726c74',
|
|
89
|
+
grey32: '#525151',
|
|
90
|
+
grey59: '#969696',
|
|
91
|
+
grey87: '#dfdfdf',
|
|
92
|
+
indianred3: '#df484b',
|
|
93
|
+
midnightblue: '#141b2c',
|
|
94
|
+
mantis: '#76ce68',
|
|
95
|
+
},
|
|
96
|
+
font: {
|
|
97
|
+
sizes: {
|
|
98
|
+
h1: '1.75rem',
|
|
99
|
+
h2: '1.375rem',
|
|
100
|
+
h3: '1.125rem',
|
|
101
|
+
h4: '0.8125rem',
|
|
102
|
+
h5: '0.625rem',
|
|
103
|
+
h6: '0.5rem',
|
|
104
|
+
l: '1rem',
|
|
105
|
+
m: '0.8125rem',
|
|
106
|
+
s: '0.6875rem',
|
|
107
|
+
},
|
|
108
|
+
weights: {
|
|
109
|
+
thin: 200,
|
|
110
|
+
light: 300,
|
|
111
|
+
regular: 400,
|
|
112
|
+
medium: 500,
|
|
113
|
+
bold: 600,
|
|
114
|
+
extrabold: 700,
|
|
115
|
+
black: 800,
|
|
116
|
+
},
|
|
117
|
+
families: { base: 'Hind', accent: 'Montserrat' },
|
|
118
|
+
letterSpacings: {
|
|
119
|
+
h1: 'normal',
|
|
120
|
+
h2: 'normal',
|
|
121
|
+
h3: 'normal',
|
|
122
|
+
h4: 'normal',
|
|
123
|
+
h5: '1px',
|
|
124
|
+
h6: 'normal',
|
|
125
|
+
l: 'normal',
|
|
126
|
+
m: 'normal',
|
|
127
|
+
s: 'normal',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
spacings: { xl: '4rem', l: '3rem', b: '1.625rem', s: '1rem', t: '0.5rem', st: '0.25rem' },
|
|
131
|
+
transitions: {
|
|
132
|
+
'ease-in': 'cubic-bezier(0.32, 0, 0.67, 0)',
|
|
133
|
+
'ease-out': 'cubic-bezier(0.33, 1, 0.68, 1)',
|
|
134
|
+
'ease-in-out': 'cubic-bezier(0.65, 0, 0.35, 1)',
|
|
135
|
+
duration: '250ms',
|
|
136
|
+
},
|
|
137
|
+
breakpoints: { xs: 0, sm: '576px', md: '768px', lg: '992px', xl: '1200px', xxl: '1400px' },
|
|
138
|
+
},
|
|
139
|
+
components: {
|
|
140
|
+
button: { 'font-family': 'Montserrat' },
|
|
141
|
+
dashboardListAvatar: {
|
|
142
|
+
// hsl saturation range: 0, 100
|
|
143
|
+
saturation: 30,
|
|
144
|
+
// hsl lightness range: 0, 100
|
|
145
|
+
lightness: 55,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
dark: {
|
|
150
|
+
theme: {
|
|
151
|
+
colors: {
|
|
152
|
+
'greyscale-100': '#182536',
|
|
153
|
+
'greyscale-200': '#303C4B',
|
|
154
|
+
'greyscale-300': '#555F6B',
|
|
155
|
+
'greyscale-400': '#79818A',
|
|
156
|
+
'greyscale-500': '#9EA3AA',
|
|
157
|
+
'greyscale-600': '#C2C6CA',
|
|
158
|
+
'greyscale-700': '#E7E8EA',
|
|
159
|
+
'greyscale-800': '#F3F4F4',
|
|
160
|
+
'greyscale-900': '#FAFAFB',
|
|
161
|
+
'greyscale-000': '#0C1A2B',
|
|
162
|
+
'primary-100': '#3B4C62',
|
|
163
|
+
'primary-200': '#4D6481',
|
|
164
|
+
'primary-300': '#6381A6',
|
|
165
|
+
'primary-400': '#7FA5D5',
|
|
166
|
+
'primary-500': '#8CB5EA',
|
|
167
|
+
'primary-600': '#A3C4EE',
|
|
168
|
+
'primary-700': '#C3D8F4',
|
|
169
|
+
'primary-800': '#DDE9F8',
|
|
170
|
+
'primary-900': '#F4F8FD',
|
|
171
|
+
'success-100': '#EEF8D7',
|
|
172
|
+
'success-200': '#D9F1B2',
|
|
173
|
+
'success-300': '#BDE985',
|
|
174
|
+
'success-400': '#A0E25D',
|
|
175
|
+
'success-500': '#76D628',
|
|
176
|
+
'success-600': '#5BB520',
|
|
177
|
+
'success-700': '#43941A',
|
|
178
|
+
'success-800': '#307414',
|
|
179
|
+
'success-900': '#225D10',
|
|
180
|
+
'warning-100': '#F7F3D5',
|
|
181
|
+
'warning-200': '#F0E5AA',
|
|
182
|
+
'warning-300': '#E8D680',
|
|
183
|
+
'warning-400': '#E3C95F',
|
|
184
|
+
'warning-500': '#D9B32B',
|
|
185
|
+
'warning-600': '#BD9721',
|
|
186
|
+
'warning-700': '#9D7B1C',
|
|
187
|
+
'warning-800': '#7E6016',
|
|
188
|
+
'warning-900': '#684D12',
|
|
189
|
+
'danger-100': '#F8D0D0',
|
|
190
|
+
'danger-200': '#F09898',
|
|
191
|
+
'danger-300': '#F09898',
|
|
192
|
+
'danger-400': '#ED8585',
|
|
193
|
+
'danger-500': '#E96666',
|
|
194
|
+
'danger-600': '#DD6666',
|
|
195
|
+
'danger-700': '#C36666',
|
|
196
|
+
'danger-800': '#AE6666',
|
|
197
|
+
'danger-900': '#9D6666',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
};
|
|
@@ -2,14 +2,7 @@ import { faker } from '@faker-js/faker';
|
|
|
2
2
|
import { User } from 'types/User';
|
|
3
3
|
import { APIBackend } from 'types/api';
|
|
4
4
|
import { CommonDataProps } from 'types/commonDataProps';
|
|
5
|
-
import {
|
|
6
|
-
CourseRun,
|
|
7
|
-
CourseRunDisplayMode,
|
|
8
|
-
CourseState,
|
|
9
|
-
CourseStateTextEnum,
|
|
10
|
-
Enrollment,
|
|
11
|
-
Priority,
|
|
12
|
-
} from 'types';
|
|
5
|
+
import { CourseRun, CourseRunDisplayMode, CourseState, CourseStateTextEnum, Priority } from 'types';
|
|
13
6
|
import { Course } from 'types/Course';
|
|
14
7
|
import { FactoryHelper } from 'utils/test/factories/helper';
|
|
15
8
|
import { factory } from './factories';
|
|
@@ -142,15 +135,6 @@ export const CourseRunFactoryFromPriority = (priority: Priority) => {
|
|
|
142
135
|
});
|
|
143
136
|
};
|
|
144
137
|
|
|
145
|
-
export const EnrollmentFactory = factory<Enrollment>(() => {
|
|
146
|
-
return {
|
|
147
|
-
id: faker.string.uuid(),
|
|
148
|
-
created_at: faker.date.past().toISOString(),
|
|
149
|
-
user: faker.string.uuid(),
|
|
150
|
-
course_run: faker.string.uuid(),
|
|
151
|
-
};
|
|
152
|
-
});
|
|
153
|
-
|
|
154
138
|
export const UserFactory = factory<User>(() => ({
|
|
155
139
|
access_token: faker.lorem.word(12),
|
|
156
140
|
full_name: faker.person.fullName(),
|
|
@@ -12,11 +12,13 @@ export interface DashboardAvatarProps {
|
|
|
12
12
|
title: string;
|
|
13
13
|
image?: Nullable<JoanieFile>;
|
|
14
14
|
variant?: DashboardAvatarVariantEnum;
|
|
15
|
+
backgroundColor?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const DashboardAvatar = ({
|
|
18
19
|
title,
|
|
19
20
|
image,
|
|
21
|
+
backgroundColor,
|
|
20
22
|
variant = DashboardAvatarVariantEnum.DEFAULT,
|
|
21
23
|
}: DashboardAvatarProps) => {
|
|
22
24
|
return (
|
|
@@ -25,6 +27,7 @@ export const DashboardAvatar = ({
|
|
|
25
27
|
className={c('dashboard__avatar', {
|
|
26
28
|
'dashboard__avatar--square': variant === DashboardAvatarVariantEnum.SQUARE,
|
|
27
29
|
})}
|
|
30
|
+
style={{ backgroundColor }}
|
|
28
31
|
>
|
|
29
32
|
{image ? (
|
|
30
33
|
<img
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { tokens } from 'utils/cunningham-tokens';
|
|
4
|
+
import DashboardListAvatar from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: DashboardListAvatar,
|
|
8
|
+
} as Meta<typeof DashboardListAvatar>;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof DashboardListAvatar>;
|
|
11
|
+
|
|
12
|
+
const names = [
|
|
13
|
+
'Misty Lesch',
|
|
14
|
+
'Jo Schoen',
|
|
15
|
+
'Ida Goyette',
|
|
16
|
+
'Robin Carroll',
|
|
17
|
+
'Dr. Natalie Kutch',
|
|
18
|
+
'Warren Schiller',
|
|
19
|
+
'Mr. Delbert Rogahn',
|
|
20
|
+
'Neal Kshlerin',
|
|
21
|
+
'Virginia Kuhlman',
|
|
22
|
+
'Robert Baumbach',
|
|
23
|
+
'Kenneth Okuneva',
|
|
24
|
+
'Joe Raynor',
|
|
25
|
+
'Edmond Hegmann',
|
|
26
|
+
'Jaime Huels',
|
|
27
|
+
'Marcos Schaden',
|
|
28
|
+
'Antoinette Dietrich',
|
|
29
|
+
'Lynn Jast',
|
|
30
|
+
'Mrs. Edith Schamberger',
|
|
31
|
+
'Dr. Leo Huels',
|
|
32
|
+
'Lena Wilkinson',
|
|
33
|
+
'Corey Schmidt',
|
|
34
|
+
'Constance Wyman',
|
|
35
|
+
'Stacy Nolan-Rempel',
|
|
36
|
+
'Jo Rowe',
|
|
37
|
+
'Mike Swift',
|
|
38
|
+
'Yvonne Kutch V',
|
|
39
|
+
'Norma Bahringer-Wiegand I',
|
|
40
|
+
'Randy Berge-Goldner',
|
|
41
|
+
'Gayle Denesik',
|
|
42
|
+
'Kristina Stracke',
|
|
43
|
+
'Kenneth Greenholt',
|
|
44
|
+
'Margarita Bergstrom',
|
|
45
|
+
'Kim Herman DDS',
|
|
46
|
+
'Beatrice Rodriguez',
|
|
47
|
+
'Lori Balistreri',
|
|
48
|
+
'Priscilla Dietrich-Frami',
|
|
49
|
+
'Mr. Laurence Welch',
|
|
50
|
+
'Harold Pollich',
|
|
51
|
+
'Percy Grimes',
|
|
52
|
+
'Colin Ryan',
|
|
53
|
+
'Maxine Bogisich I',
|
|
54
|
+
'Vernon Hamill',
|
|
55
|
+
'Ms. Eva Gusikowski',
|
|
56
|
+
'Mrs. Phyllis Swaniawski',
|
|
57
|
+
'Bobbie Kilback',
|
|
58
|
+
'Dr. Roberto Bayer',
|
|
59
|
+
'Pam Waters-Ankunding',
|
|
60
|
+
'Gabriel White DVM',
|
|
61
|
+
'Danny Little',
|
|
62
|
+
'Leonard Ratke',
|
|
63
|
+
'Jeremy Nicolas',
|
|
64
|
+
'Ora Macejkovic PhD',
|
|
65
|
+
'Jacquelyn Kuhlman',
|
|
66
|
+
'Hattie Satterfield',
|
|
67
|
+
'Tricia Heaney-Jacobson',
|
|
68
|
+
'Mamie Smitham',
|
|
69
|
+
'Cedric Collins',
|
|
70
|
+
'Myrtle Oberbrunner IV',
|
|
71
|
+
'Olga Bernier Sr.',
|
|
72
|
+
'Isaac Reichel-Zieme MD',
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const DashboardListAvatarList = ({ title, children }: PropsWithChildren<{ title: string }>) => {
|
|
76
|
+
return (
|
|
77
|
+
<div>
|
|
78
|
+
<h2 style={{ marginBottom: '1em' }}>{title}</h2>
|
|
79
|
+
<div
|
|
80
|
+
style={{
|
|
81
|
+
display: 'grid',
|
|
82
|
+
gap: '1rem',
|
|
83
|
+
gridTemplateColumns: 'repeat(15, minmax(max-content, 1fr))',
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{children}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const Default: Story = {
|
|
93
|
+
render: () => {
|
|
94
|
+
const colorSettingList = [
|
|
95
|
+
{
|
|
96
|
+
title: `Current: saturation ${tokens.themes.default.components.dashboardListAvatar.saturation}, lightness: ${tokens.themes.default.components.dashboardListAvatar.lightness}`,
|
|
97
|
+
saturation: tokens.themes.default.components.dashboardListAvatar.saturation,
|
|
98
|
+
lightness: tokens.themes.default.components.dashboardListAvatar.lightness,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: 'saturation 50, lightness: 55',
|
|
102
|
+
saturation: 50,
|
|
103
|
+
lightness: 55,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: 'saturation 40, lightness: 55',
|
|
107
|
+
saturation: 40,
|
|
108
|
+
lightness: 55,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
title: 'saturation 35, lightness: 55',
|
|
112
|
+
saturation: 35,
|
|
113
|
+
lightness: 55,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: 'saturation 30, lightness: 55',
|
|
117
|
+
saturation: 30,
|
|
118
|
+
lightness: 55,
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '2em' }}>
|
|
124
|
+
{colorSettingList.map(({ title, ...colorSetting }) => (
|
|
125
|
+
<DashboardListAvatarList title={title}>
|
|
126
|
+
{names.map((name) => (
|
|
127
|
+
<DashboardListAvatar title={name} {...colorSetting} />
|
|
128
|
+
))}
|
|
129
|
+
</DashboardListAvatarList>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { StringHelper } from 'utils/StringHelper';
|
|
1
2
|
import { DashboardAvatar, DashboardAvatarProps } from '../DashboardAvatar';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface DashboardListAvatarProps extends DashboardAvatarProps {
|
|
5
|
+
saturation?: number;
|
|
6
|
+
lightness?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const DashboardListAvatar = ({
|
|
10
|
+
saturation,
|
|
11
|
+
lightness,
|
|
12
|
+
...avatarProps
|
|
13
|
+
}: DashboardListAvatarProps) => {
|
|
14
|
+
const backgroundColor = StringHelper.toColor(avatarProps.title, saturation, lightness);
|
|
4
15
|
return (
|
|
5
16
|
<div className="dashboard-list-avatar__container">
|
|
6
|
-
<DashboardAvatar {...
|
|
17
|
+
<DashboardAvatar {...avatarProps} backgroundColor={backgroundColor} />
|
|
7
18
|
</div>
|
|
8
19
|
);
|
|
9
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "richie-education",
|
|
3
|
-
"version": "2.25.0-b2.
|
|
3
|
+
"version": "2.25.0-b2.dev131",
|
|
4
4
|
"description": "A CMS to build learning portals for Open Education",
|
|
5
5
|
"main": "sandbox/manage.py",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"watch-ts": "yarn build-ts --watch",
|
|
18
18
|
"storybook": "storybook dev -p 6006",
|
|
19
19
|
"build-storybook": "storybook build",
|
|
20
|
-
"build-theme": "cunningham -g scss -o scss/vendors && cunningham -g css -o scss/vendors/css"
|
|
20
|
+
"build-theme": "cunningham -g scss -o scss/vendors && cunningham -g css -o scss/vendors/css -g ts -o js/utils/"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|