Skip to content

Commit

Permalink
feat(accordion): allow accordion active color customisation through n…
Browse files Browse the repository at this point in the history
…ew cssprop
  • Loading branch information
clukhei committed Jun 24, 2024
1 parent a888918 commit 3efd62f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
sgds-sidenav {
--sidenav-sticky-top: 1.5rem;
}

sgds-accordion {
--accordion-active-color: blue;
}
/* sgds-sidenav-item::part(sidenav-btn) {
color: red;
border-left-color: red;
Expand Down
3 changes: 3 additions & 0 deletions src/components/Accordion/sgds-accordion-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

.accordion-button {
line-height: var(--accordion-item-line-height);
&:not(.collapsed){
color: var(--accordion-active-color);
}
}

.accordion-button:not(.collapsed) {
Expand Down
4 changes: 4 additions & 0 deletions src/components/Accordion/sgds-accordion.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
/** NEW in 1.2.4 */
--accordion-active-color: var(--sgds-primary);
}
6 changes: 5 additions & 1 deletion src/components/Accordion/sgds-accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { property, queryAssignedNodes } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import SgdsElement from "../../base/sgds-element";
import type SgdsAccordionItem from "./sgds-accordion-item";
import styles from "./sgds-accordion.scss";

/**
* @summary A dropdown mechanism that allow users to either show or hide related content. `SgdsAccordion` is a wrapper to manage the behaviour for multiple `SgdsAccordionItems`
* @slot default - slot for accordion-item
*
* @cssprop --accordion-active-color - The text color of all accordion buttons to indicate its active state
*
*/

export class SgdsAccordion extends SgdsElement {
static styles = [SgdsElement.styles];
static styles = [SgdsElement.styles, styles];

/** Allows multiple accordion items to be opened at the same time */
@property({ type: Boolean, reflect: true }) allowMultiple = false;
Expand Down

0 comments on commit 3efd62f

Please sign in to comment.