Skip to content

Commit

Permalink
refactor(Accordion): div titles to buttons, test in mobile mega menu …
Browse files Browse the repository at this point in the history
…accordions
  • Loading branch information
tarantilis committed Feb 9, 2023
1 parent 2561c42 commit eaad4b4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/ui/Accordion/Accordion.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,22 @@ function AccordionContainer({ ...args }) {
active={activeIndex === 0}
index={0}
onClick={toggleOpenAccordion}
as="button"
>
{args.toggle1}
<Icon className="ri-arrow-down-s-line" />
</Accordion.Title>
<Accordion.Content active={activeIndex === 0}>
{args.content1.length > 0 &&
args.content1.map((item, index) => <p key={index}>{item}</p>)}
<a href="/#">Read more</a>
</Accordion.Content>

<Accordion.Title
active={activeIndex === 1}
index={1}
onClick={toggleOpenAccordion}
as="button"
>
{args.toggle2}
<Icon className="ri-arrow-down-s-line" />
Expand All @@ -133,6 +136,7 @@ function AccordionContainer({ ...args }) {
active={activeIndex === 2}
index={2}
onClick={toggleOpenAccordion}
as="button"
>
{args.toggle3}
<Icon className="ri-arrow-down-s-line" />
Expand Down
4 changes: 2 additions & 2 deletions src/ui/Header/HeaderMenuPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const FirstLevelContent = ({ element, renderMenuItem, pathName }) => {
defaultIndex = index;
}
x.title = (
<Accordion.Title key={`title=${index}`}>
<Accordion.Title key={`title=${index}`} as="button">
{item.title}
<Icon className="ri-arrow-down-s-line" size="small" />
</Accordion.Title>
Expand Down Expand Up @@ -279,7 +279,7 @@ const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
defaultIndex = index;
}
x.title = (
<Accordion.Title key={`title-${index}`} index={index}>
<Accordion.Title key={`title-${index}`} index={index} as="button">
{element.title}
<Icon className="ri-arrow-down-s-line" size="small" />
</Accordion.Title>
Expand Down
4 changes: 3 additions & 1 deletion theme/themes/eea/extras/header.less
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,11 @@

i:before {
font-size: @megaMenuAccordionIconFontSize;
line-height: @megaMenuAccordionIconLineHeight;
}

&:hover {
&:hover,
&:focus-visible {
i {
color: @megaMenuTextColor;
}
Expand Down
1 change: 1 addition & 0 deletions theme/themes/eea/extras/header.variables
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
@megaMenuAccordionTitleFontWeight: @font-weight-7;
@megaMenuAccordionTitlePadding: @rem-space-2 0;
@megaMenuAccordionIconFontSize: @font-size-9;
@megaMenuAccordionIconLineHeight: @font-lineheight-00;
@megaMenuAccordionContentPadding: 0 0 @rem-space-5 0;
@megaMenuAccordionTitleBorderBottom: 1px solid rgba(255, 255, 255, 0.25);
@megaMenuAccordionActiveTitleBorderBottom: 1px solid @white;
Expand Down
12 changes: 10 additions & 2 deletions theme/themes/eea/modules/accordion.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
Theme Overrides
*******************************/

.ui.accordion button.title {
background: transparent;
width: 100%;
border: none;
}

.ui.accordion {
margin: @itemsMargin;
transition: @styledTitleTransition;

.title {
.title,
button.title {
display: flex;
align-items: center;
justify-content: @titleJustifyContent;
Expand Down Expand Up @@ -112,7 +119,8 @@
.ui.accordion:not([class*='ary']) .active.title i {
color: @tertiaryColor;
}
.ui.accordion[class*='ary'] .active.title {
.ui.accordion[class*='ary'] .active.title,
.ui.accordion[class*='ary'] .active.title i {
color: white;
}

Expand Down

0 comments on commit eaad4b4

Please sign in to comment.