refactor: ♻️ modularize button gradients
This allows for more flexibility when recoloring buttons
This commit is contained in:
parent
5a3b2ac3d4
commit
05bae8229f
5 changed files with 69 additions and 40 deletions
|
@ -38,11 +38,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
|
--gradient-dir: to bottom right;
|
||||||
|
--gradient-base: var(--clr-box-background);
|
||||||
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.2) c h);
|
||||||
|
--gradient-end: oklch(from var(--gradient-base) l c h);
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom right,
|
var(--gradient-dir),
|
||||||
var(--clr-box-gradient-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-box-gradient-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
|
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
|
@ -61,13 +66,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host::before {
|
:host::before {
|
||||||
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.1) c h);
|
||||||
|
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: var(--border-thin);
|
inset: var(--border-thin);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom right,
|
var(--gradient-dir),
|
||||||
var(--clr-quick-info-bg-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-quick-info-bg-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
@ -89,18 +96,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host .filter-button label {
|
:host .filter-button label {
|
||||||
--clr-box-background: var(--clr-button);
|
--gradient-base: var(--clr-button);
|
||||||
--clr-box-gradient-start: oklch(from var(--clr-box-background) calc(l + 0.2) c h);
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.2) c h);
|
||||||
--clr-box-gradient-end: oklch(from var(--clr-box-background) l c h);
|
--gradient-end: oklch(from var(--gradient-base) l c h);
|
||||||
--gradient-dir: to bottom right;
|
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
var(--gradient-dir),
|
var(--gradient-dir),
|
||||||
var(--clr-box-gradient-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-box-gradient-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -118,15 +124,21 @@
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
&::before {
|
:host .filter-button label::before {
|
||||||
content: '';
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.1) c h);
|
||||||
position: absolute;
|
|
||||||
inset: var(--border-thin);
|
content: '';
|
||||||
background-color: var(--clr-box-background);
|
position: absolute;
|
||||||
border-radius: inherit;
|
inset: var(--border-thin);
|
||||||
z-index: -1;
|
background: linear-gradient(
|
||||||
}
|
var(--gradient-dir),
|
||||||
|
var(--gradient-start) 0%,
|
||||||
|
var(--gradient-end) 50%
|
||||||
|
);
|
||||||
|
border-radius: inherit;
|
||||||
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host .filter-button input:checked + label {
|
:host .filter-button input:checked + label {
|
||||||
|
|
|
@ -140,15 +140,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host .positive {
|
:host .positive {
|
||||||
--clr-box-background: var(--clr-yes);
|
--gradient-base: var(--clr-yes);
|
||||||
--clr-box-gradient-start: oklch(from var(--clr-box-background) calc(l + 0.2) c h);
|
|
||||||
--clr-box-gradient-end: oklch(from var(--clr-box-background) l c h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host .negative {
|
:host .negative {
|
||||||
--clr-box-background: var(--clr-no);
|
--gradient-base: var(--clr-no);
|
||||||
--clr-box-gradient-start: oklch(from var(--clr-box-background) calc(l + 0.2) c h);
|
|
||||||
--clr-box-gradient-end: oklch(from var(--clr-box-background) l c h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@starting-style {
|
@starting-style {
|
||||||
|
|
|
@ -5,11 +5,15 @@
|
||||||
|
|
||||||
<style webc:scoped="quick-info">
|
<style webc:scoped="quick-info">
|
||||||
:host {
|
:host {
|
||||||
|
--gradient-dir: to bottom right;
|
||||||
|
--gradient-start: var(--clr-box-gradient-start);
|
||||||
|
--gradient-end: var(--clr-box-gradient-end);
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom right,
|
var(--gradient-dir),
|
||||||
var(--clr-box-gradient-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-box-gradient-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
|
|
||||||
box-shadow: 0.125em 0.125em 0.5em var(--clr-box-shadow);
|
box-shadow: 0.125em 0.125em 0.5em var(--clr-box-shadow);
|
||||||
|
@ -22,13 +26,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host::before {
|
:host::before {
|
||||||
|
--gradient-start: var(--clr-quick-info-gradient-start);
|
||||||
|
--gradient-end: var(--clr-quick-info-gradient-end);
|
||||||
|
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: var(--border-thin);
|
inset: var(--border-thin);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom right,
|
var(--gradient-dir),
|
||||||
var(--clr-quick-info-bg-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-quick-info-bg-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
|
@ -3,15 +3,19 @@
|
||||||
<style webc:scoped="button">
|
<style webc:scoped="button">
|
||||||
:host {
|
:host {
|
||||||
--gradient-dir: to bottom right;
|
--gradient-dir: to bottom right;
|
||||||
|
--gradient-base: var(--clr-box-background);
|
||||||
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.2) c h);
|
||||||
|
--gradient-end: oklch(from var(--gradient-base) l c h);
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
var(--gradient-dir),
|
var(--gradient-dir),
|
||||||
var(--clr-box-gradient-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-box-gradient-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
|
|
||||||
color: white;
|
color: var(--clr-text);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
@ -26,10 +30,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host::before {
|
:host::before {
|
||||||
|
--gradient-start: oklch(from var(--gradient-base) calc(l + 0.1) c h);
|
||||||
|
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: var(--border-thin);
|
inset: var(--border-thin);
|
||||||
background-color: var(--clr-box-background);
|
background: linear-gradient(
|
||||||
|
var(--gradient-dir),
|
||||||
|
var(--gradient-start) 0%,
|
||||||
|
var(--gradient-end) 50%
|
||||||
|
);
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,8 @@
|
||||||
|
|
||||||
:host :where(.prev, .next, .indicator-btn) {
|
:host :where(.prev, .next, .indicator-btn) {
|
||||||
--gradient-dir: to bottom right;
|
--gradient-dir: to bottom right;
|
||||||
|
--gradient-start: var(--clr-box-gradient-start);
|
||||||
|
--gradient-end: var(--clr-box-gradient-end);
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@ -131,8 +133,8 @@
|
||||||
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
var(--gradient-dir),
|
var(--gradient-dir),
|
||||||
var(--clr-box-gradient-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-box-gradient-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
|
|
||||||
box-shadow: 0.125em 0.125em 0.5em var(--clr-box-shadow);
|
box-shadow: 0.125em 0.125em 0.5em var(--clr-box-shadow);
|
||||||
|
@ -150,14 +152,16 @@
|
||||||
|
|
||||||
:host :where(.prev, .next, .indicator-btn)::after {
|
:host :where(.prev, .next, .indicator-btn)::after {
|
||||||
--gradient-dir: to bottom right;
|
--gradient-dir: to bottom right;
|
||||||
|
--gradient-start: var(--clr-quick-info-gradient-start);
|
||||||
|
--gradient-end: var(--clr-quick-info-gradient-end);
|
||||||
|
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: var(--border-thin);
|
inset: var(--border-thin);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
var(--gradient-dir),
|
var(--gradient-dir),
|
||||||
var(--clr-quick-info-bg-start) 0%,
|
var(--gradient-start) 0%,
|
||||||
var(--clr-quick-info-bg-end) 50%
|
var(--gradient-end) 50%
|
||||||
);
|
);
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue