forked from react95-io/React95
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTable.tsx
45 lines (38 loc) · 1002 Bytes
/
Table.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { forwardRef } from 'react';
import styled from 'styled-components';
import { StyledScrollView } from '../ScrollView/ScrollView';
import { CommonStyledProps } from '../types';
type TableProps = {
children?: React.ReactNode;
} & React.TableHTMLAttributes<HTMLTableElement> &
CommonStyledProps;
const StyledTable = styled.table`
display: table;
width: 100%;
border-collapse: collapse;
border-spacing: 0;
font-size: 1rem;
`;
const Wrapper = styled(StyledScrollView)`
&:before {
box-shadow: none;
}
`;
const Table = forwardRef<HTMLTableElement, TableProps>(
({ children, ...otherProps }, ref) => {
return (
<Wrapper>
<StyledTable ref={ref} {...otherProps}>
{children}
</StyledTable>
</Wrapper>
);
}
);
Table.displayName = 'Table';
export * from './TableBody';
export * from './TableDataCell';
export * from './TableHead';
export * from './TableHeadCell';
export * from './TableRow';
export { Table, TableProps };