Skip to content

Commit

Permalink
style: Update tags count with opacity when the count is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Mar 11, 2024
1 parent 56af892 commit f808a84
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/content-tags-drawer/index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "content-tags-drawer/TagBubble";
@import "content-tags-drawer/tags-sidebar/TagsSidebarBody";
@import "content-tags-drawer/tags-sidebar/TagsSidebar";
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.tags-sidebar {
.course-unit-sidebar-header {
padding-bottom: .25rem !important;

.course-unit-sidebar-header-count.zero-count {
opacity: .4;
}
}

.tags-sidebar-body {
Expand Down
8 changes: 6 additions & 2 deletions src/content-tags-drawer/tags-sidebar/TagsSidebarHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Icon, Stack } from '@openedx/paragon';
import { Tag } from '@openedx/paragon/icons';
import { useParams } from 'react-router-dom';
import { useIntl } from '@edx/frontend-platform/i18n';
import classNames from 'classnames';

import messages from '../messages';
import { useContentTaxonomyTagsCount } from '../data/apiHooks';
Expand All @@ -20,9 +21,12 @@ const TagsSidebarHeader = () => {
<h3 className="course-unit-sidebar-header-title m-0">
{intl.formatMessage(messages.tagsSidebarTitle)}
</h3>
{ isContentTaxonomyTagsCountLoaded && contentTaxonomyTagsCount !== 0
{ isContentTaxonomyTagsCountLoaded
&& (
<div className="d-flex">
<div className={
classNames('course-unit-sidebar-header-count d-flex', { 'zero-count': contentTaxonomyTagsCount === 0 })
}
>
<Icon
className="mr-1 pt-1"
src={Tag}
Expand Down
10 changes: 0 additions & 10 deletions src/content-tags-drawer/tags-sidebar/TagsSidebarHeader.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,4 @@ describe('<TagsSidebarHeader>', () => {
expect(screen.getByRole('heading', { name: /unit tags/i })).toBeInTheDocument();
expect(screen.getByText('17')).toBeInTheDocument();
});

it('should not render count if is cero', () => {
useContentTaxonomyTagsCount.mockReturnValue({
isSuccess: true,
data: 0,
});
render(<RootWrapper />);
expect(screen.getByRole('heading', { name: /unit tags/i })).toBeInTheDocument();
expect(screen.queryByText('0')).not.toBeInTheDocument();
});
});

0 comments on commit f808a84

Please sign in to comment.