Skip to content

Commit b3fd385

Browse files
committed
refactor: Extracting home page css in spa router template
1 parent 6bd9545 commit b3fd385

File tree

4 files changed

+50
-44
lines changed

4 files changed

+50
-44
lines changed

templates/config/router/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { render } from 'preact';
22
import { LocationProvider, Router, Route } from 'preact-iso';
33

44
import { Header } from './components/Header.jsx';
5-
import { Home } from './pages/Home.jsx';
5+
import { Home } from './pages/Home/index.jsx';
66
import { NotFound } from './pages/_404.jsx';
77
import './style.css';
88

templates/config/router/pages/Home.jsx renamed to templates/config/router/pages/Home/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import preactLogo from '../assets/preact.svg';
1+
import preactLogo from '../../assets/preact.svg';
2+
import './style.css';
23

34
export function Home() {
45
return (
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
img {
2+
margin-bottom: 1.5rem;
3+
}
4+
5+
img:hover {
6+
filter: drop-shadow(0 0 2em #673ab8aa);
7+
}
8+
9+
.home section {
10+
margin-top: 5rem;
11+
display: grid;
12+
grid-template-columns: repeat(3, 1fr);
13+
column-gap: 1.5rem;
14+
}
15+
16+
.resource {
17+
padding: 0.75rem 1.5rem;
18+
border-radius: 0.5rem;
19+
text-align: left;
20+
text-decoration: none;
21+
color: #222;
22+
background-color: #f1f1f1;
23+
border: 1px solid transparent;
24+
}
25+
26+
.resource:hover {
27+
border: 1px solid #000;
28+
box-shadow: 0 25px 50px -12px #673ab888;
29+
}
30+
31+
@media (max-width: 639px) {
32+
.home section {
33+
margin-top: 5rem;
34+
grid-template-columns: 1fr;
35+
row-gap: 1rem;
36+
}
37+
}
38+
39+
@media (prefers-color-scheme: dark) {
40+
.resource {
41+
color: #ccc;
42+
background-color: #161616;
43+
}
44+
.resource:hover {
45+
border: 1px solid #bbb;
46+
}
47+
}

templates/config/router/style.css

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,57 +56,15 @@ main {
5656
text-align: center;
5757
}
5858

59-
.home img {
60-
margin-bottom: 1.5rem;
61-
}
62-
63-
.home img:hover {
64-
filter: drop-shadow(0 0 2em #673ab8aa);
65-
}
66-
67-
.home section {
68-
margin-top: 5rem;
69-
display: grid;
70-
grid-template-columns: repeat(3, 1fr);
71-
column-gap: 1.5rem;
72-
}
73-
74-
.resource {
75-
padding: 0.75rem 1.5rem;
76-
border-radius: 0.5rem;
77-
text-align: left;
78-
text-decoration: none;
79-
color: #222;
80-
background-color: #f1f1f1;
81-
border: 1px solid transparent;
82-
}
83-
84-
.resource:hover {
85-
border: 1px solid #000;
86-
box-shadow: 0 25px 50px -12px #673ab888;
87-
}
88-
8959
@media (max-width: 639px) {
9060
main {
9161
margin: 2rem;
9262
}
93-
.home section {
94-
margin-top: 5rem;
95-
grid-template-columns: 1fr;
96-
row-gap: 1rem;
97-
}
9863
}
9964

10065
@media (prefers-color-scheme: dark) {
10166
:root {
10267
color: #ccc;
10368
background-color: #1a1a1a;
10469
}
105-
.resource {
106-
color: #ccc;
107-
background-color: #161616;
108-
}
109-
.resource:hover {
110-
border: 1px solid #bbb;
111-
}
11270
}

0 commit comments

Comments
 (0)