pico/scss/components/_accordion.scss
Lucas 456539a52e New form elements
- CSS icons color dynamization in `_color.scss`
- Bigger Checkboxes and Radio buttons
- Small refactoring for Checkboxes and Radio buttons in `_form.scss` and `form-checkbox-radio.scss`
- Styles for new form elements: `type=date`, `type=datetime-local`, `type=month`, `type=time`, `type=week`, `type=range`, `type=search`
- Reordering @import in `pico.scss` and `pico.slim.scss`
2020-09-24 22:35:30 +07:00

69 lines
1.4 KiB
SCSS

/**
* Accordion (<details>)
* Inspiration: https://codepen.io/koca/pen/RyeLLV
*/
details {
display: block;
margin-bottom: $spacing-typography;
padding-bottom: $spacing-typography/2;
border-bottom: 1px solid var(--muted-border);
summary {
line-height: 1rem;
list-style-type: none;
cursor: pointer;
// Reset marker
&::-webkit-details-marker {
display: none;
}
&::marker {
display: none;
}
&::-moz-list-bullet {
list-style-type: none;
}
// Marker
&::after {
display: inline-block;
width: 1rem;
height: 1rem;
float: right;
transform: rotate(-90deg);
// Source: https://feathericons.com/
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{$icon-color}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
background-position: center;
background-repeat: no-repeat;
background-size: 1rem auto;
content: '';
}
&:focus {
outline: none;
}
~ * {
margin-top: $spacing-typography/2;
~ * {
margin-top: 0;
}
}
}
// Open
&[open] {
summary {
margin-bottom: $spacing-typography/4;
color: var(--muted-text);
&::after {
transform: rotate(0);
}
}
}
}