import React from 'react';
import { Table, Pagination, ButtonGroup, Button, Switch } from '../../../index';
export default class RenderPagination extends React.Component {
constructor(props) {
super(props);
this.state = {
customPagination: true,
pagination: { ...props.pagination, pageSize: 8 },
};
this.renderPagination = pagination => {
return
}
this.switchPagination = position => {
let { pagination } = this.state;
const positions = ['bottom', 'top', 'both'];
if (position === true || position === false) {
pagination = position ? { ...pagination } : false;
} else if (positions.includes(position)) {
pagination = { ...pagination, position };
}
this.setState({ pagination });
};
this.toggleRenderPagination = checked => {
this.setState({ customPagination: checked });
}
this.TableSwitch = function TableSwitch({
text,
children,
checked,
onChange,
style = { display: 'inline-flex', alignItems: 'center', margin: 5 },
}) {
const switchProps = { onChange };
if (checked != null) {
switchProps.checked = !!checked;
}
return (
{text}
{children != null ? children : }
);
};
this.data = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
},
{
key: '4',
name: 'Disabled User',
age: 99,
address: 'Sidney No. 1 Lake Park',
},
{
key: '5',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
},
{
key: '6',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
},
{
key: '7',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
},
{
key: '8',
name: 'Disabled User',
age: 99,
address: 'Sidney No. 1 Lake Park',
},
{
key: '9',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
},
{
key: '10',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
},
{
key: '11',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
},
{
key: '12',
name: 'Disabled User',
age: 99,
address: 'Sidney No. 1 Lake Park',
},
];
}
render() {
const TableSwitch = this.TableSwitch;
const { customPagination, pagination } = this.state;
return (
);
}
}