Skip to content

Commit 5d8101a

Browse files
committed
Add CSS order Prettier plugin for consistent styling
1 parent 04fad00 commit 5d8101a

File tree

3 files changed

+43
-42
lines changed

3 files changed

+43
-42
lines changed

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"semi": false,
44
"singleQuote": true,
55
"printWidth": 120,
6-
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
6+
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss", "prettier-plugin-css-order"],
77
"pluginSearchDirs": false
88
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"eslint-plugin-jsx-a11y": "^6.10.2",
4848
"prettier": "^3.4.1",
4949
"prettier-plugin-astro": "^0.14.1",
50+
"prettier-plugin-css-order": "^2.1.2",
5051
"prettier-plugin-tailwindcss": "^0.6.9",
5152
"sass": "^1.81.0",
5253
"svgo": "^3.3.2",

src/components/Navigation.astro

+41-41
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ import logo from '../assets/img/logo.svg'
223223
#main-navigation {
224224
> .container {
225225
display: flex;
226-
justify-content: space-between;
227226
flex-wrap: wrap;
227+
justify-content: space-between;
228228
}
229229

230230
&.is-desktop {
231231
.desktop-menu {
232-
visibility: visible;
233232
position: static;
233+
visibility: visible;
234234
}
235235

236236
.mobile-menu {
@@ -254,10 +254,10 @@ import logo from '../assets/img/logo.svg'
254254
}
255255

256256
.desktop-menu {
257-
visibility: hidden;
258-
z-index: -99;
259257
position: absolute;
260258
left: 0;
259+
visibility: hidden;
260+
z-index: -99;
261261
}
262262

263263
.responsive-toggle {
@@ -279,9 +279,9 @@ import logo from '../assets/img/logo.svg'
279279

280280
a,
281281
button {
282-
text-decoration: none;
283282
font-size: 1.125rem;
284283
line-height: 1.6875rem;
284+
text-decoration: none;
285285
}
286286

287287
a:hover,
@@ -290,8 +290,8 @@ import logo from '../assets/img/logo.svg'
290290
.has-dropdown > button:hover,
291291
.has-dropdown > button:focus {
292292
text-decoration: underline;
293-
text-decoration-thickness: 1px;
294293
text-decoration-style: wavy;
294+
text-decoration-thickness: 1px;
295295
text-underline-offset: 7px;
296296
}
297297

@@ -317,8 +317,8 @@ import logo from '../assets/img/logo.svg'
317317
a,
318318
button {
319319
display: block;
320-
width: 100%;
321320
padding: 0.5rem 0;
321+
width: 100%;
322322
}
323323
}
324324

@@ -329,9 +329,9 @@ import logo from '../assets/img/logo.svg'
329329
display: flex;
330330
align-items: center;
331331
gap: 0.5rem;
332-
padding: 0;
333332
margin-top: -1px;
334333
border: none;
334+
padding: 0;
335335
color: var(--action-color);
336336

337337
&:hover {
@@ -343,20 +343,20 @@ import logo from '../assets/img/logo.svg'
343343
}
344344

345345
&::after {
346-
content: '';
347-
width: 0.85rem;
348-
height: 0.75em;
346+
transform: rotate(135deg);
349347
margin-top: -0.25rem;
350-
border-style: solid;
351348
border-width: 0.2em 0.2em 0 0;
349+
border-style: solid;
352350
border-color: var(--action-color);
353-
transform: rotate(135deg);
351+
width: 0.85rem;
352+
height: 0.75em;
353+
content: '';
354354
}
355355

356356
&.show {
357357
&::after {
358-
margin-top: 0.25rem;
359358
transform: rotate(-45deg);
359+
margin-top: 0.25rem;
360360
}
361361

362362
~ ul {
@@ -370,48 +370,48 @@ import logo from '../assets/img/logo.svg'
370370
ul {
371371
display: none;
372372
position: absolute;
373-
z-index: 100;
374-
min-width: 260px;
375373
top: 125%;
376374
right: 0;
377375
bottom: auto;
378376
left: 0;
379-
padding: 1rem;
380-
background-color: var(--neutral-background);
381-
border: 2px solid black;
377+
z-index: 100;
382378
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
379+
border: 2px solid black;
380+
background-color: var(--neutral-background);
381+
padding: 1rem;
382+
min-width: 260px;
383383
}
384384
}
385-
}
386385

387-
.darkmode-toggle {
388-
padding: 0;
389-
border: none;
386+
.darkmode-toggle {
387+
border: none;
388+
padding: 0;
390389

391-
.icon {
392-
inline-size: 30px;
393-
block-size: 30px;
394-
margin-top: 4px;
395-
}
390+
.icon {
391+
margin-top: 4px;
392+
inline-size: 30px;
393+
block-size: 30px;
394+
}
396395

397-
svg path {
398-
fill: var(--action-color);
399-
}
396+
svg path {
397+
fill: var(--action-color);
398+
}
400399

401-
&:hover {
402-
box-shadow: none;
400+
&:hover {
401+
box-shadow: none;
403402

404-
svg path {
405-
fill: var(--action-color-state);
403+
svg path {
404+
fill: var(--action-color-state);
405+
}
406406
}
407-
}
408407

409-
&:focus {
410-
@include outline;
408+
&:focus {
409+
@include outline;
411410

412-
&:not(:focus-visible) {
413-
outline: none;
414-
box-shadow: none;
411+
&:not(:focus-visible) {
412+
outline: none;
413+
box-shadow: none;
414+
}
415415
}
416416
}
417417
}

0 commit comments

Comments
 (0)