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

Commit 6925680

Browse files
committed
feat(v-chakra): initial implementation of v-chakra directive
1 parent ec73a49 commit 6925680

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/chakra-ui-core/src/directives/chakra.directive.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { forwardProps, camelize } from '../utils'
66
import { parsePseudoStyles } from '../CPseudoBox/utils'
77

88
/** Filter attrs and return object of chakra props */
9-
function filterChakraProps(attrs) {
9+
function filterChakraProps (attrs) {
1010
const pure = {}
1111
for (const prop in attrs) {
1212
if (styleProps[camelize(prop)]) {
@@ -17,14 +17,14 @@ function filterChakraProps(attrs) {
1717
}
1818

1919
/** Purify Chakra attributes */
20-
function purifyAttrs(el, props) {
20+
function purifyAttrs (el, props) {
2121
for (const attr in props) {
2222
el.removeAttribute(attr)
2323
}
2424
}
2525

2626
/** Creates className from styles object */
27-
function createClassName(styleObject, theme) {
27+
function createClassName (styleObject, theme) {
2828
const pure = filterChakraProps(forwardProps(styleObject))
2929
const { pseudoStyles, baseProps } = parsePseudoStyles(pure)
3030
const baseStyles = systemProps({ ...baseProps, theme })
@@ -40,7 +40,7 @@ export default function createCharkaDirective (theme) {
4040
const [className, pure] = createClassName(vnode.data.attrs, theme)
4141
el.classList.add(className)
4242
purifyAttrs(el, pure)
43-
43+
4444
if (binding.value && typeof binding.value === 'object') {
4545
const [className, pure] = createClassName(binding.value, theme)
4646
el.classList.add(className)

packages/chakra-ui-core/src/utils/strings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export function kebabify (text) {
3232
* Converts a kebab-case string into camel case
3333
* @param {String} string
3434
*/
35-
export function camelize(string) {
36-
return string.replace(/[.-](\w|$)/g, function (_,x) {
37-
return x.toUpperCase();
38-
});
35+
export function camelize (string) {
36+
return string.replace(/[.-](\w|$)/g, function (_, x) {
37+
return x.toUpperCase()
38+
})
3939
}

0 commit comments

Comments
 (0)