-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCSS: Move FAQ-accordion out of section and into its own component
- Loading branch information
Showing
4 changed files
with
160 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.faq-accordion { | ||
--_faq-border: 1px solid var(--color-faqoutline); | ||
margin-top: 3.5rem; | ||
border: var(--_faq-border); | ||
border-radius: 8px; | ||
|
||
details { | ||
background-color: var(--color-faqbg); | ||
border-bottom: var(--_faq-border); | ||
overflow: hidden; | ||
|
||
/* No border on last details-element to prevent double border*/ | ||
&:last-child { | ||
border-bottom: unset; | ||
} | ||
&[open] { | ||
padding-bottom: 1rem; | ||
.answer { | ||
border-top: var(--_faq-border); | ||
} | ||
} | ||
} | ||
|
||
summary { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
font-size: var(--fs-body-m); | ||
font-weight: var(--fw-semi); | ||
line-height: 1.3; | ||
padding: 1rem 1.5rem; | ||
cursor: pointer; | ||
user-select: none; | ||
transition: var(--transition-default); | ||
|
||
span { | ||
color: var(--color-heading); | ||
} | ||
|
||
&:hover { | ||
background-color: var(--color-faqchevronbg); | ||
} | ||
|
||
/* Hide marker */ | ||
list-style: none; | ||
} | ||
|
||
p { | ||
padding-inline: 1.5rem; | ||
font-size: var(--fs-body-s); | ||
line-height: 1.6; | ||
&:last-child { | ||
padding-bottom: 1rem; | ||
} | ||
} | ||
|
||
.chevron-faq { | ||
background-color: var(--color-faqchevronbg); | ||
color: var(--color-faqchevronarrow); | ||
width: 36px; | ||
height: 36px; | ||
font-size: .625rem; | ||
/* Set pointer-events none for click to pass through to summary element*/ | ||
pointer-events: none; | ||
/* Prevent shrunk and skewed chevron buttons */ | ||
flex-shrink: 0; | ||
/* Add margin to the left of the button equal to parent padding-right */ | ||
margin-left: 1rem; | ||
/* Transition to smooth out color change and rotation */ | ||
transition: all .5s ease; | ||
/* Add some slight outlining around the chevrons */ | ||
box-shadow: 0 0 4px 0px var(--color-faqoutline); | ||
} | ||
|
||
details[open] .btn-chevron { | ||
transform: rotate(180deg); | ||
background-color: var(--color-primary); | ||
color: var(--color-white); | ||
/* Change outline color to give it a glowing appearance */ | ||
box-shadow: 0 0 4px 0px var(--color-primary); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters