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

Commit 5161d28

Browse files
committed
fix(layout): fix box issues and cleanup
1 parent e72d94b commit 5161d28

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

packages/layout/src/box.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
SystemStyleObject,
55
HTMLChakraProps,
66
} from '@chakra-ui/vue-system'
7-
import { defineComponent, h, PropType } from '@vue/runtime-core'
7+
import { computed, defineComponent, h, PropType } from '@vue/runtime-core'
88

99
export interface BoxProps extends HTMLChakraProps<'div'> {}
1010

@@ -61,17 +61,19 @@ export const CSquare = defineComponent({
6161
},
6262
},
6363
setup(props, { slots, attrs }) {
64-
const styles: SystemStyleObject = props.centerContent
65-
? { display: 'flex', alignItems: 'center', justifyContent: 'center' }
66-
: {}
64+
const styles = computed<SystemStyleObject>(() =>
65+
props.centerContent
66+
? { display: 'flex', alignItems: 'center', justifyContent: 'center' }
67+
: {}
68+
)
6769
return () => {
6870
return h(
6971
CBox,
7072
{
7173
label: 'square',
7274
boxSize: props.size,
7375
__css: {
74-
...styles,
76+
...styles.value,
7577
flexShrink: 0,
7678
flexGrow: 0,
7779
},
@@ -84,21 +86,13 @@ export const CSquare = defineComponent({
8486
})
8587

8688
export const CCircle = defineComponent({
87-
props: {
88-
size: [Object, String, Number] as PropType<SquareProps['size']>,
89-
centerContent: {
90-
type: [Boolean] as PropType<SquareProps['centerContent']>,
91-
default: true,
92-
},
93-
},
94-
setup(props, { slots, attrs }) {
89+
setup(_, { slots, attrs }) {
9590
return () => {
9691
return h(
9792
CSquare,
9893
{
9994
label: 'circle',
10095
borderRadius: '9999px',
101-
size: props.size,
10296
...attrs,
10397
},
10498
slots

0 commit comments

Comments
 (0)