From 4e7404a444fa306ef8c8e2b189cb7babbb4a9537 Mon Sep 17 00:00:00 2001 From: Maxim Khvatalin Date: Mon, 24 Jun 2024 22:48:31 +0300 Subject: [PATCH] chore: declare fonts via linaria global styles it's handy because provides an ability to use theme constants. --- .../GlobalStyles/fonts/Digital7Mono/index.css | 7 ------- .../GlobalStyles/fonts/Digital7Mono/index.ts | 12 ++++++++++++ src/components/GlobalStyles/index.ts | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) delete mode 100644 src/components/GlobalStyles/fonts/Digital7Mono/index.css create mode 100644 src/components/GlobalStyles/fonts/Digital7Mono/index.ts diff --git a/src/components/GlobalStyles/fonts/Digital7Mono/index.css b/src/components/GlobalStyles/fonts/Digital7Mono/index.css deleted file mode 100644 index cce65bc..0000000 --- a/src/components/GlobalStyles/fonts/Digital7Mono/index.css +++ /dev/null @@ -1,7 +0,0 @@ -@font-face { - font-family: 'Digital-7Mono'; - src: url('./digital-7mono.woff2') format('woff2'); - font-weight: normal; - font-style: normal; - font-display: block; -} diff --git a/src/components/GlobalStyles/fonts/Digital7Mono/index.ts b/src/components/GlobalStyles/fonts/Digital7Mono/index.ts new file mode 100644 index 0000000..5c298c0 --- /dev/null +++ b/src/components/GlobalStyles/fonts/Digital7Mono/index.ts @@ -0,0 +1,12 @@ +import { css } from '@linaria/core' +import { Digital7Mono } from '@/theme/fonts' + +void css` + @font-face { + font-family: ${Digital7Mono}; + src: url('./digital-7mono.woff2') format('woff2'); + font-weight: normal; + font-style: normal; + font-display: block; + } +` diff --git a/src/components/GlobalStyles/index.ts b/src/components/GlobalStyles/index.ts index a9cc457..c38ea10 100644 --- a/src/components/GlobalStyles/index.ts +++ b/src/components/GlobalStyles/index.ts @@ -1,9 +1,9 @@ import { css } from '@linaria/core' import { dark1, white } from '@/theme/colors' import { darkScheme } from '@/theme/media' -import './fonts/Digital7Mono/index.css' +import './fonts/Digital7Mono' -css` +void css` :global() { html { -webkit-text-size-adjust: 100%;