diff --git a/src/files-and-videos/index.scss b/src/files-and-videos/index.scss index 58182fe2b..2e419559a 100644 --- a/src/files-and-videos/index.scss +++ b/src/files-and-videos/index.scss @@ -1,5 +1,7 @@ @import "files-and-videos/videos-page/transcript-settings/TranscriptSettings"; @import "files-and-videos/videos-page/VideoThumbnail"; +@import "files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect"; +@import "files-and-videos/videos-page/info-sidebar/transcript-item/TranscriptMenu"; @import "files-and-videos/generic/table-components/GalleryCard"; .files-table { @@ -49,10 +51,10 @@ .pgn__menu-item { width: 100%; justify-content: start; + font-weight: 400; - &.focus, - &:focus { - font-weight: 500; + &:hover { + background-color: $light-300; } } } diff --git a/src/files-and-videos/videos-page/info-sidebar/TranscriptTab.test.jsx b/src/files-and-videos/videos-page/info-sidebar/TranscriptTab.test.jsx index 95dfaee24..d7a05d9ca 100644 --- a/src/files-and-videos/videos-page/info-sidebar/TranscriptTab.test.jsx +++ b/src/files-and-videos/videos-page/info-sidebar/TranscriptTab.test.jsx @@ -174,7 +174,7 @@ describe('TranscriptTab', () => { fireEvent.click(menuButton); }); - const deleteButton = screen.getByText(transcriptRowMessages.deleteTranscript.defaultMessage).closest('a'); + const deleteButton = screen.getByText(transcriptRowMessages.deleteTranscript.defaultMessage).closest('button'); fireEvent.click(deleteButton); }); @@ -237,7 +237,7 @@ describe('TranscriptTab', () => { }); downloadButton = screen.getByText( transcriptRowMessages.downloadTranscript.defaultMessage, - ).closest('a'); + ).closest('button'); }); it('should download transcript', async () => { @@ -291,7 +291,7 @@ describe('TranscriptTab', () => { }); const replaceButton = screen.getByText( transcriptRowMessages.replaceTranscript.defaultMessage, - ).closest('a'); + ).closest('button'); fireEvent.click(replaceButton); }); diff --git a/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.jsx b/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.jsx index 91317d65b..e0ab163c6 100644 --- a/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.jsx +++ b/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.jsx @@ -1,7 +1,15 @@ -import React from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; -import { Dropdown, Icon } from '@openedx/paragon'; -import { Check, ExpandMore } from '@openedx/paragon/icons'; + +import { + Button, + Icon, + ModalPopup, + Menu, + MenuItem, + useToggle, +} from '@openedx/paragon'; +import { Check, ExpandMore, ExpandLess } from '@openedx/paragon/icons'; import { isEmpty } from 'lodash'; const LanguageSelect = ({ @@ -12,47 +20,87 @@ const LanguageSelect = ({ placeholderText, }) => { const currentSelection = isEmpty(value) ? placeholderText : options[value]; + + const [isOpen, , close, toggle] = useToggle(); + const [target, setTarget] = useState(null); + return ( - - +
+ +
+ - {currentSelection} -
- -
- {Object.entries(options).map(([valueKey, text]) => { - if (valueKey === value) { + +
+ {Object.entries(options).map(([valueKey, text]) => { + if (valueKey === value) { + return ( + + + {text} + + ); + } + if (!previousSelection.includes(valueKey)) { + return ( + { + handleSelect(valueKey); + close(); + }} + key={`${valueKey}-item`} + > + {text} + + ); + } return ( - - {text} - - ); - } - if (!previousSelection.includes(valueKey)) { - return ( - handleSelect(valueKey)} key={`${valueKey}-item`}> + {text} - + ); - } - return ( - - {text} - - ); - })} -
+ })} +
+
-
-
+ + ); }; diff --git a/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.scss b/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.scss new file mode 100644 index 000000000..e42eb28a1 --- /dev/null +++ b/src/files-and-videos/videos-page/info-sidebar/transcript-item/LanguageSelect.scss @@ -0,0 +1,24 @@ +.language-select { + padding: 8px 0; + margin: 0; + overflow-x: hidden; + max-height: 275px; + width: 300px; + + @include pgn-box-shadow(2, "down"); + + .pgn__menu-item { + width: 100%; + justify-content: start; + font-weight: 400; + + &:hover { + background-color: $light-300; + } + + .pgn__menu-item-text { + display: flex; + align-items: center; + } + } +} diff --git a/src/files-and-videos/videos-page/info-sidebar/transcript-item/Transcript.jsx b/src/files-and-videos/videos-page/info-sidebar/transcript-item/Transcript.jsx index cb0a9f67c..88e435f98 100644 --- a/src/files-and-videos/videos-page/info-sidebar/transcript-item/Transcript.jsx +++ b/src/files-and-videos/videos-page/info-sidebar/transcript-item/Transcript.jsx @@ -84,15 +84,13 @@ const Transcript = ({ key={`transcript-${language}`} data-testid={`transcript-${language}`} > -
- -
+ { transcript === '' ? ( ( - - - - { + const [isOpen, , close, toggle] = useToggle(); + const [target, setTarget] = useState(null); + return ( + <> + + - - - handleTranscript({ language }, 'download')} - > - - - - - - - -); + + + + + handleTranscript({ language }, 'download')} + > + + +
+ + + +
+ + + ); +}; TranscriptActionMenu.propTypes = { language: PropTypes.string.isRequired, diff --git a/src/files-and-videos/videos-page/info-sidebar/transcript-item/TranscriptMenu.scss b/src/files-and-videos/videos-page/info-sidebar/transcript-item/TranscriptMenu.scss new file mode 100644 index 000000000..5a21a8d12 --- /dev/null +++ b/src/files-and-videos/videos-page/info-sidebar/transcript-item/TranscriptMenu.scss @@ -0,0 +1,17 @@ +.transcript-menu { + padding: 8px 0; + margin: 0; + width: 250px; + + @include pgn-box-shadow(2, "down"); + + .pgn__menu-item { + width: 100%; + justify-content: start; + font-weight: 400; + + &:hover { + background-color: $light-300; + } + } +}