File tree Expand file tree Collapse file tree 3 files changed +32
-13
lines changed
packages/components/table Expand file tree Collapse file tree 3 files changed +32
-13
lines changed Original file line number Diff line number Diff line change 3232 "react" : " ^18.2.0"
3333 },
3434 "dependencies" : {
35+ "@react-ck/provisional" : " ^1.2.7" ,
3536 "@react-ck/scss-utils" : " ^1.1.3" ,
3637 "@react-ck/text" : " ^1.4.7" ,
3738 "@react-ck/theme" : " ^1.6.7" ,
Original file line number Diff line number Diff line change 11import React from "react" ;
22import styles from "./styles/index.module.scss" ;
33import classNames from "classnames" ;
4+ import { ScrollableContainer } from "@react-ck/provisional" ;
45
56export interface TableProps extends React . HTMLAttributes < HTMLDivElement > {
67 /** Specifies the visual style of the table */
@@ -22,16 +23,34 @@ export const Table = ({
2223 scrollable,
2324 ...otherProps
2425} : Readonly < TableProps > ) : React . ReactElement => (
25- < div
26- { ...otherProps }
27- className = { classNames (
28- styles . root ,
29- {
30- [ `${ styles . scrollable } ` ] : scrollable ,
31- [ `${ styles [ skin ] } ` ] : skin !== "default" ,
32- } ,
33- className ,
34- ) } >
35- < table className = { styles . table } > { children } </ table >
36- </ div >
26+ < >
27+ { scrollable ? (
28+ < ScrollableContainer
29+ { ...otherProps }
30+ className = { classNames (
31+ styles . root ,
32+ {
33+ [ `${ styles . scrollable } ` ] : scrollable ,
34+ [ `${ styles [ skin ] } ` ] : skin !== "default" ,
35+ } ,
36+ className ,
37+ ) } >
38+ < table className = { styles . table } > { children } </ table >
39+ </ ScrollableContainer >
40+ ) : null }
41+
42+ { ! scrollable && (
43+ < div
44+ { ...otherProps }
45+ className = { classNames (
46+ styles . root ,
47+ {
48+ [ `${ styles [ skin ] } ` ] : skin !== "default" ,
49+ } ,
50+ className ,
51+ ) } >
52+ < table className = { styles . table } > { children } </ table >
53+ </ div >
54+ ) }
55+ </ >
3756) ;
Original file line number Diff line number Diff line change 1212}
1313
1414.scrollable {
15- overflow : auto ;
1615 max-width : 100% ;
1716 max-height : 100% ;
1817
You can’t perform that action at this time.
0 commit comments