Reusable page style for lectures

This commit is contained in:
Ibitoye Rotimi Best
2021-07-01 09:31:26 +03:00
parent e14c84a1bf
commit b76d1c9647
12 changed files with 290 additions and 203 deletions
+32
View File
@@ -0,0 +1,32 @@
const ROUTES = {
COURSES: "courses",
LECTURES: "lecture",
};
export function getNavItemRoute(courseId, routeId) {
const path = `/${ROUTES.COURSES}/${courseId}`;
if (!routeId) {
return path;
}
return `${path}/${routeId}`;
}
export function getLectureRoute(courseId, lectureId) {
const path = getNavItemRoute(courseId, ROUTES.LECTURES);
if (!lectureId) {
return path;
}
return `${path}/${lectureId}`;
}
export function getLectureNo(index) {
if (index < 9) {
return `00${index}`;
}
return `0${index}`;
}