Skip to content

Commit

Permalink
fix: sanitized the css linting process
Browse files Browse the repository at this point in the history
  • Loading branch information
meza committed Apr 5, 2023
1 parent 5e5488f commit 2ded62a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 41 deletions.
6 changes: 5 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"stylelint-config-standard"
],
"plugins": [
"stylelint-order"
"stylelint-order",
"stylelint-no-unsupported-browser-features"
],
"rules": {
"order/properties-alphabetical-order": true,
Expand All @@ -13,6 +14,9 @@
"first-nested"
],
"ignore": ["after-comment"]
}],
"plugin/no-unsupported-browser-features": [true, {
"ignorePartialSupport": true
}]
},
"reportDescriptionlessDisables": true,
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dev:remix": "cross-env NODE_ENV=development remix watch",
"int": "playwright test",
"lint": "run-p \"lint:*\"",
"lint:css": "postcss src/**/*.css -d .cache/postcss && rimraf .cache/postcss",
"lint:css": "stylelint --fix --cache-location .cache/stylelint --cache -c .stylelintrc.json src/**/*.css src/**/*.md src/*.md",
"lint:eslint": "eslint --ext .ts,.tsx,.json **/*.{ts,tsx,json}",
"lint:typecheck": "tsc",
"playwright:install": "playwright install --with-deps",
Expand Down Expand Up @@ -152,10 +152,8 @@
"autoprefixer": "10.4.14",
"aws-cdk": "2.72.1",
"c8": "7.13.0",
"colorguard": "1.2.1",
"config-ini-parser": "1.6.1",
"cssnano": "6.0.0",
"doiuse": "4.4.1",
"esbuild-copy-static-files": "0.1.0",
"esbuild-plugin-env": "1.0.5",
"esbuild-plugin-environment": "0.2.4",
Expand All @@ -181,7 +179,6 @@
"postcss-nested": "6.0.1",
"postcss-preset-env": "8.3.0",
"postcss-reporter": "7.0.5",
"postcss-scss": "4.0.6",
"postcss-sorting": "8.0.2",
"react-docgen-typescript": "2.2.2",
"reflect-metadata": "0.1.13",
Expand All @@ -195,6 +192,7 @@
"storybook-dark-mode-v7": "3.0.0-alpha.0",
"stylelint": "15.4.0",
"stylelint-config-standard": "32.0.0",
"stylelint-no-unsupported-browser-features": "6.1.0",
"stylelint-order": "6.0.3",
"ts-node": "10.9.1",
"tsconfig-paths": "4.2.0",
Expand Down
11 changes: 0 additions & 11 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,10 @@ module.exports = (cfg) => {
'postcss-preset-env': {
stage: 0
},
'colorguard': {},
'doiuse': {
browsers: packageJson.browserslist,
ignoreFiles: [
'**/node_modules/**/*'
]
},
'autoprefixer': {
grid: true
},
'cssnano': dev ? false : {},
'stylelint': {
configFile: '.stylelintrc.json',
fix: true
},
'postcss-reporter': {},
'postcss-custom-media': {},
}
Expand Down
4 changes: 2 additions & 2 deletions src/styles/Atoms/_all.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import './icons.css';
@import './toggle.css';
@import url('./icons.css');
@import url('./toggle.css');
37 changes: 19 additions & 18 deletions src/styles/Atoms/toggle.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.toggle-component {
display: inline-block;

/* The switch - the box around the slider */

font-size: 17px;
height: 2rem;
position: relative;
display: inline-block;
width: 3.5rem;
height: 2rem;

/* Hide default HTML checkbox */

Expand All @@ -16,28 +17,27 @@
/* The slider */

& .slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
border: 1px solid #adb5bd;
border-radius: 30px;
inset: 0;
cursor: pointer;
position: absolute;

@media (--motion-ok) {
transition: .4s;
}

&:before {
position: absolute;
&::before {
background-color: #adb5bd;
border-radius: 20px;
bottom: 0.25rem;
content: "";
height: 1.4rem;
width: 1.4rem;
border-radius: 20px;
left: 0.27rem;
bottom: 0.25rem;
background-color: #adb5bd;
position: absolute;
width: 1.4rem;

@media (--motion-ok) {
transition: .4s;
}
Expand All @@ -48,25 +48,26 @@
background-color: var(--accent-1);
border: 1px solid var(--text-2);

&:before {
transform: translateX(1.4rem);
&::before {
background-color: #fff;
transform: translateX(1.4rem);
}
}

& input:disabled + .slider {
background-color: gray;
cursor: initial;

&:before {
&::before {
background-color: transparent;
border: 1px solid white;
}
}

&:has(input:focus-visible) .slider {
background-color: var(--accent-1-200);
&:before {

&::before {
background-color: #fff;
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ html {
block-size: 100%;
font-family: 'IBM Plex Sans', sans-serif;

/* stylelint-disable-next-line number-max-precision */
/* stylelint-disable-next-line number-max-precision -- This precision is required for the exact font sizes */
font-size: calc(15px + 0.390625vw);
height: 100dvh;
margin: 0;

--accent-1: #16a799;
--accent-1-200: #8BD3CC;
--accent-2: #FF8A65;
}

body {
align-items: center;

display: grid;
grid-template-rows: 1fr auto;
height: inherit;
Expand All @@ -34,7 +34,7 @@ body {

button {
font-size: inherit;
padding: .5rem 1.2rem .5rem 1.2rem;
padding: .5rem 1.2rem;
}

button.primary {
Expand All @@ -45,6 +45,7 @@ button.primary {
@media (--motion-ok) {
animation: slide-in-fwd-center 0.8s cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.6s both;
}

text-align: center;
}

Expand Down Expand Up @@ -96,11 +97,12 @@ button.primary {
*/
@keyframes slide-in-bottom {
0% {
transform: translateY(1000px);
opacity: 0;
transform: translateY(1000px);
}

100% {
transform: translateY(0);
opacity: 1;
transform: translateY(0);
}
}
1 change: 1 addition & 0 deletions src/styles/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
--color-primary: #fff;
--color-secondary: #1C1C27;
--text-2: #607080;

color-scheme: dark;
}
1 change: 1 addition & 0 deletions src/styles/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
--color-primary: #2E2E33;
--color-secondary: #fff;
--text-2: #435660;

color-scheme: light;
}

0 comments on commit 2ded62a

Please sign in to comment.