Style nameing improvments.

This commit is contained in:
Fredrik Jonsson 2025-03-26 14:39:32 +01:00
commit 370d792ca8
7 changed files with 41 additions and 36 deletions

View file

@ -50,6 +50,13 @@
--color-link-hover-inverted: var(--color-white); --color-link-hover-inverted: var(--color-white);
--color-link-active-inverted: var(--color-red); --color-link-active-inverted: var(--color-red);
// Button colours.
--color-button: var(--color-brand);
--color-button-hover: var(--color-brand-alt);
--color-button-text: var(--color-white);
--color-button-text-hover: var(--color-white);
--color-button-disabled: var(--color-grey-400);
// Border colours. // Border colours.
--color-border: var(--color-brand); --color-border: var(--color-brand);
--color-border-light: var(--color-brand-light); --color-border-light: var(--color-brand-light);
@ -65,12 +72,8 @@
--color-mobile-menu: var(--color-brand); --color-mobile-menu: var(--color-brand);
--color-mobile-menu-cover: var(--color-black-20); --color-mobile-menu-cover: var(--color-black-20);
// Button colours. // Form colours.
--color-button: var(--color-brand); --color-accent: var(--color-brand);
--color-button-hover: var(--color-brand-dark);
--color-button-text: var(--color-white);
--color-button-text-hover: var(--color-white);
--color-button-disabled: var(--color-grey-400);
// Row (e.g. in table) colours. // Row (e.g. in table) colours.
--color-row-header: transparent; --color-row-header: transparent;
@ -80,8 +83,8 @@
// Status colours. // Status colours.
--color-info: var(--color-blue); --color-info: var(--color-blue);
--color-info-bg: oklch(from var(--color-blue) 100% 0.03 h); --color-info-bg: oklch(from var(--color-blue) 100% 0.03 h);
--color-status: var(--color-green); --color-success: var(--color-green);
--color-status-bg: oklch(from var(--color-green) 100% 0.03 h); --color-success-bg: oklch(from var(--color-green) 100% 0.03 h);
--color-warning: var(--color-yellow); --color-warning: var(--color-yellow);
--color-warning-bg: oklch(from var(--color-yellow) 100% 0.03 h); --color-warning-bg: oklch(from var(--color-yellow) 100% 0.03 h);
--color-error: var(--color-red); --color-error: var(--color-red);

View file

@ -12,6 +12,8 @@ html {
body { body {
// Correct the line height in all browsers. // Correct the line height in all browsers.
line-height: var(--base-line-height); line-height: var(--base-line-height);
// Accent colour for forms.
accent-color: var(--color-accent);
// Output a horizontal grid to help with debugging typography. The // Output a horizontal grid to help with debugging typography. The
// $debug variable will toggle its output. // $debug variable will toggle its output.
@include debug-grid(); @include debug-grid();

View file

@ -20,7 +20,7 @@
.button { .button {
&--accept { &--accept {
border-color: var(--color-status); border-color: var(--color-success);
} }
&--decline { &--decline {

View file

@ -1,10 +1,10 @@
.flex-inline, .flex-inline,
%flex-inline { %flex-inline {
--gap: .5rem; --flex-inline-gap: .5rem;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: var(--gap); gap: var(--flex-inline-gap);
padding: 0; padding: 0;
text-align: start; text-align: start;

View file

@ -1,52 +1,52 @@
.grid-group, .grid-group,
%grid-group { %grid-group {
--column-min: 200px; --grid-group-column-min: 200px;
--gap: 1.5rem; --grid-group-gap: 1.5rem;
display: grid; display: grid;
gap: var(--gap); gap: var(--grid-group-gap);
// Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()". // Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()".
// stylelint-disable-next-line function-name-case // stylelint-disable-next-line function-name-case
grid-template-columns: repeat(auto-fit, minmax(Min(var(--column-min), 100%), 1fr)); grid-template-columns: repeat(auto-fit, minmax(Min(var(--grid-group-column-min), 100%), 1fr));
&--fill { &--fill {
// stylelint-disable-next-line function-name-case // stylelint-disable-next-line function-name-case
grid-template-columns: repeat(auto-fill, minmax(Min(var(--column-min), 100%), 1fr)); grid-template-columns: repeat(auto-fill, minmax(Min(var(--grid-group-column-min), 100%), 1fr));
} }
&--100 { &--100 {
--column-min: 100px; --grid-group-column-min: 100px;
} }
&--150 { &--150 {
--column-min: 150px; --grid-group-column-min: 150px;
} }
&--200 { &--200 {
--column-min: 200px; --grid-group-column-min: 200px;
} }
&--250 { &--250 {
--column-min: 250px; --grid-group-column-min: 250px;
} }
&--300 { &--300 {
--column-min: 300px; --grid-group-column-min: 300px;
} }
&--350 { &--350 {
--column-min: 350px; --grid-group-column-min: 350px;
} }
&--400 { &--400 {
--column-min: 400px; --grid-group-column-min: 400px;
} }
&--500 { &--500 {
--column-min: 500px; --grid-group-column-min: 500px;
} }
&--600 { &--600 {
--column-min: 600px; --grid-group-column-min: 600px;
} }
} }

View file

@ -7,10 +7,10 @@
outline-style: solid; outline-style: solid;
width: 95%; width: 95%;
&.status { &.success {
background-color: var(--color-status-bg); background-color: var(--color-success-bg);
color: var(--color-status); color: var(--color-success);
outline-color: var(--color-status); outline-color: var(--color-success);
} }
&.info { &.info {

View file

@ -1,14 +1,14 @@
.zebra-table, .zebra-table,
%zebra-table { %zebra-table {
--cell-padding: .5rem; --table-cell-padding: .5rem;
@include respond-to-max(s) { @include respond-to-max(s) {
--cell-padding: .3rem; --table-cell-padding: .3rem;
} }
th, th,
td { td {
padding: var(--cell-padding); padding: var(--table-cell-padding);
} }
thead { thead {
@ -32,7 +32,7 @@
.responsive-table, .responsive-table,
%responsive-table { %responsive-table {
--gap: .5rem; --table-gap: .5rem;
@include respond-to-max(s) { @include respond-to-max(s) {
th { th {
@ -41,7 +41,7 @@
td { td {
display: grid; display: grid;
gap: var(--gap); gap: var(--table-gap);
grid-template-columns: 12ch auto; grid-template-columns: 12ch auto;
&::before { &::before {
@ -50,11 +50,11 @@
} }
&:first-of-type { &:first-of-type {
padding-block-start: var(--gap); padding-block-start: var(--table-gap);
} }
&:last-of-type { &:last-of-type {
padding-block-end: var(--gap); padding-block-end: var(--table-gap);
} }
} }
} }