Skip to content

Commit f98513e

Browse files
Add table-related rendering to NoteView.tsx
1 parent afb4e3a commit f98513e

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

src/pages/NoteView.tsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,67 @@ const components = {
2828
p: (props: any) => <Typography variant="body1" sx={{ mb: 2, color: 'text.secondary' }} {...props} />,
2929
li: (props: any) => <Typography component="li" variant="body1" sx={{ mb: 1, color: 'text.secondary' }} {...props} />,
3030
a: (props: any) => <Typography component="a" variant="body1" color="primary" sx={{ textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }} {...props} />,
31+
table: (props: any) => (
32+
<Box
33+
sx={{
34+
my: 4,
35+
overflowX: 'auto',
36+
border: '1px solid',
37+
borderColor: 'divider',
38+
borderRadius: 2,
39+
bgcolor: 'background.paper'
40+
}}
41+
>
42+
<Box
43+
component="table"
44+
sx={{
45+
width: '100%',
46+
minWidth: 640,
47+
borderCollapse: 'collapse'
48+
}}
49+
{...props}
50+
/>
51+
</Box>
52+
),
53+
thead: (props: any) => (
54+
<Box
55+
component="thead"
56+
sx={{
57+
bgcolor: 'action.hover'
58+
}}
59+
{...props}
60+
/>
61+
),
62+
th: (props: any) => (
63+
<Box
64+
component="th"
65+
sx={{
66+
px: 2,
67+
py: 1.5,
68+
borderBottom: '1px solid',
69+
borderColor: 'divider',
70+
color: 'text.primary',
71+
fontWeight: 700,
72+
textAlign: 'left',
73+
verticalAlign: 'top'
74+
}}
75+
{...props}
76+
/>
77+
),
78+
td: (props: any) => (
79+
<Box
80+
component="td"
81+
sx={{
82+
px: 2,
83+
py: 1.25,
84+
borderBottom: '1px solid',
85+
borderColor: 'divider',
86+
color: 'text.secondary',
87+
verticalAlign: 'top'
88+
}}
89+
{...props}
90+
/>
91+
),
3192
blockquote: (props: any) => (
3293
<Box
3394
component="blockquote"

0 commit comments

Comments
 (0)