Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit c5ddd66

Browse files
committed
feat: set font-family with CSSReset
1 parent 889ed08 commit c5ddd66

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.storybook/components/Canvas.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
CBox,
4949
CIconButton,
5050
CColorModeProvider } from '../../packages/chakra-ui-core/src'
51+
5152
export default {
5253
name: 'Canvas',
5354
components: {

.storybook/config.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { configure, addDecorator, addParameters } from '@storybook/vue';
22
import Vue from 'vue'
33
import VueLive from 'vue-live'
44
import Lorem from 'vue-lorem-ipsum'
5-
import Chakra, { CThemeProvider, CColorModeProvider, CReset } from '../packages/chakra-ui-core/src'
5+
import Chakra from '../packages/chakra-ui-core/src'
66
import Canvas from './components/Canvas.vue'
7-
import theme from '../packages/chakra-ui-core/src/lib/theme'
87
import storyBookTheme from './theme'
98

109
import {
@@ -38,6 +37,13 @@ import {
3837
} from '@fortawesome/free-brands-svg-icons'
3938

4039
Vue.use(Chakra, {
40+
extendTheme: {
41+
fonts: {
42+
heading: "'Comic Sans MS'",
43+
body: "'Comic Sans MS'",
44+
monospace: "'Comic Sans MS'"
45+
}
46+
},
4147
icons: {
4248
iconPack: 'fa',
4349
iconSet: {
@@ -75,16 +81,11 @@ addParameters({
7581

7682
addDecorator(() => ({
7783
template: `
78-
<Canvas :theme="theme">
84+
<Canvas>
7985
<story/>
8086
</Canvas>
8187
`,
82-
data() {
83-
return {
84-
theme,
85-
}
86-
},
87-
components: { CThemeProvider, CColorModeProvider, CReset, Canvas }
88+
components: { Canvas }
8889
}));
8990

9091
// For playground

packages/chakra-ui-core/src/CReset/CReset.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ const defaultConfig = theme => ({
1515
color: theme.colors.gray[800],
1616
bg: undefined,
1717
borderColor: theme.colors.gray[200],
18-
placeholderColor: theme.colors.gray[400]
18+
placeholderColor: theme.colors.gray[400],
19+
fontFamily: theme.fonts.body
1920
},
2021
dark: {
2122
color: theme.colors.whiteAlpha[900],
2223
bg: theme.colors.gray[800],
2324
borderColor: theme.colors.whiteAlpha[300],
24-
placeholderColor: theme.colors.whiteAlpha[400]
25+
placeholderColor: theme.colors.whiteAlpha[400],
26+
fontFamily: theme.fonts.body
2527
}
2628
})
2729

@@ -59,13 +61,14 @@ const CReset = {
5961
}
6062
},
6163
created () {
62-
const { color, bg, borderColor, placeholderColor } = this.styleConfig[this.colorMode]
64+
const { color, bg, borderColor, placeholderColor, fontFamily } = this.styleConfig[this.colorMode]
6365
useTailwindPreflight(this.theme)
6466
injectGlobal({
6567
html: {
6668
lineHeight: 1.5,
6769
color,
68-
backgroundColor: bg
70+
backgroundColor: bg,
71+
fontFamily
6972
},
7073

7174
'*, *::before, *::after': {

0 commit comments

Comments
 (0)