Skip to content

Commit

Permalink
change(accordion): use real icons for active and inactive panel icons #…
Browse files Browse the repository at this point in the history
…380 from eea/accordion-filtering
  • Loading branch information
ichim-david authored Aug 16, 2023
1 parent 60de457 commit bb9e20c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 39 deletions.
23 changes: 12 additions & 11 deletions src/ui/Accordion/Accordion.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ function AccordionContainer({ ...args }) {
{args.enable_filtering && (
<Accordion className={args.variant}>
<Accordion.Title className={'filter'}>
{filterValue === '' ? (
<Icon className="ri-filter-3-line" />
) : (
<Icon
className="ri-close-line"
onClick={() => handleFilteredValueChange('')}
/>
)}
<Input
fluid
className="input-accordion-title"
Expand All @@ -78,6 +70,10 @@ function AccordionContainer({ ...args }) {
value={filterValue}
onChange={(e) => handleFilteredValueChange(e.target.value)}
/>
<Icon
className={filterValue ? 'ri-close-line' : 'ri-filter-3-line'}
onClick={() => handleFilteredValueChange('')}
/>
</Accordion.Title>
</Accordion>
)}
Expand All @@ -90,12 +86,13 @@ function AccordionContainer({ ...args }) {
panel.title?.toLowerCase().includes(filterValue.toLowerCase())),
)
.map((panel, index) => {
const active = activeIndex === index;
return (
<Accordion className={args.variant} key={index}>
<Accordion.Title
index={index}
tabIndex={0}
active={activeIndex === index}
active={active}
onClick={handleClick}
as={args.title_size === 'no value' ? '' : args.title_size}
onKeyDown={(e) => {
Expand All @@ -105,9 +102,13 @@ function AccordionContainer({ ...args }) {
}}
>
<span>{panel.title}</span>
<Icon className="ri-arrow-down-s-line" />
<Icon
className={
active ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'
}
/>
</Accordion.Title>
<Accordion.Content active={activeIndex === index}>
<Accordion.Content active={active}>
{panel.content}
</Accordion.Content>
</Accordion>
Expand Down
44 changes: 18 additions & 26 deletions theme/themes/eea/modules/accordion.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@

.accordion .filter {
background-color: var(--bg-color, transparent);
--accordion-icon-inactive: '\ed25';
.ri-close-line {
--accordion-icon-inactive: '\eb99';
}
}

.ui.accordion button.title {
background: transparent;
width: 100%;
Expand All @@ -19,8 +16,18 @@
margin: @itemsMargin;
transition: @styledTitleTransition;

.title,
button.title {
.basic {
color: @titleColorHover !important;
}

.basic:focus,
.basic:hover {
background-color: transparent !important;
box-shadow: none;
color: @titleColorHover !important;
}

.title {
display: flex;
align-items: center;
justify-content: @titleJustifyContent;
Expand All @@ -30,20 +37,20 @@
justify-content: flex-start;
}

i {
.icon {
flex-shrink: 0;
}

&:hover,
&:focus-visible {
color: @titleColorHover;

i {
.icon {
color: @iconColorHover;
}
}

i {
.icon {
display: flex;
width: @iconWidth;
height: @iconHeight;
Expand All @@ -54,17 +61,6 @@
font-size: @iconFontSize;
line-height: @iconFontSize;

&:before {
content: @iconInactive;
font-size: @iconFontSize;
}
}

&.filter {
i:before {
width: @filterIconWidth;
font-size: @filterIconFontSize;
}
}
}

Expand All @@ -73,12 +69,8 @@
background-color: @activeTitleBackground;
color: @activeTitleColor;

i {
.icon {
color: @iconColorActive;

&:before {
content: @iconActive;
}
}
}

Expand Down Expand Up @@ -120,7 +112,7 @@
background-color: transparent;
}

.ui.item i {
.ui.item .icon {
font-size: @iconFontSize;

&::before {
Expand Down
2 changes: 0 additions & 2 deletions theme/themes/eea/modules/accordion.variables
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
@iconVerticalAlign: baseline;
@iconTransform: none;
@iconColorHover: @titleColorHover;
@iconInactive: var(--accordion-icon-inactive, "\ea4e"); // Icon of closed accordion
@iconActive: var(--accordion-icon-active, "\ea78") ; // Icon of open accordion
@iconOrder: 1; // Icon after text of the title
@filterIconWidth: 3rem;
@filterIconFontSize: 2rem;
Expand Down

0 comments on commit bb9e20c

Please sign in to comment.