Skip to content

Commit e037901

Browse files
committed
feat: TableContainer
1 parent 7b22b4c commit e037901

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solved-ac/ui-react",
3-
"version": "0.0.1-alpha.34",
3+
"version": "0.0.1-alpha.35",
44
"description": "React component library used by solved.ac",
55
"author": "shiftpsh",
66
"license": "MIT",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React, { ElementType } from 'react'
2+
import styled from 'styled-components'
3+
import { PC, PP, PR } from '../../types/PolymorphicElementProps'
4+
5+
const TableContainerContainer = styled.div`
6+
overflow-x: auto;
7+
`
8+
9+
export const TableContainer: PC<'div'> = React.forwardRef(
10+
<T extends ElementType>(props: PP<T>, ref?: PR<T>) => {
11+
const { as = 'table', ...rest } = props
12+
13+
return (
14+
<TableContainerContainer
15+
ref={ref}
16+
as={as}
17+
{...rest}
18+
/>
19+
)
20+
}
21+
)

src/components/Table/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from './Cell'
22
export * from './Row'
33
export * from './Table'
44
export * from './TableBody'
5+
export * from './TableContainer'
56
export * from './TableFoot'
67
export * from './TableHead'
78

0 commit comments

Comments
 (0)