Skip to content

Commit

Permalink
feat(accordion): new component (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
saiponnada authored Nov 22, 2024
1 parent 2ff5317 commit dfda4a0
Show file tree
Hide file tree
Showing 7 changed files with 1,355 additions and 0 deletions.
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
58 changes: 58 additions & 0 deletions dist/accordion/accordion.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ul.accordion {
margin: 0;
padding: 0;
width: 100%;
}
ul.accordion ::marker {
font-size: 0;
}

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);
}

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.

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

ul.accordion {
margin: 0;
padding: 0;
width: 100%;
}

/*
Safari does not recognize ordered or unordered lists as lists in the accessibility tree if they have a list-style value of none, unless the list is nested within the <nav> navigation element. This behavior is intentional and is not considered a bug. To work around this issue, use the use ::marker.
*/
ul.accordion ::marker {
font-size: 0;
}

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);
}

ul.accordion details[open] .details__content {
opacity: 1;
transform: scaleY(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

0 comments on commit dfda4a0

Please sign in to comment.