@codecademy/brand 0.13.46-alpha.f0e4be1fdd.0 → 0.13.46

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.
Files changed (33) hide show
  1. package/dist/AppBar/AppBarSection.js +1 -1
  2. package/dist/AppHeader/Search/SearchWorker/index.js +2 -2
  3. package/dist/Avatar/index.js +1 -1
  4. package/dist/DropdownButton/index.js +1 -1
  5. package/dist/EmptySection/index.js +1 -1
  6. package/dist/LogoFromSkillsoft/index.js +1 -1
  7. package/dist/ProLabel/index.js +1 -1
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.js +0 -1
  10. package/package.json +3 -2
  11. package/dist/StudyPlan/ContentItemDetail.d.ts +0 -10
  12. package/dist/StudyPlan/ContentItemDetail.js +0 -114
  13. package/dist/StudyPlan/CreateStudyPlanSectionContent.d.ts +0 -14
  14. package/dist/StudyPlan/CreateStudyPlanSectionContent.js +0 -90
  15. package/dist/StudyPlan/ShowMoreContentItemsButton.d.ts +0 -9
  16. package/dist/StudyPlan/ShowMoreContentItemsButton.js +0 -44
  17. package/dist/StudyPlan/StudyPlanDeleteDialog.d.ts +0 -6
  18. package/dist/StudyPlan/StudyPlanDeleteDialog.js +0 -26
  19. package/dist/StudyPlan/StudyPlanDescription.d.ts +0 -10
  20. package/dist/StudyPlan/StudyPlanDescription.js +0 -50
  21. package/dist/StudyPlan/StudyPlanModal/StudyPlanForm.d.ts +0 -10
  22. package/dist/StudyPlan/StudyPlanModal/StudyPlanForm.js +0 -138
  23. package/dist/StudyPlan/StudyPlanModal/StudyPlanModalFooter.d.ts +0 -14
  24. package/dist/StudyPlan/StudyPlanModal/StudyPlanModalFooter.js +0 -64
  25. package/dist/StudyPlan/StudyPlanModal/index.d.ts +0 -18
  26. package/dist/StudyPlan/StudyPlanModal/index.js +0 -120
  27. package/dist/StudyPlan/SuggestedContentItemsSectionHeader.d.ts +0 -8
  28. package/dist/StudyPlan/SuggestedContentItemsSectionHeader.js +0 -58
  29. package/dist/StudyPlan/assets/studyPlanBanner.svg +0 -9
  30. package/dist/StudyPlan/helpers.d.ts +0 -75
  31. package/dist/StudyPlan/helpers.js +0 -165
  32. package/dist/StudyPlan/index.d.ts +0 -8
  33. package/dist/StudyPlan/index.js +0 -8
