diff --git a/packages/bpk-component-accordion/src/BpkAccordionItem.js b/packages/bpk-component-accordion/src/BpkAccordionItem.js index 6000ebdfbe..dc2388fc2c 100644 --- a/packages/bpk-component-accordion/src/BpkAccordionItem.js +++ b/packages/bpk-component-accordion/src/BpkAccordionItem.js @@ -48,6 +48,7 @@ type Props = { const BpkAccordionItem = (props: Props) => { const { divider, onDark } = useContext(BpkAccordionContext); + const itemClassNames = [getClassName('bpk-accordion__item')]; const iconClassNames = [getClassName('bpk-accordion__item-expand-icon')]; const titleTextClassNames = [getClassName('bpk-accordion__title-text')]; const titleClassNames = [getClassName('bpk-accordion__title')]; @@ -70,6 +71,10 @@ const BpkAccordionItem = (props: Props) => { // $FlowFixMe[prop-missing] - see above delete rest.initiallyExpanded; + if (onDark) { + itemClassNames.push(getClassName('bpk-accordion__item--on-dark')); + } + if (expanded && !onDark) { iconClassNames.push( getClassName('bpk-accordion__item-expand-icon--flipped'), @@ -125,7 +130,7 @@ const BpkAccordionItem = (props: Props) => { return ( // $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md -
+
- {children} +
+ {children} +
diff --git a/packages/bpk-component-accordion/src/BpkAccordionItem.module.scss b/packages/bpk-component-accordion/src/BpkAccordionItem.module.scss index b924f6af85..9ba32d8cc5 100644 --- a/packages/bpk-component-accordion/src/BpkAccordionItem.module.scss +++ b/packages/bpk-component-accordion/src/BpkAccordionItem.module.scss @@ -22,18 +22,18 @@ @use '../../unstable__bpk-mixins/utils'; .bpk-accordion { - &__title { - height: auto; - - &--collapsed { - @include borders.bpk-border-bottom-sm(tokens.$bpk-line-day); + &__item { + @include borders.bpk-border-bottom-sm(tokens.$bpk-line-day); - &-on-dark { - @include borders.bpk-border-bottom-sm(tokens.$bpk-line-on-dark-day); - } + &-on-dark { + @include borders.bpk-border-bottom-sm(tokens.$bpk-line-on-dark-day); } } + &__title { + height: auto; + } + &__toggle-button { width: 100%; padding: 0; @@ -86,17 +86,9 @@ &__content-container { margin: 0; + } - &--expanded { - padding-bottom: tokens.bpk-spacing-base(); - - @include borders.bpk-border-bottom-sm(tokens.$bpk-line-day); - - &-on-dark { - padding-bottom: tokens.bpk-spacing-base(); - - @include borders.bpk-border-bottom-sm(tokens.$bpk-line-on-dark-day); - } - } + &__content-inner-container { + padding-bottom: tokens.bpk-spacing-base(); } } diff --git a/packages/bpk-component-accordion/src/__snapshots__/BpkAccordionItem-test.js.snap b/packages/bpk-component-accordion/src/__snapshots__/BpkAccordionItem-test.js.snap index 5a868a5576..c5cc6c37fe 100644 --- a/packages/bpk-component-accordion/src/__snapshots__/BpkAccordionItem-test.js.snap +++ b/packages/bpk-component-accordion/src/__snapshots__/BpkAccordionItem-test.js.snap @@ -3,6 +3,7 @@ exports[`BpkAccordionItem should not render an "initiallyExpanded" attribute on the html node 1`] = `
- My accordion content +
+ My accordion content +
@@ -69,6 +74,7 @@ exports[`BpkAccordionItem should not render an "initiallyExpanded" attribute on exports[`BpkAccordionItem should render correctly 1`] = `
- My accordion content +
+ My accordion content +
@@ -191,7 +201,11 @@ exports[`BpkAccordionItem should render correctly with "className" prop 1`] = `
- My accordion content +
+ My accordion content +
@@ -202,6 +216,7 @@ exports[`BpkAccordionItem should render correctly with "className" prop 1`] = ` exports[`BpkAccordionItem should render correctly with "expanded" prop 1`] = `
- My accordion content +
+ My accordion content +
@@ -266,6 +285,7 @@ exports[`BpkAccordionItem should render correctly with "expanded" prop 1`] = ` exports[`BpkAccordionItem should render correctly with "tagName" prop set 1`] = `
- My accordion content +
+ My accordion content +
@@ -332,6 +356,7 @@ exports[`BpkAccordionItem should render correctly with "tagName" prop set 1`] = exports[`BpkAccordionItem should render correctly with "textStyle" prop set 1`] = `
- My accordion content +
+ My accordion content +
@@ -398,6 +427,7 @@ exports[`BpkAccordionItem should render correctly with "textStyle" prop set 1`] exports[`BpkAccordionItem should render correctly with an icon set 1`] = `
- My accordion content +
+ My accordion content +
@@ -476,6 +510,7 @@ exports[`BpkAccordionItem should render correctly with an icon set 1`] = ` exports[`BpkAccordionItem should render correctly with no divider 1`] = `
- My accordion content +
+ My accordion content +
@@ -543,6 +582,7 @@ exports[`BpkAccordionItem should render correctly with no divider 1`] = ` exports[`BpkAccordionItem should render correctly with onDark set 1`] = `
- My accordion content +
+ My accordion content +
diff --git a/packages/bpk-component-accordion/src/__snapshots__/withAccordionItemState-test.js.snap b/packages/bpk-component-accordion/src/__snapshots__/withAccordionItemState-test.js.snap index 5f2877c5f6..63e7b416e6 100644 --- a/packages/bpk-component-accordion/src/__snapshots__/withAccordionItemState-test.js.snap +++ b/packages/bpk-component-accordion/src/__snapshots__/withAccordionItemState-test.js.snap @@ -3,6 +3,7 @@ exports[`withAccordionItemState(BpkAccordionItem) should render correctly 1`] = `
- My accordion content +
+ My accordion content +
@@ -69,6 +74,7 @@ exports[`withAccordionItemState(BpkAccordionItem) should render correctly 1`] = exports[`withAccordionItemState(BpkAccordionItem) should render correctly with "expanded" prop 1`] = `
- My accordion content +
+ My accordion content +
@@ -135,6 +145,7 @@ exports[`withAccordionItemState(BpkAccordionItem) should render correctly with " exports[`withAccordionItemState(BpkAccordionItem) should render correctly with "initiallyExpanded" prop 1`] = `
- My accordion content +
+ My accordion content +