pico/scss/themes/default/_styles.scss
2023-03-05 09:17:56 +07:00

295 lines
7.4 KiB
SCSS

@use "sass:map";
@use "../../settings" as *;
@if map.get($modules, "themes/default") {
/**
* Styles
*/
:root {
// Typography
#{$✨}font-family: system-ui, -apple-system, "Segoe UI", "Roboto", "Ubuntu", "Cantarell",
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
#{$✨}line-height: 1.5;
#{$✨}font-weight: 400;
#{$✨}font-size: 100%;
#{$✨}text-underline-offset: 0.1rem;
// Responsive root font size
@if $enable-responsive-typography {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
#{$✨}font-size: map.get($values, "root-font-size");
}
}
}
}
// Borders
#{$✨}border-radius: 0.25rem;
#{$✨}border-width: 1px;
#{$✨}outline-width: 0.1875rem;
// Transitions
#{$✨}transition: 0.2s ease-in-out;
// Spacings
#{$✨}spacing: 1rem;
// Spacings for typography elements
@if map.get($modules, "content/typography") {
#{$✨}typography-spacing-vertical: 1rem;
}
// Spacings for body > header, body > main, body > footer, section, article
@if map.get($modules, "layout/landmarks") or
map.get($modules, "layout/section") or
map.get($modules, "components/card") or
map.get($modules, "components/modal")
{
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2);
#{$✨}block-spacing-horizontal: var(#{$}spacing);
}
@if map.get($modules, "layout/grid") and $enable-classes {
#{$✨}grid-spacing-vertical: 0;
#{$✨}grid-spacing-horizontal: var(#{$}spacing);
}
// Spacings for form elements and button
@if map.get($modules, "content/button") or map.get($modules, "forms/basic") {
#{$✨}form-element-spacing-vertical: 0.75rem;
#{$✨}form-element-spacing-horizontal: 1rem;
}
// Font weight for form labels & fieldsets legend
@if map.get($modules, "forms/basic") {
#{$✨}form-label-font-weight: var(#{$}font-weight);
}
// Modal (<dialog>)
@if map.get($modules, "components/modal") {
#{$✨}modal-overlay-backdrop-filter: blur(0.375rem);
}
// Spacings for nav component
@if map.get($modules, "components/nav") {
#{$✨}nav-element-spacing-vertical: 1rem;
#{$✨}nav-element-spacing-horizontal: 0.5rem;
#{$✨}nav-link-spacing-vertical: 0.5rem;
#{$✨}nav-link-spacing-horizontal: 0.5rem;
}
}
// Responsives spacings
@if $enable-responsive-spacings {
// Landmarks and section
@if map.get($modules, "layout/landmarks") or map.get($modules, "layout/section") {
#{$semantic-root-element} > header,
#{$semantic-root-element} > main,
#{$semantic-root-element} > footer,
section {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
$multiplier: 1;
@if $key == "sm" {
$multiplier: 2.5;
} @else if $key == "md" {
$multiplier: 3;
} @else if $key == "lg" {
$multiplier: 3.5;
} @else if $key == "xl" {
$multiplier: 4;
}
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * $multiplier);
}
}
}
}
}
// Card (<article>)
@if map.get($modules, "components/card") {
article {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
$multiplier: 1;
@if $key == "sm" {
$multiplier: 1.25;
} @else if $key == "md" {
$multiplier: 1.5;
} @else if $key == "lg" {
$multiplier: 1.75;
} @else if $key == "xl" {
$multiplier: 2;
}
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * $multiplier);
}
}
}
}
}
// Modal
@if map.get($modules, "components/modal") {
dialog > article {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2);
#{$✨}block-spacing-horizontal: var(#{$}spacing);
@if map.get($breakpoints, "sm") {
@media (min-width: map.get(map.get($breakpoints, "sm"), "breakpoint")) {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2.5);
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * 1.25);
}
}
@if map.get($breakpoints, "md") {
@media (min-width: map.get(map.get($breakpoints, "md"), "breakpoint")) {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 3);
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * 1.5);
}
}
}
}
}
// Link
@if map.get($modules, "content/link") {
a {
#{$✨}text-decoration: underline;
// Secondary & Contrast
@if enable-classes {
&.secondary,
&.contrast {
#{$✨}text-decoration: underline;
}
}
}
}
// Typography
@if map.get($modules, "content/typography") {
// Small
small {
#{$✨}font-size: 0.875em;
}
// Headings
h1,
h2,
h3,
h4,
h5,
h6 {
#{$✨}font-weight: 700;
}
h1 {
#{$✨}font-size: 2rem;
#{$✨}line-height: 1.25;
#{$✨}typography-spacing-top: 3rem;
}
h2 {
#{$✨}font-size: 1.75rem;
#{$✨}line-height: 1.3;
#{$✨}typography-spacing-top: 2.625rem;
}
h3 {
#{$✨}font-size: 1.5rem;
#{$✨}line-height: 1.35;
#{$✨}typography-spacing-top: 2.25rem;
}
h4 {
#{$✨}font-size: 1.25rem;
#{$✨}line-height: 1.4;
#{$✨}typography-spacing-top: 1.874rem;
}
h5 {
#{$✨}font-size: 1.125rem;
#{$✨}line-height: 1.45;
#{$✨}typography-spacing-top: 1.6875rem;
}
h6 {
#{$✨}font-size: 1rem;
#{$✨}typography-spacing-top: 1.5rem;
}
}
// Table
@if map.get($modules, "content/table") {
thead,
tfoot {
th,
td {
#{$✨}border-width: 3px;
}
}
:not(thead, tfoot) > * > td {
font-size: 0.875em;
}
}
// Code
@if map.get($modules, "content/code") {
pre,
code,
kbd,
samp {
#{$✨}font-family: "Menlo", "Consolas", "Roboto Mono", "Ubuntu Monospace", "Noto Mono",
"Oxygen Mono", "Liberation Mono", monospace, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol", "Noto Color Emoji";
}
kbd {
#{$✨}font-weight: bolder;
}
}
// Inputs and Selects
input:not(
[type="submit"],
[type="button"],
[type="reset"],
[type="checkbox"],
[type="radio"],
[type="file"]
),
:where(select, textarea) {
#{$✨}outline-width: 0.0625rem;
}
// Checkboxes, Radios and Switches
@if map.get($modules, "forms/checkbox-radio-switch") {
[type="checkbox"],
[type="radio"] {
#{$✨}border-width: 0.125rem;
}
[type="checkbox"][role="switch"] {
#{$✨}border-width: 0.1875rem;
}
}
// Dropdown (<details role="list">)
@if map.get($modules, "components/dropdown") {
details[role="list"] {
summary:not([role="button"]) {
#{$✨}outline-width: 0.0625rem;
}
}
}
}