@@ -1,138 +0,0 @@
1
- import { Box, FlexBox, Form, Input, Text } from '@codecademy/gamut';
2
- import React from 'react';
3
- import { formatTargetTimeFrameText, studyPlanDefaultInputValues, studyPlanIncrementValues } from '../helpers';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- export const StudyPlanForm = _ref => {
6
- let {
7
- handleInputChange,
8
- studyPlanInputErrorMessage,
9
- studyPlanInputValues,
10
- targetTimeFrameInWeeks
11
- } = _ref;
12
- const {
13
- sessionLength,
14
- sessionsPerWeek
15
- } = studyPlanInputValues;
16
- const {
17
- sessionLength: sessionLengthInputErrorMessage,
18
- sessionsPerWeek: sessionsPerWeekInputErrorMessage
19
- } = studyPlanInputErrorMessage;
20
- const {
21
- sessionLength: sessionLengthDefault,
22
- sessionsPerWeek: sessionsPerWeekDefault
23
- } = studyPlanDefaultInputValues;
24
- const {
25
- sessionLength: sessionLengthIncrement,
26
- sessionsPerWeek: sessionsPerWeekIncrement
27
- } = studyPlanIncrementValues;
28
- const targetTimeFrameText = formatTargetTimeFrameText(targetTimeFrameInWeeks);
29
- return /*#__PURE__*/_jsxs(FlexBox, {
30
- column: true,
31
- borderRadius: "md",
32
- bg: "background-selected",
33
- children: [/*#__PURE__*/_jsxs(FlexBox, {
34
- column: true,
35
- px: 24,
36
- pt: 24,
37
- pb: 16,
38
- children: [/*#__PURE__*/_jsx(Text, {
39
- fontWeight: 700,
40
- mb: 12,
41
- children: "What\u2019s a good time commitment?"
42
- }), /*#__PURE__*/_jsx(Form, {
43
- children: /*#__PURE__*/_jsxs(FlexBox, {
44
- column: true,
45
- children: [/*#__PURE__*/_jsxs(FlexBox, {
46
- justifyContent: "space-between",
47
- center: true,
48
- mb: sessionsPerWeekInputErrorMessage ? 8 : 16,
49
- children: [/*#__PURE__*/_jsxs(FlexBox, {
50
- children: [/*#__PURE__*/_jsx(Text, {
51
- children: "Days per week"
52
- }), /*#__PURE__*/_jsx(Text, {
53
- as: "span",
54
- "aria-hidden": true,
55
- children: "*"
56
- })]
57
- }), /*#__PURE__*/_jsx(Box, {
58
- width: "100%",
59
- maxWidth: 100,
60
- children: /*#__PURE__*/_jsx(Input, {
61
- htmlFor: "sessionsPerWeek",
62
- required: true,
63
- "aria-label": "Days per week",
64
- name: "sessionsPerWeek",
65
- type: "number",
66
- max: 7,
67
- min: sessionsPerWeekIncrement,
68
- step: sessionsPerWeekIncrement,
69
- error: !!sessionsPerWeekInputErrorMessage,
70
- defaultValue: sessionsPerWeek || sessionsPerWeekDefault,
71
- onChange: handleInputChange
72
- })
73
- })]
74
- }), sessionsPerWeekInputErrorMessage && /*#__PURE__*/_jsx(FlexBox, {
75
- alignSelf: "flex-end",
76
- mb: 16,
77
- children: /*#__PURE__*/_jsx(Text, {
78
- fontSize: 14,
79
- textColor: "red-600",
80
- children: sessionsPerWeekInputErrorMessage
81
- })
82
- }), /*#__PURE__*/_jsxs(FlexBox, {
83
- justifyContent: "space-between",
84
- center: true,
85
- children: [/*#__PURE__*/_jsxs(FlexBox, {
86
- children: [/*#__PURE__*/_jsx(Text, {
87
- children: "Hours per day"
88
- }), /*#__PURE__*/_jsx(Text, {
89
- as: "span",
90
- "aria-hidden": true,
91
- children: "*"
92
- })]
93
- }), /*#__PURE__*/_jsx(Box, {
94
- width: "100%",
95
- maxWidth: 100,
96
- children: /*#__PURE__*/_jsx(Input, {
97
- htmlFor: "sessionLength",
98
- name: "sessionLength",
99
- required: true,
100
- "aria-label": "Hours per day",
101
- type: "number",
102
- max: 8,
103
- min: sessionLengthIncrement,
104
- step: sessionLengthIncrement,
105
- error: !!sessionLengthInputErrorMessage,
106
- defaultValue: sessionLength || sessionLengthDefault,
107
- onChange: handleInputChange
108
- })
109
- })]
110
- }), sessionLengthInputErrorMessage && /*#__PURE__*/_jsx(FlexBox, {
111
- alignSelf: "flex-end",
112
- fontSize: 14,
113
- mt: 8,
114
- children: /*#__PURE__*/_jsx(Text, {
115
- textColor: "red-600",
116
- children: sessionLengthInputErrorMessage
117
- })
118
- })]
119
- })
120
- })]
121
- }), /*#__PURE__*/_jsxs(FlexBox, {
122
- borderTop: 1,
123
- borderColor: "background-selected",
124
- px: 24,
125
- py: 16,
126
- justifyContent: "space-between",
127
- bg: "background-selected",
128
- center: true,
129
- children: [/*#__PURE__*/_jsx(Text, {
130
- children: "Estimated time to finish"
131
- }), /*#__PURE__*/_jsx(Text, {
132
- fontSize: 20,
133
- fontWeight: 700,
134
- children: targetTimeFrameText
135
- })]
136
- })]
137
- });
138
- };
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { StudyPlanInputValues } from '../helpers';
3
- interface StudyPlanModalFooterProps {
4
- hasStudyPlanFormInputErrors?: boolean;
5
- handleDeleteStudyPlanClick: () => void;
6
- isEditModal?: boolean;
7
- isSaveLoading: boolean;
8
- onCreateStudyPlanSave: () => void;
9
- onRequestClose: () => void;
10
- studyPlanInputValues: StudyPlanInputValues;
11
- targetTimeFrameInWeeks: number;
12
- }
13
- export declare const StudyPlanModalFooter: React.FC<StudyPlanModalFooterProps>;
14
- export {};
@@ -1,64 +0,0 @@
1
- import { FillButton, FlexBox, StrokeButton, Text, TextButton } from '@codecademy/gamut';
2
- import React from 'react';
3
- import { formatStudyPlanSummaryText, formatTargetTimeFrameText } from '../helpers';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- export const StudyPlanModalFooter = _ref => {
6
- let {
7
- hasStudyPlanFormInputErrors,
8
- handleDeleteStudyPlanClick,
9
- isEditModal,
10
- isSaveLoading,
11
- onCreateStudyPlanSave,
12
- onRequestClose,
13
- studyPlanInputValues,
14
- targetTimeFrameInWeeks
15
- } = _ref;
16
- const {
17
- sessionsPerWeek,
18
- sessionLength
19
- } = studyPlanInputValues;
20
- const primaryCtaText = isEditModal ? 'Update study plan' : 'Make study plan';
21
- const targetTimeFrameText = formatTargetTimeFrameText(targetTimeFrameInWeeks);
22
- const targetStudyPlanSummaryTime = formatStudyPlanSummaryText(sessionLength, sessionsPerWeek, targetTimeFrameText);
23
- return /*#__PURE__*/_jsxs(FlexBox, {
24
- column: true,
25
- mt: 24,
26
- children: [/*#__PURE__*/_jsx(Text, {
27
- mb: 16,
28
- children: targetStudyPlanSummaryTime
29
- }), /*#__PURE__*/_jsxs(FlexBox, {
30
- justifyContent: {
31
- _: 'flex-start',
32
- xs: isEditModal ? 'space-between' : 'flex-end'
33
- },
34
- flexDirection: {
35
- _: 'column',
36
- xs: 'row'
37
- },
38
- gap: 8,
39
- mt: 12,
40
- children: [isEditModal && /*#__PURE__*/_jsx(FlexBox, {
41
- children: /*#__PURE__*/_jsx(StrokeButton, {
42
- variant: "danger",
43
- onClick: handleDeleteStudyPlanClick,
44
- children: "Delete"
45
- })
46
- }), /*#__PURE__*/_jsxs(FlexBox, {
47
- children: [!isEditModal && /*#__PURE__*/_jsx(TextButton, {
48
- "data-testid": "secondary-modal-cta",
49
- onClick: onRequestClose,
50
- mr: 12,
51
- children: /*#__PURE__*/_jsx(Text, {
52
- color: "black",
53
- children: "Cancel"
54
- })
55
- }), /*#__PURE__*/_jsx(FillButton, {
56
- disabled: hasStudyPlanFormInputErrors || isSaveLoading,
57
- onClick: onCreateStudyPlanSave,
58
- "data-testid": "primary-modal-cta",
59
- children: primaryCtaText
60
- })]
61
- })]
62
- })]
63
- });
64
- };
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { StudyPlanInputValues } from '../helpers';
3
- interface StudyPlanModalProps {
4
- containerTimeToComplete?: number | null;
5
- containerPercentComplete?: number | null;
6
- containerTitle?: string | null;
7
- containerType?: string;
8
- handleDeleteStudyPlanClick: () => void;
9
- isEditModal?: boolean;
10
- isOpen: boolean;
11
- isSaveLoading: boolean;
12
- onCreateStudyPlanSave: () => void;
13
- onRequestClose: () => void;
14
- setStudyPlanInputValues: React.Dispatch<React.SetStateAction<StudyPlanInputValues>>;
15
- studyPlanInputValues: StudyPlanInputValues;
16
- }
17
- export declare const StudyPlanModal: React.FC<StudyPlanModalProps>;
18
- export {};
@@ -1,120 +0,0 @@
1
- import { Box, FlexBox, Modal, Text } from '@codecademy/gamut';
2
- import React, { useEffect, useMemo, useState } from 'react';
3
- import formImage from '../assets/studyPlanBanner.svg';
4
- import { calculateTargetTimeFrame, calculateTimeLeftToComplete, formatContainerTimeToCompleteText, formatContainerType, formatFormErrorMessage, validateStudyPlanFormInput } from '../helpers';
5
- import { StudyPlanForm } from './StudyPlanForm';
6
- import { StudyPlanModalFooter } from './StudyPlanModalFooter';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- export const StudyPlanModal = _ref => {
9
- let {
10
- containerTimeToComplete,
11
- containerPercentComplete,
12
- containerTitle,
13
- containerType = 'Course',
14
- handleDeleteStudyPlanClick,
15
- isEditModal,
16
- isOpen,
17
- isSaveLoading,
18
- onCreateStudyPlanSave,
19
- onRequestClose,
20
- setStudyPlanInputValues,
21
- studyPlanInputValues
22
- } = _ref;
23
- const [studyPlanInputError, setStudyPlanInputError] = useState({
24
- sessionLength: undefined,
25
- sessionsPerWeek: undefined
26
- });
27
- const hasStudyPlanFormInputErrors = !!studyPlanInputError.sessionLength || !!studyPlanInputError.sessionsPerWeek;
28
- const handleStudyPlanFormInputChange = e => {
29
- const {
30
- name,
31
- value
32
- } = e.target;
33
- const {
34
- isValidFormInputValue
35
- } = validateStudyPlanFormInput(name, value);
36
- const errorMessage = formatFormErrorMessage(name, value);
37
- if (!isValidFormInputValue) {
38
- return setStudyPlanInputError(prev => ({
39
- ...prev,
40
- [name]: errorMessage
41
- }));
42
- }
43
- setStudyPlanInputError(prev => ({
44
- ...prev,
45
- [name]: undefined
46
- }));
47
- setStudyPlanInputValues(prev => ({
48
- ...prev,
49
- [name]: Number(value)
50
- }));
51
- };
52
- const timeLeftToCompleteContainer = calculateTimeLeftToComplete(containerTimeToComplete, containerPercentComplete);
53
- const containerTimeToCompleteText = formatContainerTimeToCompleteText(timeLeftToCompleteContainer, containerTitle);
54
- const targetTimeFrameInWeeks = useMemo(() => {
55
- return calculateTargetTimeFrame(studyPlanInputValues.sessionsPerWeek, studyPlanInputValues.sessionLength, containerPercentComplete, containerTimeToComplete);
56
- }, [containerPercentComplete, containerTimeToComplete, studyPlanInputValues.sessionLength, studyPlanInputValues.sessionsPerWeek]);
57
- useEffect(() => {
58
- setStudyPlanInputValues(prev => ({
59
- ...prev,
60
- targetTimeFrame: targetTimeFrameInWeeks * 7 // save to db as days,
61
- }));
62
- }, [targetTimeFrameInWeeks, setStudyPlanInputValues]);
63
- const modalTitleText = `${formatContainerType(containerType)} study plan`;
64
- const modalTitle = /*#__PURE__*/_jsx(Box, {
65
- pb: 12,
66
- children: /*#__PURE__*/_jsx(Text, {
67
- children: modalTitleText
68
- })
69
- });
70
- return /*#__PURE__*/_jsx(Modal, {
71
- isOpen: isOpen,
72
- onRequestClose: onRequestClose,
73
- title: modalTitle,
74
- size: "small",
75
- children: /*#__PURE__*/_jsxs(FlexBox, {
76
- height: "100%",
77
- "data-testid": "study-plan-modal",
78
- column: true,
79
- p: 0,
80
- mb: 4,
81
- children: [/*#__PURE__*/_jsx(FlexBox, {
82
- maxHeight: 94,
83
- center: true,
84
- width: "100%",
85
- mb: 12,
86
- children: /*#__PURE__*/_jsx(Box, {
87
- width: "100%",
88
- height: 94,
89
- minWidth: "calc(100% + 48px)",
90
- position: "relative",
91
- backgroundImage: `url(${formImage})`
92
- })
93
- }), /*#__PURE__*/_jsxs(FlexBox, {
94
- overflowY: "auto",
95
- overflowX: "hidden",
96
- height: "100%",
97
- column: true,
98
- children: [/*#__PURE__*/_jsx(Text, {
99
- mb: 24,
100
- mt: 16,
101
- children: containerTimeToCompleteText
102
- }), /*#__PURE__*/_jsx(StudyPlanForm, {
103
- handleInputChange: handleStudyPlanFormInputChange,
104
- studyPlanInputErrorMessage: studyPlanInputError,
105
- studyPlanInputValues: studyPlanInputValues,
106
- targetTimeFrameInWeeks: targetTimeFrameInWeeks
107
- }), /*#__PURE__*/_jsx(StudyPlanModalFooter, {
108
- hasStudyPlanFormInputErrors: hasStudyPlanFormInputErrors,
109
- handleDeleteStudyPlanClick: handleDeleteStudyPlanClick,
110
- isEditModal: isEditModal,
111
- isSaveLoading: isSaveLoading,
112
- onCreateStudyPlanSave: onCreateStudyPlanSave,
113
- onRequestClose: onRequestClose,
114
- studyPlanInputValues: studyPlanInputValues,
115
- targetTimeFrameInWeeks: targetTimeFrameInWeeks
116
- })]
117
- })]
118
- })
119
- });
120
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface SuggestedContentItemsSectionHeaderProps {
3
- title: string;
4
- totalSuggestedContentItemsProgress?: number;
5
- isEnrolledSyllabus?: boolean;
6
- }
7
- export declare const SuggestedContentItemsSectionHeader: React.FC<SuggestedContentItemsSectionHeaderProps>;
8
- export {};
@@ -1,58 +0,0 @@
1
- import { Box, FlexBox, RadialProgress, Text } from '@codecademy/gamut';
2
- import { CheckIcon } from '@codecademy/gamut-icons';
3
- import React from 'react';
4
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
- export const SuggestedContentItemsSectionHeader = _ref => {
6
- let {
7
- title,
8
- totalSuggestedContentItemsProgress,
9
- isEnrolledSyllabus
10
- } = _ref;
11
- const totalProgressAriaLabel = `Study plan suggested content progress is ${totalSuggestedContentItemsProgress}%`;
12
- const isTotalProgressCompleted = totalSuggestedContentItemsProgress === 100;
13
- const shouldShowTotalProgress = totalSuggestedContentItemsProgress !== undefined;
14
- return /*#__PURE__*/_jsxs(FlexBox, {
15
- center: true,
16
- fontWeight: 700,
17
- justifyContent: "flex-start",
18
- gap: 16,
19
- mb: isEnrolledSyllabus ? {
20
- _: 8,
21
- sm: 12
22
- } : 12,
23
- children: [shouldShowTotalProgress && /*#__PURE__*/_jsx(_Fragment, {
24
- children: isTotalProgressCompleted ? /*#__PURE__*/_jsx(FlexBox, {
25
- center: true,
26
- dimensions: 44,
27
- bg: "yellow",
28
- color: "black",
29
- borderRadius: "full",
30
- "aria-label": "Study plan suggested content progress is 100%",
31
- children: /*#__PURE__*/_jsx(CheckIcon, {
32
- size: 24
33
- })
34
- }) : /*#__PURE__*/_jsx(Box, {
35
- height: 44,
36
- "aria-label": totalProgressAriaLabel,
37
- children: /*#__PURE__*/_jsx(RadialProgress, {
38
- "aria-hidden": true,
39
- baseColor: "var(--color-paleYellow)",
40
- color: "var(--color-yellow-500)",
41
- size: 44,
42
- value: totalSuggestedContentItemsProgress,
43
- children: /*#__PURE__*/_jsx(Box, {
44
- children: /*#__PURE__*/_jsx(Text, {
45
- "aria-hidden": true,
46
- fontSize: 14,
47
- textAlign: "center",
48
- children: `${totalSuggestedContentItemsProgress}%`
49
- })
50
- })
51
- })
52
- })
53
- }), /*#__PURE__*/_jsx(Text, {
54
- fontSize: isEnrolledSyllabus ? 22 : 20,
55
- children: title
56
- })]
57
- });
58
- };