mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-26 07:14:22 +02:00
redesign with css vars
This commit is contained in:
@@ -169,7 +169,8 @@ plain HTML, CSS and JS files. The HTML and CSS mostly follows
|
|||||||
which yields an intuitive, component-oriented structure.
|
which yields an intuitive, component-oriented structure.
|
||||||
|
|
||||||
The stylesheets are slightly verbose.
|
The stylesheets are slightly verbose.
|
||||||
I missed [SCSS](https://sass-lang.com/) here
|
[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
|
||||||
|
did help but I missed [SCSS](https://sass-lang.com/) here
|
||||||
and I think one of these is a must-have for bigger projects.
|
and I think one of these is a must-have for bigger projects.
|
||||||
Additionally, the global CSS namespace problem is unaddressed
|
Additionally, the global CSS namespace problem is unaddressed
|
||||||
(see e.g. [CSS Modules](https://github.com/css-modules/css-modules)).
|
(see e.g. [CSS Modules](https://github.com/css-modules/css-modules)).
|
||||||
@@ -177,8 +178,8 @@ Additionally, the global CSS namespace problem is unaddressed
|
|||||||
All JavaScript files are ES modules (`import`/`export`).
|
All JavaScript files are ES modules (`import`/`export`).
|
||||||
|
|
||||||
Note that I've opted out of web components completely.
|
Note that I've opted out of web components completely.
|
||||||
I can't clearly articulate what I dislike about them
|
I can't clearly articulate what I find problematic about them
|
||||||
but I never missed them throughout this study.
|
but I never missed them throughout the study.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -921,6 +922,7 @@ Thanks!
|
|||||||
|
|
||||||
### 12/2023
|
### 12/2023
|
||||||
|
|
||||||
|
- Redesign with CSS variables
|
||||||
- Added GitHub action for running checks and deployment
|
- Added GitHub action for running checks and deployment
|
||||||
- Edited closing section
|
- Edited closing section
|
||||||
- Updated numbers
|
- Updated numbers
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
<link rel="modulepreload" href="scripts/util.js" />
|
<link rel="modulepreload" href="scripts/util.js" />
|
||||||
<link rel="modulepreload" href="scripts/uuid.js" />
|
<link rel="modulepreload" href="scripts/uuid.js" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="styles/vars.css" />
|
||||||
<link rel="stylesheet" href="styles/base.css" />
|
<link rel="stylesheet" href="styles/base.css" />
|
||||||
<link rel="stylesheet" href="styles/app-button.css" />
|
<link rel="stylesheet" href="styles/app-button.css" />
|
||||||
<link rel="stylesheet" href="styles/app-collapsible.css" />
|
<link rel="stylesheet" href="styles/app-collapsible.css" />
|
||||||
|
@@ -11,21 +11,21 @@
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
transition: all 0.1s ease-out;
|
transition: all 0.1s ease-out;
|
||||||
color: #999;
|
color: var(--button-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-button:hover {
|
.app-button:hover {
|
||||||
color: #000;
|
color: var(--button-active-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-button:active {
|
.app-button:active {
|
||||||
transform: translate(0, 1px);
|
transform: translate(0, 1px);
|
||||||
color: #000;
|
color: var(--button-active-text);
|
||||||
background: #f3f3f3;
|
background: var(--button-active-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-button:focus {
|
.app-button:focus {
|
||||||
color: #000;
|
color: var(--button-active-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-button.-circle {
|
.app-button.-circle {
|
||||||
@@ -39,12 +39,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.app-button.-highlight {
|
.app-button.-highlight {
|
||||||
background: #111;
|
color: var(--button-highlight-text);
|
||||||
color: #fff;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-button.-highlight:hover {
|
.app-button.-highlight:hover {
|
||||||
color: #eee;
|
color: var(--button-active-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (width >= 600px) {
|
@media (width >= 600px) {
|
||||||
|
@@ -1,13 +1,9 @@
|
|||||||
.app-collapsible > .bar {
|
.app-collapsible > .bar {
|
||||||
height: 40px;
|
height: 32px;
|
||||||
line-height: 37px;
|
line-height: 29px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0.75em;
|
padding: 0 0.75em;
|
||||||
background: #eee;
|
background: var(--button-active-bg);
|
||||||
}
|
|
||||||
|
|
||||||
.app-collapsible > .bar > .toggle:active {
|
|
||||||
background: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-collapsible.-animated > .body {
|
.app-collapsible.-animated > .body {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
.app-date-picker {
|
.app-date-picker {
|
||||||
width: 260px;
|
width: 260px;
|
||||||
background: #fff;
|
background: var(--main-bg);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: rgb(0 0 0 / 10%) 0 4px 12px;
|
box-shadow: rgb(0 0 0 / 10%) 0 4px 12px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@@ -33,7 +33,8 @@
|
|||||||
/* stylelint-disable-next-line rscss/class-format */
|
/* stylelint-disable-next-line rscss/class-format */
|
||||||
.app-date-picker > .dates > thead > tr > th {
|
.app-date-picker > .dates > thead > tr > th {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
padding: 0;
|
text-transform: uppercase;
|
||||||
|
padding-bottom: 0.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stylelint-disable-next-line rscss/class-format */
|
/* stylelint-disable-next-line rscss/class-format */
|
||||||
|
@@ -1,15 +1,14 @@
|
|||||||
.app-footer {
|
.app-footer {
|
||||||
border-top: solid 1px #ccc;
|
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
color: #999;
|
color: var(--aside-text);
|
||||||
}
|
|
||||||
|
|
||||||
/* stylelint-disable-next-line rscss/no-descendant-combinator */
|
|
||||||
.app-footer a {
|
|
||||||
color: #999;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-footer > p {
|
.app-footer > p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* stylelint-disable-next-line rscss/no-descendant-combinator */
|
||||||
|
.app-footer a {
|
||||||
|
color: var(--aside-text);
|
||||||
|
}
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
.app-header {
|
.app-header {
|
||||||
background: #001f3f;
|
background: var(--header-bg);
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-header > .title {
|
.app-header > .title {
|
||||||
color: #fff;
|
color: var(--header-text);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -16,5 +16,5 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
color: #fff;
|
color: var(--header-text);
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,8 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
background: var(--main-bg);
|
||||||
|
color: var(--main-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@@ -18,17 +18,21 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: 0.25em 0 0;
|
margin: 0.25em 0 0;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
color: #aaa;
|
color: var(--aside-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-day.-past {
|
.todo-day.-past {
|
||||||
color: #ccc;
|
color: var(--disabled-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.todo-day.-past > .header > .date {
|
||||||
|
color: var(--disabled-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-day.-today > .header > .dayofweek {
|
.todo-day.-today > .header > .dayofweek {
|
||||||
color: #85144b;
|
color: var(--highlight-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-day.-today > .header > .date {
|
.todo-day.-today > .header > .date {
|
||||||
color: #000;
|
color: var(--highlight-text);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 0 0 0 30px;
|
margin: 0 0 0 30px;
|
||||||
padding: 0 30px 0 0;
|
padding: 0 30px 0 0;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid var(--main-border-light);
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
transition: transform 0.2s ease-out;
|
transition: transform 0.2s ease-out;
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-item-input > .save {
|
.todo-item-input > .save {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.25em 0;
|
padding: 0.25em 0;
|
||||||
background: #fff;
|
background: var(--main-bg);
|
||||||
transition:
|
transition:
|
||||||
transform 0.2s ease-out,
|
transform 0.2s ease-out,
|
||||||
opacity 0.2s ease-out;
|
opacity 0.2s ease-out;
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
.todo-item > .label {
|
.todo-item > .label {
|
||||||
margin: 0 0 0 30px;
|
margin: 0 0 0 30px;
|
||||||
padding-bottom: 0.25em;
|
padding-bottom: 0.25em;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid var(--main-border-light);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
margin: 0 0 0 30px;
|
margin: 0 0 0 30px;
|
||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
border-bottom: 1px solid #999;
|
border-bottom: 1px solid var(--main-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.todo-item > .form > .input {
|
.todo-item > .form > .input {
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.todo-item.-done > .label {
|
.todo-item.-done > .label {
|
||||||
color: #ccc;
|
color: var(--disabled-text);
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
public/styles/vars.css
Normal file
26
public/styles/vars.css
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
:root {
|
||||||
|
/* Named color scheme */
|
||||||
|
--white: #fefefe;
|
||||||
|
--black: #0a0a0b;
|
||||||
|
--grey1: #545e75;
|
||||||
|
--grey2: #b0b0b8;
|
||||||
|
--grey3: #d2d2d6;
|
||||||
|
--grey4: #e4ecf0;
|
||||||
|
--red: #ce2d4f;
|
||||||
|
|
||||||
|
/* UI color mapping */
|
||||||
|
--main-text: var(--black);
|
||||||
|
--main-bg: var(--white);
|
||||||
|
--main-border: var(--grey2);
|
||||||
|
--main-border-light: var(--grey3);
|
||||||
|
--header-text: var(--grey1);
|
||||||
|
--header-bg: var(--white);
|
||||||
|
--highlight-text: var(--red);
|
||||||
|
--disabled-text: var(--grey3);
|
||||||
|
--aside-text: var(--grey1);
|
||||||
|
--button-text: var(--grey1);
|
||||||
|
--button-bg: transparent;
|
||||||
|
--button-active-text: var(--black);
|
||||||
|
--button-active-bg: var(--grey4);
|
||||||
|
--button-highlight-text: var(--red);
|
||||||
|
}
|
Reference in New Issue
Block a user