-
-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c60afb0
commit fea94c9
Showing
2 changed files
with
97 additions
and
97 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
190 changes: 95 additions & 95 deletions
190
packages/material-react-table/stories/fixed-bugs/fullscreen-with-appbar.stories.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 |
---|---|---|
@@ -1,122 +1,122 @@ | ||
import { AppBar, Box, CssBaseline, Toolbar } from '@mui/material'; | ||
import { type Meta } from '@storybook/react'; | ||
import { MaterialReactTable, useMaterialReactTable, type MRT_ColumnDef } from '../../src'; | ||
import { | ||
MaterialReactTable, | ||
useMaterialReactTable, | ||
type MRT_ColumnDef, | ||
} from '../../src'; | ||
|
||
const meta: Meta = { | ||
title: 'Fixed Bugs/AppBar overlaps with Fullscreen Modal', | ||
title: 'Fixed Bugs/AppBar overlaps with Fullscreen Modal', | ||
}; | ||
|
||
export default meta; | ||
|
||
|
||
|
||
//example data type | ||
type Person = { | ||
name: { | ||
firstName: string; | ||
lastName: string; | ||
}; | ||
address: string; | ||
city: string; | ||
state: string; | ||
name: { | ||
firstName: string; | ||
lastName: string; | ||
}; | ||
address: string; | ||
city: string; | ||
state: string; | ||
}; | ||
|
||
//nested data is ok, see accessorKeys in ColumnDef below | ||
const data: Person[] = [ | ||
{ | ||
name: { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}, | ||
address: '261 Erdman Ford', | ||
city: 'East Daphne', | ||
state: 'Kentucky', | ||
{ | ||
name: { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Jane', | ||
lastName: 'Doe', | ||
}, | ||
address: '769 Dominic Grove', | ||
city: 'Columbus', | ||
state: 'Ohio', | ||
address: '261 Erdman Ford', | ||
city: 'East Daphne', | ||
state: 'Kentucky', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Jane', | ||
lastName: 'Doe', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Joe', | ||
lastName: 'Doe', | ||
}, | ||
address: '566 Brakus Inlet', | ||
city: 'South Linda', | ||
state: 'West Virginia', | ||
address: '769 Dominic Grove', | ||
city: 'Columbus', | ||
state: 'Ohio', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Joe', | ||
lastName: 'Doe', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Kevin', | ||
lastName: 'Vandy', | ||
}, | ||
address: '722 Emie Stream', | ||
city: 'Lincoln', | ||
state: 'Nebraska', | ||
address: '566 Brakus Inlet', | ||
city: 'South Linda', | ||
state: 'West Virginia', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Kevin', | ||
lastName: 'Vandy', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Joshua', | ||
lastName: 'Rolluffs', | ||
}, | ||
address: '32188 Larkin Turnpike', | ||
city: 'Omaha', | ||
state: 'Nebraska', | ||
address: '722 Emie Stream', | ||
city: 'Lincoln', | ||
state: 'Nebraska', | ||
}, | ||
{ | ||
name: { | ||
firstName: 'Joshua', | ||
lastName: 'Rolluffs', | ||
}, | ||
address: '32188 Larkin Turnpike', | ||
city: 'Omaha', | ||
state: 'Nebraska', | ||
}, | ||
]; | ||
|
||
const columns: MRT_ColumnDef<Person>[] = [ | ||
{ | ||
accessorKey: 'name.firstName', //access nested data with dot notation | ||
header: 'First Name', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'name.lastName', | ||
header: 'Last Name', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'address', //normal accessorKey | ||
header: 'Address', | ||
size: 200, | ||
}, | ||
{ | ||
accessorKey: 'city', | ||
header: 'City', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'state', | ||
header: 'State', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'name.firstName', //access nested data with dot notation | ||
header: 'First Name', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'name.lastName', | ||
header: 'Last Name', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'address', //normal accessorKey | ||
header: 'Address', | ||
size: 200, | ||
}, | ||
{ | ||
accessorKey: 'city', | ||
header: 'City', | ||
size: 150, | ||
}, | ||
{ | ||
accessorKey: 'state', | ||
header: 'State', | ||
size: 150, | ||
}, | ||
]; | ||
|
||
|
||
export const FullscreenIsAboveAppbar = () => { | ||
const table = useMaterialReactTable({ | ||
columns, | ||
data, //data must be memoized or stable (useState, useMemo, defined outside of this component, etc.) | ||
}); | ||
|
||
|
||
const table = useMaterialReactTable({ | ||
columns, | ||
data, //data must be memoized or stable (useState, useMemo, defined outside of this component, etc.) | ||
}); | ||
|
||
return <> | ||
<CssBaseline /> | ||
<AppBar position="sticky"> | ||
<Toolbar> | ||
<p>App</p> | ||
</Toolbar> | ||
</AppBar> | ||
<Box padding={2}> | ||
<MaterialReactTable table={table} /> | ||
</Box> | ||
</>; | ||
return ( | ||
<> | ||
<CssBaseline /> | ||
<AppBar position="sticky"> | ||
<Toolbar> | ||
<p>App</p> | ||
</Toolbar> | ||
</AppBar> | ||
<Box padding={2}> | ||
<MaterialReactTable table={table} /> | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|