Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(accordion): new component #2497

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-rockets-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/skin": minor
---

feat(accordion): new component
59 changes: 59 additions & 0 deletions dist/accordion/accordion.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
ul.accordion {
list-style: none;
margin: 0;
padding: 0;
width: 100%;
}

ul.accordion li:not(:last-child) {
border-bottom: 1px solid var(--color-stroke-subtle);
}

ul.accordion summary.details__summary {
border-radius: 0;
display: flex;
font-size: var(--font-size-medium);
justify-content: space-between;
min-height: 48px;
padding: 12px 16px;
}

ul.accordion details .details__content {
margin: 0 16px 6px;
opacity: 0;
transform: scaleY(0);
transform-origin: top;
transition:
opacity 0.5s cubic-bezier(0.3, 0, 0, 1),
transform 0.5s cubic-bezier(0.3, 0, 0, 1);
}

ul.accordion details[open] .details__content {
opacity: 1;
transform: scaleY(1);
transition:
opacity 0.25s cubic-bezier(0.3, 0, 0, 1),
transform 0.25s cubic-bezier(0.3, 0, 0, 1);
}

ul.accordion--large summary.details__summary {
font-size: var(--font-size-large-1);
min-height: 52px;
}

ul.accordion details svg.details__expand,
ul.accordion details[open] svg.details__collapse {
display: block;
}

ul.accordion details svg.details__collapse,
ul.accordion details[open] svg.details__expand {
display: none;
}

@media (prefers-reduced-motion) {
ul.accordion details .details__content,
ul.accordion details[open] .details__content {
transition: none;
}
}
617 changes: 617 additions & 0 deletions src/modules/accordion.marko

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions src/sass/accordion/accordion.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@import "../variables/variables";
@import "../mixins/private/token-mixins";

ul.accordion {
list-style: none;
margin: 0;
padding: 0;
width: 100%;
}

ul.accordion li:not(:last-child) {
border-bottom: 1px solid var(--color-stroke-subtle);
}

ul.accordion summary.details__summary {
border-radius: 0;
display: flex;
font-size: var(--font-size-medium);
justify-content: space-between;
min-height: 48px;
padding: 12px 16px;
}

ul.accordion details .details__content {
margin: 0 16px 6px;
opacity: 0;
transform: scaleY(0);
transform-origin: top;
transition:
opacity 500ms cubic-bezier(0.3, 0, 0, 1),
transform 500ms cubic-bezier(0.3, 0, 0, 1);
ArtBlue marked this conversation as resolved.
Show resolved Hide resolved
}

ul.accordion details[open] .details__content {
opacity: 1;
transform: scaleY(1);
transition:
saiponnada marked this conversation as resolved.
Show resolved Hide resolved
opacity 250ms cubic-bezier(0.3, 0, 0, 1),
transform 250ms cubic-bezier(0.3, 0, 0, 1);
}

ul.accordion--large summary.details__summary {
font-size: var(--font-size-large-1);
min-height: 52px;
}

ul.accordion details svg.details__expand,
ul.accordion details[open] svg.details__collapse {
display: block;
}

ul.accordion details[open] svg.details__expand,
ul.accordion details svg.details__collapse {
display: none;
}

@media (prefers-reduced-motion) {
/* Remove animations */
ul.accordion details .details__content,
ul.accordion details[open] .details__content {
transition: none;
}
}
Loading