Skip to content

Commit 15a98f0

Browse files
committed
fix table
1 parent aec26fc commit 15a98f0

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/components/editor/previews/TableContainerPreview.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useDropComponent } from '~hooks/useDropComponent'
44
import {
55
Box,
66
Table,
7-
TableCaption,
87
TableContainer,
98
Tbody,
109
Tfoot,
@@ -47,18 +46,18 @@ const acceptedTypesTable: ComponentType[] = [
4746
]
4847

4948
export const TablePreview = ({ component }: IPreviewProps) => {
50-
const { props, ref } = useInteractive(component, true)
49+
const { props, ref } = useInteractive(component, true, true)
5150
const { drop, isOver } = useDropComponent(component.id, acceptedTypesTable)
5251

53-
let boxProps: any = {}
52+
let boxProps: any = { border: '1px solid red' }
5453

5554
if (isOver) {
5655
props.bg = 'teal.50'
5756
}
5857

5958
return (
60-
<Box ref={drop(ref)} {...boxProps}>
61-
<Table {...props}>
59+
<Box ref={drop(ref)} {...props} border="1px solid green">
60+
<Table {...component.props}>
6261
{component.children.map((key: string) => (
6362
<ComponentPreview key={key} componentName={key} />
6463
))}
@@ -89,19 +88,21 @@ export const TheadPreview = ({ component }: IPreviewProps) => {
8988
const acceptedTypesTr: ComponentType[] = ['Th', 'Td']
9089

9190
export const TrPreview = ({ component }: IPreviewProps) => {
92-
const { props, ref } = useInteractive(component, true)
91+
const { props, ref } = useInteractive(component, true, true)
9392
const { drop, isOver } = useDropComponent(component.id, acceptedTypesTr)
9493

9594
if (isOver) {
9695
props.bg = 'teal.50'
9796
}
9897

9998
return (
100-
<Tr ref={drop(ref)} {...props}>
101-
{component.children.map((key: string) => (
102-
<ComponentPreview key={key} componentName={key} />
103-
))}
104-
</Tr>
99+
<Box ref={drop(ref)} {...props} border="1px solid green">
100+
<Tr {...component.props}>
101+
{component.children.map((key: string) => (
102+
<ComponentPreview key={key} componentName={key} />
103+
))}
104+
</Tr>
105+
</Box>
105106
)
106107
}
107108

src/components/inspector/panels/components/TableCaptionPanel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Select } from '@chakra-ui/react'
22
import { memo } from 'react'
3+
import ChildrenControl from '~components/inspector/controls/ChildrenControl'
34
import FormControl from '~components/inspector/controls/FormControl'
45
import SwitchControl from '~components/inspector/controls/SwitchControl'
56
import { useForm } from '~hooks/useForm'
@@ -12,6 +13,8 @@ const TableCaptionPanel = () => {
1213

1314
return (
1415
<>
16+
<ChildrenControl />
17+
1518
<FormControl label="Placement" htmlFor="placement">
1619
<Select
1720
name="placement"

src/components/inspector/panels/components/TdThPanel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { memo } from 'react'
2+
import ChildrenControl from '~components/inspector/controls/ChildrenControl'
23
import SwitchControl from '~components/inspector/controls/SwitchControl'
34

45
const TdThPanel = () => {
56
return (
67
<>
8+
<ChildrenControl />
79
<SwitchControl label="Is numeric" name="isNumeric" />
810
</>
911
)

0 commit comments

Comments
 (0)