-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- new file: src/Components/PatchedPagination.js - 참고 링크 : mbrn/material-table#2937 (comment)
- Loading branch information
Showing
8 changed files
with
4,867 additions
and
4,728 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
File renamed without changes
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,45 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
/* eslint-disable react/display-name */ | ||
import React, { forwardRef } from 'react'; | ||
|
||
import AddBox from '@material-ui/icons/AddBox'; | ||
import ArrowDownward from '@material-ui/icons/ArrowDownward'; | ||
import Check from '@material-ui/icons/Check'; | ||
import ChevronLeft from '@material-ui/icons/ChevronLeft'; | ||
import ChevronRight from '@material-ui/icons/ChevronRight'; | ||
import Clear from '@material-ui/icons/Clear'; | ||
import DeleteOutline from '@material-ui/icons/DeleteOutline'; | ||
import Edit from '@material-ui/icons/Edit'; | ||
import FilterList from '@material-ui/icons/FilterList'; | ||
import FirstPage from '@material-ui/icons/FirstPage'; | ||
import LastPage from '@material-ui/icons/LastPage'; | ||
import Remove from '@material-ui/icons/Remove'; | ||
import SaveAlt from '@material-ui/icons/SaveAlt'; | ||
import Search from '@material-ui/icons/Search'; | ||
import ViewColumn from '@material-ui/icons/ViewColumn'; | ||
|
||
const tableIcons = { | ||
Add: forwardRef((props, ref) => <AddBox {...props} ref={ref} />), | ||
Check: forwardRef((props, ref) => <Check {...props} ref={ref} />), | ||
Clear: forwardRef((props, ref) => <Clear {...props} ref={ref} />), | ||
Delete: forwardRef((props, ref) => <DeleteOutline {...props} ref={ref} />), | ||
DetailPanel: forwardRef((props, ref) => ( | ||
<ChevronRight {...props} ref={ref} /> | ||
)), | ||
Edit: forwardRef((props, ref) => <Edit {...props} ref={ref} />), | ||
Export: forwardRef((props, ref) => <SaveAlt {...props} ref={ref} />), | ||
Filter: forwardRef((props, ref) => <FilterList {...props} ref={ref} />), | ||
FirstPage: forwardRef((props, ref) => <FirstPage {...props} ref={ref} />), | ||
LastPage: forwardRef((props, ref) => <LastPage {...props} ref={ref} />), | ||
NextPage: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />), | ||
PreviousPage: forwardRef((props, ref) => ( | ||
<ChevronLeft {...props} ref={ref} /> | ||
)), | ||
ResetSearch: forwardRef((props, ref) => <Clear {...props} ref={ref} />), | ||
Search: forwardRef((props, ref) => <Search {...props} ref={ref} />), | ||
SortArrow: forwardRef((props, ref) => <ArrowDownward {...props} ref={ref} />), | ||
ThirdStateCheck: forwardRef((props, ref) => <Remove {...props} ref={ref} />), | ||
ViewColumn: forwardRef((props, ref) => <ViewColumn {...props} ref={ref} />), | ||
}; | ||
|
||
export default tableIcons; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable react/prop-types */ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import React from 'react'; | ||
import { TablePagination } from '@material-ui/core'; | ||
|
||
function PatchedPagination(props) { | ||
const { | ||
ActionsComponent, | ||
onChangePage, | ||
onChangeRowsPerPage, | ||
...tablePaginationProps | ||
} = props; | ||
|
||
return ( | ||
<TablePagination | ||
{...tablePaginationProps} | ||
// @ts-expect-error onChangePage was renamed to onPageChange | ||
onPageChange={onChangePage} | ||
onRowsPerPageChange={onChangeRowsPerPage} | ||
ActionsComponent={subprops => { | ||
const { onPageChange, ...actionsComponentProps } = subprops; | ||
return ( | ||
// @ts-expect-error ActionsComponent is provided by material-table | ||
<ActionsComponent | ||
{...actionsComponentProps} | ||
onChangePage={onPageChange} | ||
/> | ||
); | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
export default PatchedPagination; |
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,8 +1,43 @@ | ||
import React from 'react'; | ||
import MaterialTable from 'material-table'; | ||
import { useSelector } from 'react-redux'; | ||
import styled from 'styled-components/macro'; | ||
import tableIcons from '../Assets/tableIcons'; | ||
import PatchedPagination from '../Components/PatchedPagination'; | ||
|
||
const BeerList = () => { | ||
return <h1>Beer List</h1>; | ||
const beerList = useSelector(state => state.beerListReducer); | ||
console.log(beerList); | ||
|
||
return ( | ||
<div style={{ maxWidth: '100%' }}> | ||
<MaterialTable | ||
components={{ | ||
Pagination: PatchedPagination, | ||
}} | ||
columns={[ | ||
{ title: 'Adı', field: 'name' }, | ||
{ title: 'Soyadı', field: 'surname' }, | ||
{ title: 'Doğum Yılı', field: 'birthYear', type: 'numeric' }, | ||
{ | ||
title: 'Doğum Yeri', | ||
field: 'birthCity', | ||
lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' }, | ||
}, | ||
]} | ||
data={[ | ||
{ | ||
name: 'Mehmet', | ||
surname: 'Baran', | ||
birthYear: 1987, | ||
birthCity: 63, | ||
}, | ||
]} | ||
title="Demo Title" | ||
icons={tableIcons} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BeerList; |
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