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

Commit e04822d

Browse files
committed
chore: added plugin options file
1 parent 500d39a commit e04822d

File tree

5 files changed

+59
-33
lines changed

5 files changed

+59
-33
lines changed

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
'^@/(.*)$': '<rootDir>/$1',
1818
'@chakra-ui/theme-vue': require.resolve('./packages/chakra-ui-theme/src/index.js'),
1919
'\\.css$': require.resolve('./tests/test-utils/style-mock.js'),
20-
'breadstick': require.resolve('./tests/test-utils/module-mock.js')
20+
breadstick: require.resolve('./tests/test-utils/module-mock.js')
2121
},
2222
snapshotSerializers: [
2323
'jest-serializer-vue'

packages/chakra-ui-docs/components/SideNavContent.vue

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
p="3"
44
:color="colorMode === 'light' ? 'gray.600': 'whiteAlpha.700'"
55
>
6-
<CHeading size="xs" color="gray.400" letterSpacing="wide" mb="2" textTransform="uppercase">
6+
<CHeading size="xs" color="gray.400" letter-spacing="wide" mb="2" text-transform="uppercase">
77
Getting Started
88
</CHeading>
99
<CBox v-for="(link, index) in topNavLinks" :key="`${index}-getting-started`">
@@ -22,15 +22,22 @@
2222
rounded="md"
2323
:bg="$route.path === link.path ? 'vue.50' : 'transparent'"
2424
:color="$route.path === link.path ? 'vue.700' : 'inherit'"
25-
fontWeight="bold"
26-
fontSize="sm"
27-
textDecoration="none"
25+
font-weight="bold"
26+
font-size="sm"
27+
text-decoration="none"
2828
transition="background-color 0.15s ease-in"
2929
>
3030
{{ link.name }}
3131
</CPseudoBox>
3232
</CBox>
33-
<CHeading size="xs" color="gray.400" letterSpacing="wide" mt="4" mb="2" textTransform="uppercase">
33+
<CHeading
34+
size="xs"
35+
color="gray.400"
36+
letter-spacing="wide"
37+
mt="4"
38+
mb="2"
39+
text-transform="uppercase"
40+
>
3441
About Chakra UI Vue
3542
</CHeading>
3643
<CBox v-for="(link, index) in aboutNavLinks" :key="`${index}-about-chakra`">
@@ -49,15 +56,22 @@
4956
rounded="md"
5057
:bg="$route.path === link.path ? 'vue.50' : 'transparent'"
5158
:color="$route.path === link.path ? 'vue.700' : 'inherit'"
52-
fontWeight="bold"
53-
fontSize="sm"
54-
textDecoration="none"
59+
font-weight="bold"
60+
font-size="sm"
61+
text-decoration="none"
5562
transition="background-color 0.15s ease-in"
5663
>
5764
{{ link.name }}
5865
</CPseudoBox>
5966
</CBox>
60-
<CHeading size="xs" color="gray.400" letterSpacing="wide" mt="4" mb="2" textTransform="uppercase">
67+
<CHeading
68+
size="xs"
69+
color="gray.400"
70+
letter-spacing="wide"
71+
mt="4"
72+
mb="2"
73+
text-transform="uppercase"
74+
>
6175
Components
6276
</CHeading>
6377
<CPseudoBox
@@ -75,9 +89,9 @@
7589
}"
7690
d="block"
7791
rounded="md"
78-
fontWeight="bold"
79-
fontSize="sm"
80-
textDecoration="none"
92+
font-weight="bold"
93+
font-size="sm"
94+
text-decoration="none"
8195
:bg="$route.path === link.path ? 'vue.50' : 'transparent'"
8296
:color="$route.path === link.path ? 'vue.700' : 'inherit'"
8397
>
@@ -94,22 +108,23 @@ import { components as componentLinks } from '../utils/all-routes'
94108
const topNavLinks = [
95109
'Getting Started',
96110
'With Nuxt',
111+
'Plugin Options',
97112
'Principles',
98113
'Style Props',
99114
'Theme',
100115
'Extending Theme',
101116
'Color Mode',
102117
'Responsive Styles',
103-
'Starters',
104-
'Recipes',
105-
'Storybook'
118+
'Starters'
106119
]
107120
108121
const aboutNavLinks = [
109122
'Why Chakra UI',
110123
'Accessibility',
111124
'Constraint Based Design',
112-
'Contributing'
125+
'Contributing',
126+
'Recipes',
127+
'Storybook'
113128
]
114129
115130
export default {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import SEO from '../components/SEO'
2+
3+
<SEO
4+
title="Chakra Plugin Options"
5+
description="How to extend the capabilities of Chakra UI with the plugin"
6+
/>
7+
8+
# Plugin Options

packages/chakra-ui-docs/docs/with-nuxt.mdx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,30 @@ With Nuxt.js we need to install the [`@nuxtjs/emotion`](https://github.com/nuxt-
1515
styles to be generated and injected in the server build.
1616

1717
```bash
18-
yarn add @chakra-ui/vue emotion @nuxtjs/emotion
18+
yarn add @chakra-ui/nuxt @nuxtjs/emotion
1919
```
2020

21-
### Plugin setup
21+
# Register Module
22+
We then register the Chakra UI module in the `modules` key of our `nuxt.config.js`. [See the Nuxt documentation to learn mroe about modules in Nuxt.js](https://nuxtjs.org/guide/modules)
2223

23-
Create a file in your `plugins/` directory. For this example, we'll call it `chakra.js`. In here
24-
we shall import Vue and register the plugin.
25-
26-
```js
27-
// chakra.js
28-
import Vue from 'vue'
29-
import Chakra from '@chakra-ui/vue'
30-
31-
Vue.use(Chakra)
32-
```
33-
34-
We then add the Chakra plugin's file path in the `plugins` key of our `nuxt.config.js`. [See the Nuxt documentation to learn mroe about plugins in Nuxt.js](https://nuxtjs.org/guide/plugins)
24+
Learn more about the [Chakra plugin options here](/plugin-options)
3525

3626
```js
3727
export default {
38-
plugins: ['~/plugins/chakra']
28+
modules: [
29+
'@chakra-ui/nuxt',
30+
'@nuxtjs/emotion'
31+
],
32+
/**
33+
* Add extend the plugin options under the `chakra` key.
34+
**/
35+
chakra: {
36+
extendTheme: {
37+
colors: {
38+
brand: { /* ... */ }
39+
}
40+
}
41+
}
3942
}
4043
```
4144

tests/test-utils/test-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { render } from '@testing-library/vue'
44
import icons from '@/packages/chakra-ui-core/src/lib/internal-icons'
55
import theme from '@/packages/chakra-ui-core/src/lib/theme'
66

7-
const defaultProviders = (options) => ({
7+
const defaultProviders = options => ({
88
$chakraTheme: () => theme,
99
$chakraColorMode: () => 'light',
1010
$chakraIcons: icons,

0 commit comments

Comments
 (0)