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

Commit 619e65a

Browse files
committed
fix(layout): refactor divider and fix orientation
1 parent 5161d28 commit 619e65a

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

packages/layout/src/divider.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,30 @@ export const CDivider = defineComponent({
3030
...vueThemingProps,
3131
},
3232
setup(props, { slots, attrs }) {
33-
return () => {
34-
const themingProps = computed<ThemingProps>(() =>
35-
filterUndefined({
36-
colorScheme: props.colorScheme,
37-
variant: props.variant,
38-
size: props.size,
39-
styleConfig: props.styleConfig,
40-
orientation: props.orientation,
41-
})
42-
)
33+
const themingProps = computed<ThemingProps>(() =>
34+
filterUndefined({
35+
colorScheme: props.colorScheme,
36+
variant: props.variant,
37+
size: props.size,
38+
styleConfig: props.styleConfig,
39+
orientation: props.orientation,
40+
})
41+
)
4342

44-
const styles = useStyleConfig('Divider', themingProps.value)
43+
const styles = useStyleConfig('Divider', themingProps.value)
4544

46-
const {
47-
borderLeftWidth,
48-
borderBottomWidth,
49-
borderTopWidth,
50-
borderRightWidth,
51-
borderWidth,
52-
borderStyle,
53-
borderColor,
54-
...stylesRest
55-
} = styles.value
45+
const {
46+
borderLeftWidth,
47+
borderBottomWidth,
48+
borderTopWidth,
49+
borderRightWidth,
50+
borderWidth,
51+
borderStyle,
52+
borderColor,
53+
...stylesRest
54+
} = styles.value
5655

56+
const dividerStyle = computed(() => {
5757
const dividerStyles = {
5858
vertical: {
5959
borderLeftWidth:
@@ -66,7 +66,10 @@ export const CDivider = defineComponent({
6666
width: '100%',
6767
},
6868
}
69+
return dividerStyles[props.orientation!]
70+
})
6971

72+
return () => {
7073
return h(
7174
chakra('hr', {
7275
label: 'divider',
@@ -77,7 +80,7 @@ export const CDivider = defineComponent({
7780

7881
borderColor,
7982
borderStyle,
80-
...dividerStyles[props.orientation!],
83+
...dividerStyle.value,
8184
},
8285
}),
8386
{

0 commit comments

Comments
 (0)