-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
01419ea
commit 08627a5
Showing
10 changed files
with
211 additions
and
21 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
61 changes: 61 additions & 0 deletions
61
apps/material-react-table-docs/example-groups/FilteringExamples.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,61 @@ | ||
import { useRouter } from 'next/router'; | ||
import { Box, Tab, Tabs } from '@mui/material'; | ||
import FilterVariantsExample from '../examples/customize-filter-variants'; | ||
import FacetedValuesExample from '../examples/enable-filter-facet-values'; | ||
import FilterModesExample from '../examples/customize-filter-modes'; | ||
import { useState } from 'react'; | ||
import Link from 'next/link'; | ||
import LaunchIcon from '@mui/icons-material/Launch'; | ||
|
||
const FilteringExamples = ({ isPage = false }) => { | ||
const { pathname, push } = useRouter(); | ||
const [activeTab, setActiveTab] = useState( | ||
isPage ? pathname.split('/').pop() : 'export-csv', | ||
); | ||
|
||
return ( | ||
<> | ||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||
<Tabs | ||
value={isPage ? pathname.split('/').pop() : activeTab} | ||
onChange={(_e, newPath) => | ||
isPage && newPath !== 'more' | ||
? push(newPath as string) | ||
: setActiveTab(newPath as string) | ||
} | ||
> | ||
<Tab label="Filter Variants" value="filter-variants" /> | ||
<Tab label="Faceted Values" value="faceted-values" /> | ||
<Tab label="Filter Switching" value="filter-switching" /> | ||
<Tab | ||
label={ | ||
<Box> | ||
Server-Side Filtering | ||
<LaunchIcon sx={{ fontSize: '1rem' }} /> | ||
</Box> | ||
} | ||
value="react-query" | ||
/> | ||
<Link href="/docs/examples" passHref legacyBehavior> | ||
<Tab | ||
label={ | ||
<Box> | ||
More Examples | ||
<LaunchIcon sx={{ fontSize: '1rem' }} /> | ||
</Box> | ||
} | ||
value="more" | ||
/> | ||
</Link> | ||
</Tabs> | ||
</Box> | ||
<Box> | ||
{activeTab === 'filter-variants' && <FilterVariantsExample />} | ||
{activeTab === 'faceted-values' && <FacetedValuesExample />} | ||
{activeTab === 'filter-switching' && <FilterModesExample />} | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|
||
export default FilteringExamples; |
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
26 changes: 26 additions & 0 deletions
26
apps/material-react-table-docs/pages/docs/examples/faceted-values.mdx
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,26 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/FilteringExamples'; | ||
|
||
<Head> | ||
<title>{'Faceted Values Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of Material React Table which shows how to use faceted values to automatically populate filter suggestions." | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Faceted Values Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="An example of Material React Table which shows how to use faceted values to automatically populate filter suggestions." | ||
/> | ||
</Head> | ||
|
||
## Faceted Values Example | ||
|
||
Material React Table can scan your data and automatically generate filter autocomplete suggestions, filter select options, or min and max values for your column filters. This is made possible by the faceted values feature from TanStack Table. Learn more in the full [Column Filtering Feature Guide](/docs/guides/column-filtering). | ||
|
||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/prop-playground--default)** |
26 changes: 26 additions & 0 deletions
26
apps/material-react-table-docs/pages/docs/examples/filter-switching.mdx
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,26 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/FilteringExamples'; | ||
|
||
<Head> | ||
<title>{'Faceted Switching Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of Material React Table which shows how to let the user switch between multiple filtering modes." | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Faceted Values Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="An example of Material React Table which shows how to let the user switch between multiple filtering modes." | ||
/> | ||
</Head> | ||
|
||
## Faceted Switching Example | ||
|
||
Material React Table supports letting users switch between multiple filter modes. Learn more in the full [Column Filtering Feature Guide](/docs/guides/column-filtering). | ||
|
||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/prop-playground--default)** |
26 changes: 26 additions & 0 deletions
26
apps/material-react-table-docs/pages/docs/examples/filter-variants.mdx
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,26 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/FilteringExamples'; | ||
|
||
<Head> | ||
<title>{'Filter Variants Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of Material React Table which shows all of the powerful built-in filter variants." | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Filter Variants Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="An example of Material React Table which shows all of the powerful built-in filter variants." | ||
/> | ||
</Head> | ||
|
||
## Filter Variants Example | ||
|
||
Material React Table has not only has filtering built-in, but it has a lot of different filter variants that take care of a lot of the heavy lifting for you. Text filters, date filters, range filters, range slider filters, and more are all built-in and ready to use. There is a ton more you can do to customize the behavior of filtering, so be sure to check out the full [Column Filtering Feature Guide](/docs/guides/column-filtering) for more information. | ||
|
||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/prop-playground--default)** |