diff --git a/src/index.scss b/src/index.scss index 381ca17082..9cd7d4c3bc 100644 --- a/src/index.scss +++ b/src/index.scss @@ -26,7 +26,7 @@ @import "textbooks/Textbooks"; @import "content-tags-drawer/ContentTagsDropDownSelector"; @import "content-tags-drawer/ContentTagsCollapsible"; -@import "search-modal/SearchModal"; +@import "search-modal"; @import "certificates/scss/Certificates"; @import "group-configurations/GroupConfigurations"; @import "library-authoring"; diff --git a/src/library-authoring/LibraryAuthoringPage.jsx b/src/library-authoring/LibraryAuthoringPage.jsx index 9b3bc8a330..543713dadd 100644 --- a/src/library-authoring/LibraryAuthoringPage.jsx +++ b/src/library-authoring/LibraryAuthoringPage.jsx @@ -102,8 +102,8 @@ const LibraryAuthoringPage = () => { />
- +
diff --git a/src/search-modal/FilterBy.scss b/src/search-modal/FilterBy.scss new file mode 100644 index 0000000000..189f31f11c --- /dev/null +++ b/src/search-modal/FilterBy.scss @@ -0,0 +1,7 @@ +// Options for the "filter by tag/block type" menu +.pgn__menu.filter-by-refinement-menu { + .pgn__menu-item { + // Make the "filter by tag/block type" menu expand to fit the tags hierarchy and longer block type names + width: 100%; + } +} diff --git a/src/search-modal/FilterByBlockType.jsx b/src/search-modal/FilterByBlockType.jsx index f39bd17233..dd9cd1a5fd 100644 --- a/src/search-modal/FilterByBlockType.jsx +++ b/src/search-modal/FilterByBlockType.jsx @@ -72,6 +72,7 @@ const FilterByBlockType = () => { ({ label: }))} label={} + filterType="blockType" > { ({ label: tf.split(TAG_SEP).pop() }))} label={} + filterType="tags" > { placeholder={intl.formatMessage(messages.searchTagsByKeywordPlaceholder)} className="mx-3 mb-1" /> - + etc. * - * @type {React.FC<{appliedFilters: {label: React.ReactNode}[], label: React.ReactNode, children: React.ReactNode}>} + * @type {React.FC<{ + * appliedFilters: {label: React.ReactNode}[], + * label: React.ReactNode, + * children: React.ReactNode, + * filterType?: string + * }>} */ const SearchFilterWidget = ({ appliedFilters, ...props }) => { const [isOpen, open, close] = useToggle(false); const [target, setTarget] = React.useState(null); + const iconMap = { + blockType: FilterList, + tags: Tag, + }; + return ( <>
@@ -34,6 +44,7 @@ const SearchFilterWidget = ({ appliedFilters, ...props }) => { variant={appliedFilters.length ? 'light' : 'outline-primary'} size="sm" onClick={open} + iconBefore={iconMap[props.filterType]} iconAfter={ArrowDropDown} > {props.label} diff --git a/src/search-modal/SearchModal.scss b/src/search-modal/SearchModal.scss index eb1f7b17cc..d14fdac832 100644 --- a/src/search-modal/SearchModal.scss +++ b/src/search-modal/SearchModal.scss @@ -39,22 +39,6 @@ } } - // Options for the "filter by tag" menu - .pgn__menu.tags-refinement-menu { - .pgn__menu-item { - // Make the "filter by tag" menu much wider than normal, because we need the space to display the tags hierarchy - width: 100%; - } - } - - // Options for the "filter by block type" menu - .pgn__menu.block-type-refinement-menu { - .pgn__menu-item { - // Make the "filter by block type" menu expand to fit longer block types names - width: 100%; - } - } - .pgn__menu-item { // Fix a bug in Paragon menu dropdowns: the checkbox currently shrinks if the text is too long. // https://github.com/openedx/paragon/pull/3019 diff --git a/src/search-modal/index.scss b/src/search-modal/index.scss new file mode 100644 index 0000000000..150baad66e --- /dev/null +++ b/src/search-modal/index.scss @@ -0,0 +1,2 @@ +@import "search-modal/SearchModal"; +@import "search-modal/FilterBy";