Skip to content

Commit 2a2c3d1

Browse files
committed
add container styles
1 parent fa8c2e0 commit 2a2c3d1

17 files changed

Lines changed: 2428 additions & 3319 deletions

example/package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,36 @@
77
"type": "module",
88
"scripts": {
99
"dev": "vite",
10+
"start": "vite",
1011
"build": "tsc && vite build",
1112
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1213
"preview": "vite preview"
1314
},
1415
"dependencies": {
15-
"@ngneat/falso": "^7.1.1",
16+
"@ngneat/falso": "^7.2.0",
1617
"lodash": "^4.17.21",
1718
"react": "^18.2.0",
1819
"react-dom": "^18.2.0",
1920
"react-fluid-table": "link:..",
20-
"react-router-dom": "^6.16.0",
21+
"react-router-dom": "^6.23.1",
2122
"react-syntax-highlighter": "^15.5.0",
2223
"semantic-ui-css": "^2.5.0",
23-
"semantic-ui-react": "^2.1.4",
24-
"styled-components": "^6.0.8"
24+
"semantic-ui-react": "^2.1.5",
25+
"styled-components": "^6.1.11"
2526
},
2627
"devDependencies": {
27-
"@types/lodash": "^4.14.199",
28+
"@types/lodash": "^4.17.4",
2829
"@types/react": "^18.2.15",
2930
"@types/react-dom": "^18.2.7",
30-
"@types/react-syntax-highlighter": "^15.5.7",
31+
"@types/react-syntax-highlighter": "^15.5.13",
3132
"@typescript-eslint/eslint-plugin": "^6.0.0",
3233
"@typescript-eslint/parser": "^6.0.0",
33-
"@vitejs/plugin-react": "^4.0.3",
34-
"eslint": "^8.45.0",
35-
"eslint-plugin-react-hooks": "^4.6.0",
36-
"eslint-plugin-react-refresh": "^0.4.3",
37-
"typescript": "^5.0.2",
38-
"vite": "^4.4.5"
34+
"@vitejs/plugin-react": "^4.3.0",
35+
"eslint": "^8.57.0",
36+
"eslint-plugin-react-hooks": "^4.6.2",
37+
"eslint-plugin-react-refresh": "^0.4.7",
38+
"typescript": "^5.4.5",
39+
"vite": "^5.2.11"
3940
},
4041
"volta": {
4142
"node": "18.17.0",

example/src/Props.tsx

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import React from "react";
23
import { Table as BaseTable, ColumnProps } from "react-fluid-table";
34
import { Divider, Header, Icon, List } from "semantic-ui-react";
@@ -6,6 +7,16 @@ import ColumnPropsTable from "./ColumnProps";
67
import { Snippet } from "./Snippet";
78
import { InlineCode } from "./components/library/InlineCode";
89

10+
interface PropData {
11+
prop: string;
12+
type: string;
13+
description: string;
14+
required?: boolean;
15+
content?: () => React.ReactNode;
16+
expandedType?: () => React.ReactNode;
17+
default?: string | number;
18+
}
19+
920
const Container = styled.div`
1021
padding: 1em;
1122
background-color: white;
@@ -38,16 +49,6 @@ const Item = styled(List.Item)`
3849
width: 100%;
3950
`;
4051

41-
interface PropData {
42-
prop: string;
43-
type: string;
44-
description: string;
45-
required?: boolean;
46-
content?: () => React.ReactNode;
47-
expandedType?: () => React.ReactNode;
48-
default?: string | number;
49-
}
50-
5152
const columns: ColumnProps<PropData>[] = [
5253
{
5354
key: "prop",
@@ -77,7 +78,7 @@ const columns: ColumnProps<PropData>[] = [
7778
key: "default",
7879
header: "Default",
7980
width: 100,
80-
content: ({ row }: { row: PropData }) => (row.default ? <code>{row.default}</code> : null)
81+
content: ({ row }) => (row.default ? <code>{row.default}</code> : null)
8182
},
8283
{
8384
key: "description",
@@ -217,6 +218,18 @@ const data: PropData[] = [
217218
description:
218219
"Add custom css className to each row element. One can also pass in a function that takes in the row number in order to provide custom styling for particular rows."
219220
},
221+
{
222+
prop: "rowContainerStyle",
223+
type: "object | (index: number) => object",
224+
description:
225+
"Add custom css styles to each row container element. One can also pass in a function that takes in the row number in order to provide custom styling for particular rows."
226+
},
227+
{
228+
prop: "rowContainerClassname",
229+
type: "string | (index: number) => string",
230+
description:
231+
"Add custom css className to each row container element. One can also pass in a function that takes in the row number in order to provide custom styling for particular rows."
232+
},
220233
{
221234
prop: "subComponent",
222235
type: "Element",
@@ -337,7 +350,7 @@ const Props = () => (
337350
</Header.Subheader>
338351
</Header.Content>
339352
</Header>
340-
<Table borders data={data} columns={columns} tableHeight={500} />
353+
<Table borders data={data} columns={columns as unknown as any[]} tableHeight={500} />
341354
<Divider section />
342355
<Header dividing color="red">
343356
Required Props
@@ -692,6 +705,16 @@ interface TableProps<T> {
692705
* a function that takes the index of the row and returns an object.
693706
*/
694707
rowClassname?: string | ((index: number) => string);
708+
/**
709+
* React styles used for customizing each row container. Could be an object or
710+
* a function that takes the index of the row and returns an object.
711+
*/
712+
rowContainerStyle?: CSSProperties | ((index: number) => CSSProperties);
713+
/**
714+
* React className used for customizing each row container. Could be an object or
715+
* a function that takes the index of the row and returns an object.
716+
*/
717+
rowContainerClassname?: string | ((index: number) => string);
695718
/**
696719
* React styles used for customizing the footer.
697720
*/

0 commit comments

Comments
 (0)