File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
packages/styled-react/src/components Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1- import { Table as PrimerDataTable } from '@primer/react/experimental'
1+ import { Table as PrimerDataTable , type TableContainerProps } from '@primer/react/experimental'
22import { sx , type SxProp } from '../sx'
33import styled from 'styled-components'
44import type React from 'react'
5- import type { ComponentProps } from 'react'
65
76const { Container : PrimerDataTableContainer , ...rest } = PrimerDataTable
87
9- type DataTableContainerProps = ComponentProps < typeof PrimerDataTable . Container > & SxProp
8+ type DataTableContainerProps < As extends React . ElementType = 'div' > = TableContainerProps < As > & SxProp
109
11- const DataTableContainer : React . ComponentType < DataTableContainerProps > = styled ( PrimerDataTableContainer ) . withConfig ( {
10+ const StyleDataTableContainer : React . ComponentType < DataTableContainerProps > = styled (
11+ PrimerDataTableContainer ,
12+ ) . withConfig ( {
1213 shouldForwardProp : prop => ( prop as keyof DataTableContainerProps ) !== 'sx' ,
1314} ) < DataTableContainerProps > `
1415 ${ sx }
15- `
16+ ` as typeof PrimerDataTable . Container & {
17+ < As extends React . ElementType = 'div' > ( props : DataTableContainerProps < As > ) : React . ReactElement | null
18+ }
19+
20+ const DataTableContainer = function DataTableContainer < As extends React . ElementType = 'div' > ( {
21+ as,
22+ ...rest
23+ } : DataTableContainerProps < As > ) {
24+ return < StyleDataTableContainer { ...rest } { ...( as ? { forwardedAs : as } : { } ) } />
25+ }
1626
1727const Table : typeof PrimerDataTable & {
1828 Container : typeof DataTableContainer
You can’t perform that action at this time.
0 commit comments