@selfcommunity/react-templates 0.4.5-courses.115 → 0.4.5-courses.116
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.
|
@@ -40,8 +40,14 @@ export interface LessonProps {
|
|
|
40
40
|
editMode?: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Callback fired on edit mode close
|
|
43
|
+
* @default null
|
|
44
|
+
*/
|
|
45
|
+
onEditModeClose?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Handler on lesson change
|
|
48
|
+
* @default null
|
|
43
49
|
*/
|
|
44
|
-
|
|
50
|
+
onLessonChange?: (id: any) => void;
|
|
45
51
|
/**
|
|
46
52
|
* Any other properties
|
|
47
53
|
*/
|
|
@@ -36,7 +36,7 @@ function Lesson(inProps) {
|
|
|
36
36
|
props: inProps,
|
|
37
37
|
name: constants_1.PREFIX
|
|
38
38
|
});
|
|
39
|
-
const { className = null, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {}, editMode = false,
|
|
39
|
+
const { className = null, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {}, editMode = false, onEditModeClose = null, onLessonChange = null } = props, rest = tslib_1.__rest(props, ["className", "courseId", "sectionId", "lesson", "lessonId", "LessonAppbarProps", "LessonDrawerProps", "editMode", "onEditModeClose", "onLessonChange"]);
|
|
40
40
|
// HOOKS
|
|
41
41
|
const theme = (0, material_1.useTheme)();
|
|
42
42
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
@@ -63,7 +63,7 @@ function Lesson(inProps) {
|
|
|
63
63
|
};
|
|
64
64
|
const handleCloseDrawer = () => {
|
|
65
65
|
setActivePanel(null);
|
|
66
|
-
|
|
66
|
+
onEditModeClose && onEditModeClose();
|
|
67
67
|
};
|
|
68
68
|
const handleLessonContentEdit = (html) => {
|
|
69
69
|
setLessonContent(html);
|
|
@@ -75,6 +75,7 @@ function Lesson(inProps) {
|
|
|
75
75
|
setLessonId(l.id);
|
|
76
76
|
setSectionId(s.id);
|
|
77
77
|
setCurrentSection(s);
|
|
78
|
+
onLessonChange && onLessonChange(l.id);
|
|
78
79
|
};
|
|
79
80
|
/**
|
|
80
81
|
* Handles Lesson Edit
|
|
@@ -40,8 +40,14 @@ export interface LessonProps {
|
|
|
40
40
|
editMode?: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Callback fired on edit mode close
|
|
43
|
+
* @default null
|
|
44
|
+
*/
|
|
45
|
+
onEditModeClose?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Handler on lesson change
|
|
48
|
+
* @default null
|
|
43
49
|
*/
|
|
44
|
-
|
|
50
|
+
onLessonChange?: (id: any) => void;
|
|
45
51
|
/**
|
|
46
52
|
* Any other properties
|
|
47
53
|
*/
|
|
@@ -34,7 +34,7 @@ export default function Lesson(inProps) {
|
|
|
34
34
|
props: inProps,
|
|
35
35
|
name: PREFIX
|
|
36
36
|
});
|
|
37
|
-
const { className = null, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {}, editMode = false,
|
|
37
|
+
const { className = null, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {}, editMode = false, onEditModeClose = null, onLessonChange = null } = props, rest = __rest(props, ["className", "courseId", "sectionId", "lesson", "lessonId", "LessonAppbarProps", "LessonDrawerProps", "editMode", "onEditModeClose", "onLessonChange"]);
|
|
38
38
|
// HOOKS
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
@@ -61,7 +61,7 @@ export default function Lesson(inProps) {
|
|
|
61
61
|
};
|
|
62
62
|
const handleCloseDrawer = () => {
|
|
63
63
|
setActivePanel(null);
|
|
64
|
-
|
|
64
|
+
onEditModeClose && onEditModeClose();
|
|
65
65
|
};
|
|
66
66
|
const handleLessonContentEdit = (html) => {
|
|
67
67
|
setLessonContent(html);
|
|
@@ -73,6 +73,7 @@ export default function Lesson(inProps) {
|
|
|
73
73
|
setLessonId(l.id);
|
|
74
74
|
setSectionId(s.id);
|
|
75
75
|
setCurrentSection(s);
|
|
76
|
+
onLessonChange && onLessonChange(l.id);
|
|
76
77
|
};
|
|
77
78
|
/**
|
|
78
79
|
* Handles Lesson Edit
|