Skip to content

Commit

Permalink
simplify css names to reduce overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
janivo committed Nov 4, 2024
1 parent 0cdf273 commit 541b30a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 55 deletions.
75 changes: 31 additions & 44 deletions packages/elements/src/components/ino-meetup/ino-meetup.scss
Original file line number Diff line number Diff line change
@@ -1,69 +1,56 @@
@use '../base/typography-new' as typography;
@use '../base/new-theme' as theme;

.ino-meetup-accordion {
.accordion {
border: 1px solid theme.$n-3;
border-radius: 8px;
margin-bottom: 16px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

&__header {
cursor: pointer;
padding: 16px;
@include typography.typo(title-s);
background-color: theme.$p-1;
transition: background-color 0.3s ease;
&--expanded {
background-color: #e8e8e8;

&:hover {
background-color: theme.$p-3;
.question::after {
transform: rotate(180deg);
}

button {
width: 100%;
text-align: left;
background: none;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
display: flex;
justify-content: space-between;
align-items: center;

&::after {
content: '\25BC';
font-size: 0.8em;
transition: transform 0.3s ease;
}
.answer {
max-height: 300px;
}
}
}

&__content-wrapper {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;
.question {
@include typography.typo(title-s);
padding: 16px;
background-color: theme.$p-1;
transition: background-color 0.3s ease;
width: 100%;
border: none;
display: flex;
justify-content: space-between;

&:hover {
background-color: theme.$p-3;
}

&--expanded {
max-height: 300px;
}
&::after {
content: '\25BC';
font-size: 0.8em;
transition: transform 0.3s ease;
}
}

.answer {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;

&__content {
padding: 16px;
background-color: #ffffff;
@include typography.typo(body-m);
color: theme.$n-10;
}

&--expanded {
.ino-meetup-accordion__header {
background-color: #e8e8e8;

button::after {
transform: rotate(180deg);
}
}
}
}
17 changes: 6 additions & 11 deletions packages/elements/src/components/ino-meetup/ino-meetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,12 @@ export class MeetupAccordion implements ComponentInterface {

render() {
return (
<div class={{ 'ino-meetup-accordion': true, 'ino-meetup-accordion--expanded': this.expanded }}>
<div class="ino-meetup-accordion__header" onClick={() => this.toggleAccordion()}>
<button aria-expanded={this.expanded}>{this.accordionTitle}</button>
</div>
<div
class={{
'ino-meetup-accordion__content-wrapper': true,
'ino-meetup-accordion__content-wrapper--expanded': this.expanded,
}}
>
<div class="ino-meetup-accordion__content">
<div class={{ accordion: true, 'accordion--expanded': this.expanded }}>
<button class="question" onClick={() => this.toggleAccordion()}>
{this.accordionTitle}
</button>
<div class="answer">
<div class="answer__content">
<slot />
</div>
</div>
Expand Down

0 comments on commit 541b30a

Please sign in to comment.