Skip to content

Commit a00af25

Browse files
authored
Merge pull request #11 from hivemq/update-headings
update heading styles
2 parents 37266da + 2765d51 commit a00af25

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

testing/src/views/Headings.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function Headings() {
66
return (
77
<>
88
{headings.map(heading => (
9-
<Heading as={heading} key={`header_${heading}`} >
9+
<Heading as={heading} key={`header_${heading}`} marginBottom="4" >
1010
{heading.toUpperCase()} (Heading {heading[1]})
1111
</Heading>
1212
))}

theme/src/components/headings.ts

+16-35
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
11
import { defineStyle, defineStyleConfig } from '@chakra-ui/react'
22

3-
const h1 = defineStyle({
4-
fontFamily: "Raleway",
5-
fontSize: '2rem',
6-
fontStyle: 'normal',
7-
fontWeight: '800',
8-
lineHeight: '2.25rem'
9-
})
3+
function headingStyle(fontSizeRem: number, lineHeightRem: number) {
4+
return defineStyle({
5+
fontFamily: 'Raleway',
6+
fontStyle: 'normal',
7+
fontWeight: '800',
8+
fontSize: `${fontSizeRem}rem`,
9+
lineHeight: `${lineHeightRem}rem`,
10+
letterSpacing: `-${0.02 * fontSizeRem}rem` // -2%
11+
})
12+
}
1013

11-
const h2 = defineStyle({
12-
fontFamily: "Raleway",
13-
fontSize: '1.5rem',
14-
fontStyle: 'normal',
15-
fontWeight: '700',
16-
lineHeight: '2rem'
17-
})
14+
const h1 = headingStyle(2.25, 2.75)
1815

19-
const h3 = defineStyle({
20-
fontFamily: "Raleway",
21-
fontSize: '1.25rem',
22-
fontStyle: 'normal',
23-
fontWeight: '600',
24-
lineHeight: '2rem'
25-
})
16+
const h2 = headingStyle(1.875, 2.25)
2617

27-
const h4 = defineStyle({
28-
fontFamily: "Raleway",
29-
fontSize: '1rem',
30-
fontStyle: 'normal',
31-
fontWeight: '600',
32-
lineHeight: '1.75rem'
33-
})
18+
const h3 = headingStyle(1.125, 1.5)
3419

35-
const h5 = defineStyle({
36-
fontFamily: "Raleway",
37-
fontSize: '0.875rem',
38-
fontStyle: 'normal',
39-
fontWeight: '500',
40-
lineHeight: '1.75rem'
41-
})
20+
const h4 = headingStyle(1, 1.25)
21+
22+
const h5 = headingStyle(.875, 1)
4223

4324
const variants = {
4425
h1,

0 commit comments

Comments
 (0)