-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Library v2 components tab (#1109)
- Loading branch information
Showing
30 changed files
with
721 additions
and
117 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import { | ||
BackHand as BackHandIcon, | ||
BookOpen as BookOpenIcon, | ||
Edit as EditIcon, | ||
EditNote as EditNoteIcon, | ||
FormatListBulleted as FormatListBulletedIcon, | ||
HelpOutline as HelpOutlineIcon, | ||
LibraryAdd as LibraryIcon, | ||
Lock as LockIcon, | ||
QuestionAnswerOutline as QuestionAnswerOutlineIcon, | ||
Science as ScienceIcon, | ||
TextFields as TextFieldsIcon, | ||
VideoCamera as VideoCameraIcon, | ||
Folder, | ||
} from '@openedx/paragon/icons'; | ||
|
||
export const UNIT_ICON_TYPES = ['video', 'other', 'vertical', 'problem', 'lock']; | ||
|
||
export const COMPONENT_TYPES = { | ||
advanced: 'advanced', | ||
discussion: 'discussion', | ||
library: 'library', | ||
html: 'html', | ||
openassessment: 'openassessment', | ||
problem: 'problem', | ||
video: 'video', | ||
dragAndDrop: 'drag-and-drop-v2', | ||
}; | ||
|
||
export const UNIT_TYPE_ICONS_MAP: Record<string, React.ComponentType> = { | ||
video: VideoCameraIcon, | ||
other: BookOpenIcon, | ||
vertical: FormatListBulletedIcon, | ||
problem: EditIcon, | ||
lock: LockIcon, | ||
}; | ||
|
||
export const COMPONENT_TYPE_ICON_MAP: Record<string, React.ComponentType> = { | ||
[COMPONENT_TYPES.advanced]: ScienceIcon, | ||
[COMPONENT_TYPES.discussion]: QuestionAnswerOutlineIcon, | ||
[COMPONENT_TYPES.library]: LibraryIcon, | ||
[COMPONENT_TYPES.html]: TextFieldsIcon, | ||
[COMPONENT_TYPES.openassessment]: EditNoteIcon, | ||
[COMPONENT_TYPES.problem]: HelpOutlineIcon, | ||
[COMPONENT_TYPES.video]: VideoCameraIcon, | ||
[COMPONENT_TYPES.dragAndDrop]: BackHandIcon, | ||
}; | ||
|
||
export const STRUCTURAL_TYPE_ICONS: Record<string, React.ComponentType> = { | ||
vertical: UNIT_TYPE_ICONS_MAP.vertical, | ||
sequential: Folder, | ||
chapter: Folder, | ||
}; | ||
|
||
export const COMPONENT_TYPE_STYLE_COLOR_MAP = { | ||
[COMPONENT_TYPES.advanced]: 'component-style-other', | ||
[COMPONENT_TYPES.discussion]: 'component-style-default', | ||
[COMPONENT_TYPES.library]: 'component-style-default', | ||
[COMPONENT_TYPES.html]: 'component-style-html', | ||
[COMPONENT_TYPES.openassessment]: 'component-style-default', | ||
[COMPONENT_TYPES.problem]: 'component-style-default', | ||
[COMPONENT_TYPES.video]: 'component-style-video', | ||
[COMPONENT_TYPES.dragAndDrop]: 'component-style-default', | ||
vertical: 'component-style-vertical', | ||
sequential: 'component-style-default', | ||
chapter: 'component-style-default', | ||
collection: 'component-style-collection', | ||
}; |
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,47 @@ | ||
.component-style-default { | ||
background-color: #005C9E; | ||
|
||
.pgn__icon { | ||
color: white; | ||
} | ||
} | ||
|
||
.component-style-html { | ||
background-color: #9747FF; | ||
|
||
.pgn__icon { | ||
color: white; | ||
} | ||
} | ||
|
||
.component-style-collection { | ||
background-color: #FFCD29; | ||
|
||
.pgn__icon { | ||
color: black; | ||
} | ||
} | ||
|
||
.component-style-video { | ||
background-color: #358F0A; | ||
|
||
.pgn__icon { | ||
color: white; | ||
} | ||
} | ||
|
||
.component-style-vertical { | ||
background-color: #0B8E77; | ||
|
||
.pgn__icon { | ||
color: white; | ||
} | ||
} | ||
|
||
.component-style-other { | ||
background-color: #646464; | ||
|
||
.pgn__icon { | ||
color: white; | ||
} | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import { Article } from '@openedx/paragon/icons'; | ||
import { | ||
COMPONENT_TYPE_ICON_MAP, | ||
STRUCTURAL_TYPE_ICONS, | ||
COMPONENT_TYPE_STYLE_COLOR_MAP, | ||
} from './constants'; | ||
|
||
export function getItemIcon(blockType: string): React.ComponentType { | ||
return STRUCTURAL_TYPE_ICONS[blockType] ?? COMPONENT_TYPE_ICON_MAP[blockType] ?? Article; | ||
} | ||
|
||
export function getComponentStyleColor(blockType: string): string { | ||
return COMPONENT_TYPE_STYLE_COLOR_MAP[blockType] ?? 'bg-component'; | ||
} |
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 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
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,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as libraryComponentsMock } from './libraryComponentsMock'; |
Oops, something went wrong.