diff --git a/src/content-tags-drawer/ContentTagsCollapsible.jsx b/src/content-tags-drawer/ContentTagsCollapsible.jsx index 12422b6ea6..8c5c238f98 100644 --- a/src/content-tags-drawer/ContentTagsCollapsible.jsx +++ b/src/content-tags-drawer/ContentTagsCollapsible.jsx @@ -5,12 +5,13 @@ import React from 'react'; import Select, { components } from 'react-select'; import { - Badge, Collapsible, Button, Spinner, + Chip, + Icon, } from '@openedx/paragon'; -import classNames from 'classnames'; +import { Tag, KeyboardArrowDown, KeyboardArrowUp } from '@openedx/paragon/icons'; import { SelectableBox } from '@edx/frontend-lib-content-components'; import { useIntl } from '@edx/frontend-platform/i18n'; import { debounce } from 'lodash'; @@ -398,84 +399,97 @@ const ContentTagsCollapsible = ({ return (
- closeCollapsible(taxonomyId)} onOpen={() => openCollapsible(taxonomyId)} > - { Object.keys(appliedContentTagsTree).length !== 0 - && ( -
- -
+ + + + + + + + +

{name}

+
+ + +
+ { Object.keys(appliedContentTagsTree).length !== 0 + && ( +
+ +
)} -
- {isEditMode && canTagObject && ( - ({ + ...base, + background: state.isFocused ? 'black' : base.background, + color: state.isFocused ? 'white' : base.color, + }), + }} + menuIsOpen={selectMenuIsOpen} + onFocus={onSelectMenuFocus} + onKeyDown={handleSelectOnKeyDown} + ref={/** @type {React.RefObject} */(selectRef)} + isMulti + isLoading={updateTags.isLoading} + isDisabled={updateTags.isLoading} + name="tags-select" + placeholder={intl.formatMessage(messages.collapsibleAddTagsPlaceholderText)} + isSearchable + className="d-flex flex-column flex-fill" + classNamePrefix="react-select-add-tags" + onInputChange={handleSearchChange} + onChange={handleStagedTagsMenuChange} + components={{ + Menu: CustomMenu, + LoadingIndicator: CustomLoadingIndicator, + IndicatorsContainer: CustomIndicatorsContainer, + }} + closeMenuOnSelect={false} + blurInputOnSelect={false} + handleSelectableBoxChange={handleSelectableBoxChange} + checkedTags={checkedTags} + taxonomyId={taxonomyId} + appliedContentTagsTree={appliedContentTagsTree} + stagedContentTagsTree={stagedContentTagsTree} + handleCommitStagedTags={handleCommitStagedTags} + handleCancelStagedTags={handleCancelStagedTags} + searchTerm={searchTerm} + selectCancelRef={selectCancelRef} + selectAddRef={selectAddRef} + selectInlineAddRef={selectInlineAddRef} + value={stagedContentTags} + /> + )} +
+ + +
+ {contentTagsCount} - +
); diff --git a/src/content-tags-drawer/ContentTagsCollapsible.scss b/src/content-tags-drawer/ContentTagsCollapsible.scss index 3f7e13d5d6..a4989d2099 100644 --- a/src/content-tags-drawer/ContentTagsCollapsible.scss +++ b/src/content-tags-drawer/ContentTagsCollapsible.scss @@ -4,6 +4,10 @@ .collapsible-trigger { border: none !important; + + .pgn__icon { + margin-left: -3px; + } } .tags-tree { @@ -56,3 +60,7 @@ color: white !important; } } + +.taxonomy-tags-count-chip > .pgn__chip { + background: none; +} diff --git a/src/content-tags-drawer/ContentTagsDrawer.jsx b/src/content-tags-drawer/ContentTagsDrawer.jsx index a4c7d462a1..65a8a7e2cb 100644 --- a/src/content-tags-drawer/ContentTagsDrawer.jsx +++ b/src/content-tags-drawer/ContentTagsDrawer.jsx @@ -3,7 +3,6 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { Container, - CloseButton, Spinner, Stack, Button, @@ -93,12 +92,10 @@ const ContentTagsDrawer = ({ id, onClose }) => { }, [commitGlobalStagedTagsStatus]); return ( -
- - onCloseDrawer()} data-testid="drawer-close-button" /> - {intl.formatMessage(messages.headerSubtitle)} +
+ { isContentDataLoaded - ?

{ contentName }

+ ?

{ contentName }

: (
{ )}
+

{intl.formatMessage(messages.headerSubtitle)}

{ isTaxonomyListLoaded && isContentTaxonomyTagsLoaded ? tagsByTaxonomy.map((data) => ( @@ -140,7 +138,7 @@ const ContentTagsDrawer = ({ id, onClose }) => { { isTaxonomyListLoaded && isContentTaxonomyTagsLoaded && (
{ commitGlobalStagedTagsStatus !== 'loading' ? ( diff --git a/src/content-tags-drawer/ContentTagsDrawer.scss b/src/content-tags-drawer/ContentTagsDrawer.scss index 093f4184d3..7ca2ca1a9d 100644 --- a/src/content-tags-drawer/ContentTagsDrawer.scss +++ b/src/content-tags-drawer/ContentTagsDrawer.scss @@ -9,6 +9,8 @@ } .tags-drawer { + min-height: 100vh; + .tags-drawer-footer { @include pgn-box-shadow(2, "up"); @@ -22,3 +24,11 @@ } } +// Apply styles to sheet only if it has a child with a .tags-drawer class +.pgn__sheet-component { + &:has(.tags-drawer) { + overflow-y: scroll; + padding: 0; + min-height: 100vh; + } +} diff --git a/src/content-tags-drawer/ContentTagsDrawer.test.jsx b/src/content-tags-drawer/ContentTagsDrawer.test.jsx index 4f9e98e802..bd81000128 100644 --- a/src/content-tags-drawer/ContentTagsDrawer.test.jsx +++ b/src/content-tags-drawer/ContentTagsDrawer.test.jsx @@ -357,30 +357,6 @@ describe('', () => { expect(screen.queryByText('Tag 3')).not.toBeInTheDocument(); }); - it('should call closeManageTagsDrawer when CloseButton is clicked', async () => { - const postMessageSpy = jest.spyOn(window.parent, 'postMessage'); - - const { getByTestId } = render(); - - // Find the CloseButton element by its test ID and trigger a click event - const closeButton = getByTestId('drawer-close-button'); - fireEvent.click(closeButton); - - expect(postMessageSpy).toHaveBeenCalledWith('closeManageTagsDrawer', '*'); - - postMessageSpy.mockRestore(); - }); - - it('should call onClose param when CloseButton is clicked', async () => { - render(); - - // Find the CloseButton element by its test ID and trigger a click event - const closeButton = screen.getByTestId('drawer-close-button'); - fireEvent.click(closeButton); - - expect(mockOnClose).toHaveBeenCalled(); - }); - it('should call onClose when cancel is clicked', async () => { setupMockDataForStagedTagsTesting(); render(); diff --git a/src/course-outline/card-header/CardHeader.test.jsx b/src/course-outline/card-header/CardHeader.test.jsx index 0e40058c3f..c734300433 100644 --- a/src/course-outline/card-header/CardHeader.test.jsx +++ b/src/course-outline/card-header/CardHeader.test.jsx @@ -206,7 +206,7 @@ describe('', () => { fireEvent.click(manageTagsMenuItem); // Check if the drawer is open - expect(screen.getByTestId('drawer-close-button')).toBeInTheDocument(); + expect(screen.getAllByText('Manage tags').length).toBe(2); }); it('calls onClickEdit when the button is clicked', async () => {