-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from icflorescu/next
Implement rowExpansion.expandable prop, update deps
- Loading branch information
Showing
9 changed files
with
452 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/examples/expanding-rows/RowExpansionExampleExpandableRows.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.details { | ||
font-size: var(--mantine-font-size-sm); | ||
background: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6)); | ||
} | ||
|
||
.label { | ||
width: rem(130px); | ||
} |
41 changes: 41 additions & 0 deletions
41
app/examples/expanding-rows/RowExpansionExampleExpandableRows.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client'; | ||
|
||
import { Box, Group, Stack } from '@mantine/core'; | ||
import { DataTable } from '__PACKAGE__'; | ||
import { companies } from '~/data'; | ||
import classes from './RowExpansionExampleExpandableRows.module.css'; | ||
|
||
const records = companies.slice(0, 5); | ||
|
||
export function RowExpansionExampleExpandableRows() { | ||
// example-start | ||
return ( | ||
<DataTable | ||
withTableBorder | ||
withColumnBorders | ||
columns={[{ accessor: 'name' }, { accessor: 'city' }, { accessor: 'state' }]} | ||
records={records} | ||
rowExpansion={{ | ||
allowMultiple: true, | ||
expandable: ({ record: { state } }) => state === 'WY', // 👈 enable expansion only on rows where state is WY | ||
// example-skip | ||
content: ({ record }) => ( | ||
<Stack className={classes.details} p="xs" gap={6}> | ||
<Group gap={6}> | ||
<div className={classes.label}>Postal address:</div> | ||
<div> | ||
{record.streetAddress}, {record.city}, {record.state} | ||
</div> | ||
</Group> | ||
<Group gap={6}> | ||
<div className={classes.label}>Mission statement:</div> | ||
<Box fs="italic">“{record.missionStatement}”</Box> | ||
</Group> | ||
</Stack> | ||
), | ||
// example-resume | ||
}} | ||
/> | ||
); | ||
// example-end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.