-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: slot boxes are now ordered on mobile and smaller devices
- Loading branch information
1 parent
35e1ded
commit 3395f70
Showing
5 changed files
with
96 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { CourseInfo, ClassInfo, ClassDescriptor, SlotInfo } from '../../../@types' | ||
import LessonBox from './LessonBox' | ||
import ResponsiveLessonBox from './ResponsiveLessonBox' | ||
|
||
type Props = { | ||
courseInfo: CourseInfo | ||
classInfo: ClassInfo | ||
slot: SlotInfo | ||
classes: ClassDescriptor[] | ||
} | ||
|
||
const SlotBox = ({ courseInfo, classInfo, classes, slot }: Props) => { | ||
return ( | ||
<> | ||
<div className="hidden lg:flex lg:flex-col"> | ||
<LessonBox | ||
key={`course[${courseInfo.id}]-class[${classInfo.id}]-${slot.lesson_type}-${slot.id}`} | ||
courseInfo={courseInfo} | ||
classInfo={classInfo} | ||
slotInfo={slot} | ||
classes={classes.filter((classDescriptor) => classDescriptor.classInfo.id !== classInfo.id)} | ||
/> | ||
</div> | ||
|
||
<div className="lg:hidden flex flex-col "> | ||
<ResponsiveLessonBox | ||
key={`course[${courseInfo.id}]-class[${classInfo.id}]-${slot.lesson_type}-${slot.id}`} | ||
courseInfo={courseInfo} | ||
classInfo={classInfo} | ||
slotInfo={slot} | ||
/> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default SlotBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ClassDescriptor, SlotInfo } from "../../../@types" | ||
import SlotBox from "./SlotBox" | ||
|
||
type Props = { | ||
slots: Array<SlotInfo> | ||
classes: Array<ClassDescriptor> | ||
hiddenLessonsTypes: Array<string> | ||
} | ||
|
||
const SlotBoxes = ({ slots, classes, hiddenLessonsTypes }: Props) => { | ||
const filteredSlots = slots.filter((slot: SlotInfo) => !hiddenLessonsTypes.includes(slot.lesson_type)); | ||
|
||
return ( | ||
<> | ||
{ | ||
filteredSlots.map((slot: SlotInfo) => { | ||
const classDescriptor = classes.find((classDescriptor) => ( | ||
classDescriptor.classInfo.slots.filter((otherSlot) => otherSlot.id === slot.id).length > 0 | ||
)) | ||
|
||
if (!classDescriptor) return <></>; | ||
|
||
return <SlotBox | ||
courseInfo={classDescriptor.courseInfo} | ||
classInfo={classDescriptor.classInfo} | ||
classes={classes} | ||
slot={slot} | ||
/> | ||
}) | ||
} | ||
</> | ||
); | ||
} | ||
|
||
export default SlotBoxes; |