diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-04-05 18:25:34 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-04-05 18:36:06 +0200 |
commit | 6fb87d1d8ba8752d9687af6b91d50eb3d20d4e99 (patch) | |
tree | 973fbd1a2bd12660fa412f77cf2910c529ca9201 | |
parent | Resume formatting (diff) | |
download | blog-6fb87d1d8ba8752d9687af6b91d50eb3d20d4e99.tar.gz blog-6fb87d1d8ba8752d9687af6b91d50eb3d20d4e99.tar.zst blog-6fb87d1d8ba8752d9687af6b91d50eb3d20d4e99.zip |
Heading font weight
-rw-r--r-- | src/components/landing/sections/Hero.module.css | 2 | ||||
-rw-r--r-- | src/css/custom.css | 12 | ||||
-rw-r--r-- | src/theme/BlogPostItem/Header/Title.module.css | 26 | ||||
-rw-r--r-- | src/theme/BlogPostItem/Header/Title.tsx | 32 |
4 files changed, 71 insertions, 1 deletions
diff --git a/src/components/landing/sections/Hero.module.css b/src/components/landing/sections/Hero.module.css index 0d0e16e..01a5b7b 100644 --- a/src/components/landing/sections/Hero.module.css +++ b/src/components/landing/sections/Hero.module.css | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | .introduction__name { | 64 | .introduction__name { |
65 | font-family: var(--ifm-heading-font-family); | 65 | font-family: var(--ifm-heading-font-family); |
66 | font-weight: var(--ifm-heading-font-weight); | 66 | font-weight: var(--marussy-very-bold); |
67 | --casl: 1; | 67 | --casl: 1; |
68 | font-size: 3rem; | 68 | font-size: 3rem; |
69 | letter-spacing: var(--marussy-heading-tracking); | 69 | letter-spacing: var(--marussy-heading-tracking); |
diff --git a/src/css/custom.css b/src/css/custom.css index 3b70182..b84aec3 100644 --- a/src/css/custom.css +++ b/src/css/custom.css | |||
@@ -35,6 +35,7 @@ | |||
35 | --marussy-heading-tracking: -0.031em; | 35 | --marussy-heading-tracking: -0.031em; |
36 | --marussy-button-tracking: -0.026em; | 36 | --marussy-button-tracking: -0.026em; |
37 | --marussy-slightly-casl: 0.25; | 37 | --marussy-slightly-casl: 0.25; |
38 | --marussy-very-bold: 800; | ||
38 | } | 39 | } |
39 | 40 | ||
40 | /* For readability concerns, you should choose a lighter palette in dark mode. */ | 41 | /* For readability concerns, you should choose a lighter palette in dark mode. */ |
@@ -49,6 +50,12 @@ | |||
49 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); | 50 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); |
50 | } | 51 | } |
51 | 52 | ||
53 | @media (max-width: 576px) { | ||
54 | :root { | ||
55 | --marussy-very-bold: var(--ifm-heading-font-weight); | ||
56 | } | ||
57 | } | ||
58 | |||
52 | * { | 59 | * { |
53 | /* | 60 | /* |
54 | * We must use `!important` here, because Infima sometimes sets font | 61 | * We must use `!important` here, because Infima sometimes sets font |
@@ -98,6 +105,7 @@ h3 { | |||
98 | letter-spacing: var(--marussy-heading-tracking); | 105 | letter-spacing: var(--marussy-heading-tracking); |
99 | } | 106 | } |
100 | 107 | ||
108 | |||
101 | .button--lg { | 109 | .button--lg { |
102 | letter-spacing: var(--marussy-button-tracking); | 110 | letter-spacing: var(--marussy-button-tracking); |
103 | } | 111 | } |
@@ -108,6 +116,10 @@ h3 { | |||
108 | --mono: 1; | 116 | --mono: 1; |
109 | } | 117 | } |
110 | 118 | ||
119 | .hero__title { | ||
120 | font-weight: var(--marussy-very-bold); | ||
121 | } | ||
122 | |||
111 | .hero__subtitle { | 123 | .hero__subtitle { |
112 | font-weight: 500; | 124 | font-weight: 500; |
113 | } | 125 | } |
diff --git a/src/theme/BlogPostItem/Header/Title.module.css b/src/theme/BlogPostItem/Header/Title.module.css new file mode 100644 index 0000000..9da03c1 --- /dev/null +++ b/src/theme/BlogPostItem/Header/Title.module.css | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright (c) Facebook, Inc. and its affiliates. | ||
3 | * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com> | ||
4 | * | ||
5 | * SPDX-License-Identifier: MIT | ||
6 | * | ||
7 | * This file was derived from | ||
8 | * https://github.com/facebook/docusaurus/blob/73016d4936164ba38d4b86ec2aa8c168b5904a21/packages/docusaurus-theme-classic/src/theme/BlogPostItem/Header/Title/styles.module.css | ||
9 | * via the `swizzle` mechanism of Docusaurus. | ||
10 | * | ||
11 | * It was modified to embed JSX content directly in the footer. | ||
12 | */ | ||
13 | |||
14 | .title { | ||
15 | font-size: 3rem; | ||
16 | font-weight: var(--marussy-very-bold); | ||
17 | } | ||
18 | |||
19 | /** | ||
20 | Blog post title should be smaller on smaller devices | ||
21 | **/ | ||
22 | @media (max-width: 576px) { | ||
23 | .title { | ||
24 | font-size: 2rem; | ||
25 | } | ||
26 | } | ||
diff --git a/src/theme/BlogPostItem/Header/Title.tsx b/src/theme/BlogPostItem/Header/Title.tsx new file mode 100644 index 0000000..ced0916 --- /dev/null +++ b/src/theme/BlogPostItem/Header/Title.tsx | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (c) Facebook, Inc. and its affiliates. | ||
3 | * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com> | ||
4 | * | ||
5 | * SPDX-License-Identifier: MIT | ||
6 | * | ||
7 | * This file was derived from | ||
8 | * https://github.com/facebook/docusaurus/blob/73016d4936164ba38d4b86ec2aa8c168b5904a21/packages/docusaurus-theme-classic/src/theme/BlogPostItem/Header/Title/index.tsx | ||
9 | * via the `swizzle` mechanism of Docusaurus. | ||
10 | * | ||
11 | * It was modified to embed JSX content directly in the footer. | ||
12 | */ | ||
13 | |||
14 | import clsx from 'clsx'; | ||
15 | import Link from '@docusaurus/Link'; | ||
16 | import {useBlogPost} from '@docusaurus/theme-common/internal'; | ||
17 | import type {Props} from '@theme/BlogPostItem/Header/Title'; | ||
18 | |||
19 | import styles from './Title.module.css'; | ||
20 | |||
21 | export default function BlogPostItemHeaderTitle({ | ||
22 | className, | ||
23 | }: Props): JSX.Element { | ||
24 | const {metadata, isBlogPostPage} = useBlogPost(); | ||
25 | const {permalink, title} = metadata; | ||
26 | const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; | ||
27 | return ( | ||
28 | <TitleHeading className={clsx(styles.title, className)}> | ||
29 | {isBlogPostPage ? title : <Link to={permalink}>{title}</Link>} | ||
30 | </TitleHeading> | ||
31 | ); | ||
32 | } | ||