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

Commit bc83f24

Browse files
committed
refactor(docs): use regular component for codeblocks
1 parent c858582 commit bc83f24

File tree

8 files changed

+683
-112
lines changed

8 files changed

+683
-112
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"csb:install": "yarn && yarn bootstrap",
2525
"bootstrap": "lerna bootstrap --use-workspaces",
2626
"build:dev": "yarn workspace @chakra-ui/vue run rollup --config rollup.dev.config.js",
27-
"build": "yarn workspace @chakra-ui/vue build",
27+
"build": "lerna run build --no-private --stream",
2828
"dev": "yarn workspace @chakra-ui/vue dev",
2929
"lint": "eslint packages",
3030
"lerna:build": "lerna run build",
@@ -151,7 +151,7 @@
151151
"mdx-vue": "^1.0.2",
152152
"mdx-vue-loader": "^1.0.2",
153153
"node-fetch": "^2.6.0",
154-
"nuxt": "2.14.6",
154+
"nuxt": "2.13.3",
155155
"portal-vue": "^2.1.6",
156156
"prettier": "^1.19.1",
157157
"prismjs": "^1.19.0",
@@ -177,8 +177,8 @@
177177
"vue-meta": "^2.3.3",
178178
"vue-prism-editor": "^0.5.1",
179179
"vue-router": "^3.1.6",
180-
"vue-server-renderer": "2.6.12",
181-
"vue-template-compiler": "2.6.12",
180+
"vue-server-renderer": "^2.6.12",
181+
"vue-template-compiler": "^2.6.12",
182182
"watch": "^1.0.2",
183183
"yarn": "^1.22.10"
184184
},

packages/chakra-ui-core/src/Chakra/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ const Chakra = {
3636
// Recursively merge extended theme variables
3737
const mergedTheme = toCSSVar(merge(defaultTheme, options.extendTheme))
3838

39-
console.log('mergedTheme', mergedTheme)
40-
4139
Vue.directive('chakra', createClientDirective(mergedTheme))
4240

4341
// Bind theme and icons to prototype

packages/chakra-ui-nuxt/lib/plugin.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue'
22
import { createClientDirective } from '@chakra-ui/vue/src/directives'
33
import { colorModeObserver } from '@chakra-ui/vue/src/utils'
44
import { toCSSVar } from '@chakra-ui/styled-system'
5-
import merge from 'lodash.mergeWith'
5+
import { mergeWith as merge } from '@chakra-ui/utils'
66
import defaultTheme from '@chakra-ui/theme-vue'
77

88

@@ -11,8 +11,6 @@ const extendTheme = <%= JSON.stringify(options.extendTheme || {}, null, 2) %>
1111
// Recursively merge extended theme variables
1212
const mergedTheme = toCSSVar(merge(defaultTheme, extendTheme))
1313

14-
console.log('ChakraPlugin', mergedTheme)
15-
1614
Vue.prototype.$chakra = {
1715
theme: mergedTheme,
1816
icons: <%= JSON.stringify(options.icons, null, 2) %>

website/components/code/live-editor/live-editor-layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<div class="preview-code">
33
<div class="preview-panel">
44
<slot name="preview" />

website/components/code/live-editor/live-editor.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,36 @@ export default {
7070
props: {
7171
status: 'error',
7272
variant: 'solid'
73+
},
74+
attrs: {
75+
flexDirection: 'column',
76+
alignItems: 'flex-start',
77+
overflowX: 'scroll'
7378
}
74-
}, this.error.message),
79+
}, [
80+
h('c-text', {
81+
attrs: {
82+
fontWeight: 'bold',
83+
mb: 3
84+
}
85+
}, this.error.message),
86+
h('c-box', {
87+
props: { as: 'span' },
88+
attrs: {
89+
fontFamily: 'mono',
90+
fontSize: 'sm',
91+
whiteSpace: 'line-break'
92+
}
93+
}, this.error.stack)
94+
]),
7595
h('VueLive', {
7696
props: {
7797
code,
7898
layout: Layout
7999
},
80100
on: {
81101
error: (error) => {
82-
console.info('FANCY_ERROR', error)
102+
console.error('LIVE_CODE_ERROR: ', error)
83103
this.error = error
84104
}
85105
}

website/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
plugins: [
3131
'plugins/links.js',
3232
'plugins/editor.js',
33-
// 'plugins/chakra-ui.js',
33+
'plugins/globals.js',
3434
'plugins/vue-meta.js',
3535
'plugins/skip-to.js'
3636
],

website/plugins/chakra-ui.js renamed to website/plugins/globals.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ import Vue from 'vue'
22
import * as Chakra from '@chakra-ui/vue'
33
import Lorem from 'vue-lorem-ipsum'
44
import CarbonAd from '@/components/CarbonAd'
5-
import { extend, iconSet } from '~/utils/icons'
6-
7-
Vue.use(Chakra.default, {
8-
icons: {
9-
iconPack: 'fa',
10-
iconSet,
11-
extend
12-
}
13-
})
145

156
Vue.component('Lorem', Lorem)
167
Vue.component('CarbonAd', CarbonAd)
8+
9+
Object.keys(Chakra).forEach((key) => {
10+
if (typeof Chakra[key] === 'object' && Chakra[key].name) {
11+
Vue.component(Chakra[key].name, Chakra[key])
12+
}
13+
})

0 commit comments

Comments
 (0)