Skip to content

Commit

Permalink
use css logical properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightjack committed Apr 17, 2023
1 parent d1644f2 commit ede02a4
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"stylelint-config-property-sort-order-smacss",
"stylelint-prettier/recommended"
],
"plugins": ["stylelint-use-logical"],
"ignoreFiles": ["dist/**/*", "node_modules/**/*"],
"rules": {
"at-rule-no-unknown": null,
Expand All @@ -15,6 +16,7 @@
}
],
"selector-class-pattern": "^[a-z]-[a-z0-9_-]+$",
"declaration-block-no-redundant-longhand-properties": null
"declaration-block-no-redundant-longhand-properties": null,
"csstools/use-logical": true
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"stylelint-config-property-sort-order-smacss": "9.1.0",
"stylelint-config-standard": "33.0.0",
"stylelint-prettier": "3.0.0",
"stylelint-use-logical": "^2.1.0",
"vite": "4.2.1",
"vite-plugin-pwa": "0.14.7"
}
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/css/components/field.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.c-field__input {
grid-area: input;
order: 1;
min-width: 0;
min-inline-size: 0;
padding: var(--s-1) var(--s-2);
border: 0;
outline: 0;
Expand All @@ -53,7 +53,7 @@
}

.c-field__input:is([type='date'], [type='time']) {
width: auto;
inline-size: auto;
font-family: var(--font-family-mono);
font-weight: var(--font-weight-light);
}
Expand All @@ -78,7 +78,7 @@
.c-field__action {
z-index: 1;
grid-area: action;
margin-left: calc(var(--size-border-radius-s) * -1);
margin-inline-start: calc(var(--size-border-radius-s) * -1);
}

.c-field__label {
Expand All @@ -91,8 +91,8 @@

.c-field--compact .c-field__label {
position: absolute !important;
width: 1px !important;
height: 1px !important;
block-size: 1px !important;
inline-size: 1px !important;
margin: -1px !important;
padding: 0 !important;
overflow: hidden !important;
Expand Down
4 changes: 2 additions & 2 deletions src/css/components/icon.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.c-icon {
--icon-size-ratio: 1;
display: inline-block;
width: calc(var(--icon-size-ratio) * 1em);
height: calc(var(--icon-size-ratio) * 1em);
block-size: calc(var(--icon-size-ratio) * 1em);
inline-size: calc(var(--icon-size-ratio) * 1em);
line-height: inherit;
}

Expand Down
19 changes: 8 additions & 11 deletions src/css/components/loader.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.c-loader {
position: fixed;
z-index: 10;
top: 0;
left: 0;
width: 100%;
height: 100%;
block-size: 100%;
inline-size: 100%;
inset-block-start: 0;
inset-inline-start: 0;
}

@keyframes pulse {
Expand All @@ -25,9 +25,9 @@
display: block;
position: fixed;
z-index: 1;
top: 50%;
left: 50%;
width: min(128px, 80vw);
inset-block-start: 50%;
inset-inline-start: 50%;
inline-size: min(128px, 80vw);
transform: translate(-50%, -50%);
animation: pulse infinite 700ms alternate ease-in-out;
background: url('../../assets/logo.svg') no-repeat center;
Expand All @@ -38,10 +38,7 @@
.c-loader::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
inset: 0;
opacity: 0.5;
background-color: var(--color-background-canvas);
}
13 changes: 5 additions & 8 deletions src/css/components/timecard.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

.c-timecard__title {
grid-area: title;
margin-top: var(--s-0);
margin-bottom: var(--s-0);
margin-block: var(--s-0);
overflow: hidden;
font-size: var(--font-size-l);
font-weight: var(--font-weight-semibold);
Expand All @@ -30,8 +29,7 @@

.c-timecard__zone {
grid-area: zone;
margin-top: calc(var(--s-3) * -1);
margin-bottom: var(--s-0);
margin-block: calc(var(--s-3) * -1) var(--s-0);
font-size: var(--font-size-s);
}

Expand All @@ -52,8 +50,8 @@

.c-timecard__close::after {
content: '';
width: 100%;
margin-left: -100%;
inline-size: 100%;
margin-inline-start: -100%;
aspect-ratio: 1;
transition: opacity 100ms ease-out;
opacity: 0;
Expand All @@ -70,8 +68,7 @@
display: flex;
grid-area: fields;
align-items: flex-end;
margin-right: 0;
margin-left: 0;
margin-inline: 0;
padding: 0;
border: 0;
font-size: var(--font-size-m);
Expand Down
8 changes: 4 additions & 4 deletions src/css/components/toast.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
--toast-breakpoint: calc(36rem - 100%);
display: flex;
position: fixed;
bottom: 0;
left: 0;
inset-block-end: 0;
inset-inline-start: 0;
flex-wrap: wrap;
align-items: center;
width: 100%;
min-width: 0;
inline-size: 100%;
min-inline-size: 0;
margin: 0;
padding: var(--s-2);
background-color: var(--color-background-primary);
Expand Down
4 changes: 2 additions & 2 deletions src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
@import url('./utilities.css');

html {
height: 100%;
block-size: 100%;
font-family: var(--font-family-sans);
font-size: 100%;
line-height: 1.5;
}

body {
min-height: 100%;
min-block-size: 100%;
background-color: var(--color-background-canvas);
}
4 changes: 2 additions & 2 deletions src/css/utilities.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.u-visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
block-size: 1px !important;
inline-size: 1px !important;
margin: -1px !important;
padding: 0 !important;
overflow: hidden !important;
Expand Down

0 comments on commit ede02a4

Please sign in to comment.