Skip to content

Commit e6b04b8

Browse files
committed
refactor: move global styles to CSS file
1 parent 27edd12 commit e6b04b8

File tree

2 files changed

+49
-53
lines changed

2 files changed

+49
-53
lines changed

website/src/components/templates/BaseTemplate.tsx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Style, css } from "hono/css";
21
import { html } from "hono/html";
32
import type { FC, PropsWithChildren } from "hono/jsx";
43
import { basePath, originUrl, typstOfficialUrl } from "../../metadata";
@@ -133,58 +132,6 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
133132
defer
134133
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"
135134
/>
136-
<Style>{css`
137-
/* Global font family */
138-
@font-face {
139-
font-family: "HK Grotesk";
140-
src: url("${joinPath(basePath, "/fonts/hanken-grotesk/HKGrotesk-Regular.woff2")}")
141-
format("woff2");
142-
font-weight: 400;
143-
font-style: normal;
144-
font-display: swap;
145-
}
146-
147-
@font-face {
148-
font-family: "HK Grotesk";
149-
src: url("${joinPath(basePath, "/fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2")}")
150-
format("woff2");
151-
font-weight: 600;
152-
font-style: normal;
153-
font-display: swap;
154-
}
155-
156-
@font-face {
157-
font-family: "HK Grotesk";
158-
src: url("${joinPath(basePath, "/fonts/hanken-grotesk/HKGrotesk-Bold.woff2")}") format("woff2");
159-
font-weight: 700;
160-
font-style: normal;
161-
font-display: swap;
162-
}
163-
164-
@font-face {
165-
font-family: "Cascadia Mono";
166-
src: url("${joinPath(basePath, "/fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2")}")
167-
format("woff2");
168-
font-weight: 400;
169-
font-style: normal;
170-
font-display: swap;
171-
}
172-
173-
body {
174-
font-family:
175-
"HK Grotesk", Inter, "BIZ UDGothic", "BIZ UDPGothic", system-ui,
176-
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
177-
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
178-
}
179-
180-
code,
181-
pre,
182-
kbd,
183-
samp {
184-
font-family: "Cascadia Mono", SFMono-Regular, Menlo, Monaco, Consolas,
185-
"Liberation Mono", "Courier New", monospace;
186-
}
187-
`}</Style>
188135
{/* NOTE: @hono/vite-dev-server does not respect the base setting in the Vite configuration. */}
189136
{import.meta.env.DEV &&
190137
html`

website/src/globals.css

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,55 @@
11
@import "tailwindcss";
22
@plugin "@tailwindcss/typography";
33

4+
/* Global font family */
5+
@font-face {
6+
font-family: "HK Grotesk";
7+
src: url("/fonts/hanken-grotesk/HKGrotesk-Regular.woff2") format("woff2");
8+
font-weight: 400;
9+
font-style: normal;
10+
font-display: swap;
11+
}
12+
13+
@font-face {
14+
font-family: "HK Grotesk";
15+
src: url("/fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2") format("woff2");
16+
font-weight: 600;
17+
font-style: normal;
18+
font-display: swap;
19+
}
20+
21+
@font-face {
22+
font-family: "HK Grotesk";
23+
src: url("/fonts/hanken-grotesk/HKGrotesk-Bold.woff2") format("woff2");
24+
font-weight: 700;
25+
font-style: normal;
26+
font-display: swap;
27+
}
28+
29+
@font-face {
30+
font-family: "Cascadia Mono";
31+
src: url("/fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2")
32+
format("woff2");
33+
font-weight: 400;
34+
font-style: normal;
35+
font-display: swap;
36+
}
37+
38+
body {
39+
font-family:
40+
"HK Grotesk", Inter, "BIZ UDGothic", "BIZ UDPGothic", system-ui,
41+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
42+
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
43+
}
44+
45+
code,
46+
pre,
47+
kbd,
48+
samp {
49+
font-family: "Cascadia Mono", SFMono-Regular, Menlo, Monaco, Consolas,
50+
"Liberation Mono", "Courier New", monospace;
51+
}
52+
453
/* Information box */
554
.info-box {
655
@apply my-8 rounded-md border border-cyan-200 bg-cyan-50 overflow-hidden relative;

0 commit comments

Comments
 (0)