-
Notifications
You must be signed in to change notification settings - Fork 178
feat: Make sections/subsections/units selectable in course outline [FC-0114] #2732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
06ae806
071c47c
e7903e9
675c026
a6c67af
f26179d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ const TitleLink = ({ | |
| to={titleLink} | ||
| title={title} | ||
| > | ||
| <span className={`${namePrefix}-card-title mb-0 truncate-1-line text-left`}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change intentional?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I forgot to update it. I added f26179d to meet the requirement |
||
| <span className={`${namePrefix}-card-title truncate-1-line mb-0 text-left`}> | ||
| {title} | ||
| </span> | ||
| </Button> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { | |
| useState, | ||
| } from 'react'; | ||
| import { useIntl } from '@edx/frontend-platform/i18n'; | ||
| import { getConfig } from '@edx/frontend-platform'; | ||
| import { useToggle } from '@openedx/paragon'; | ||
| import { HelpOutline, Info } from '@openedx/paragon/icons'; | ||
|
|
||
|
|
@@ -25,6 +26,8 @@ interface OutlineSidebarContextData { | |
| open: () => void; | ||
| toggle: () => void; | ||
| sidebarPages: OutlineSidebarPages; | ||
| selectedContainerId?: string; | ||
| openContainerInfoSidebar: (containerId: string) => void; | ||
| } | ||
|
|
||
| const OutlineSidebarContext = createContext<OutlineSidebarContextData | undefined>(undefined); | ||
|
|
@@ -35,6 +38,14 @@ export const OutlineSidebarProvider = ({ children }: { children?: React.ReactNod | |
| const [currentPageKey, setCurrentPageKeyState] = useState<OutlineSidebarPageKeys>('info'); | ||
| const [isOpen, open, , toggle] = useToggle(true); | ||
|
|
||
| const [selectedContainerId, setSelectedContainerId] = useState<string | undefined>(); | ||
|
|
||
| const openContainerInfoSidebar = useCallback((containerId: string) => { | ||
| if (getConfig().ENABLE_COURSE_OUTLINE_NEW_DESIGN?.toString().toLowerCase() === 'true') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Should/could we put It could even be a waffle flag, then you can use |
||
| setSelectedContainerId(containerId); | ||
| } | ||
| }, [setSelectedContainerId]); | ||
|
|
||
| const setCurrentPageKey = useCallback((pageKey: OutlineSidebarPageKeys) => { | ||
| setCurrentPageKeyState(pageKey); | ||
| open(); | ||
|
|
@@ -61,6 +72,8 @@ export const OutlineSidebarProvider = ({ children }: { children?: React.ReactNod | |
| isOpen, | ||
| open, | ||
| toggle, | ||
| selectedContainerId, | ||
| openContainerInfoSidebar, | ||
| }), | ||
| [ | ||
| currentPageKey, | ||
|
|
@@ -69,6 +82,8 @@ export const OutlineSidebarProvider = ({ children }: { children?: React.ReactNod | |
| isOpen, | ||
| open, | ||
| toggle, | ||
| selectedContainerId, | ||
| openContainerInfoSidebar, | ||
| ], | ||
| ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So can you "select" the card by tabbing onto it and pressing SPACE or something?
Also, this says
Cardhandles that, but in this PR I see keyboard-related code is inSortableItem- is that what you're talking about or is that something else?