Merge pull request #145 from mirumee/fix/table-minor-bugs
Fix minor table bugs
This commit is contained in:
commit
9f13c20d29
5 changed files with 17 additions and 54 deletions
|
@ -36,7 +36,7 @@ const styles = (theme: Theme) =>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
colName: {
|
colName: {
|
||||||
paddingLeft: "0 !important"
|
paddingLeft: 0
|
||||||
},
|
},
|
||||||
colProducts: {
|
colProducts: {
|
||||||
textAlign: "center"
|
textAlign: "center"
|
||||||
|
|
|
@ -62,10 +62,10 @@ const ColumnPicker: React.FC<ColumnPickerProps> = props => {
|
||||||
setTimeout(() => setExpansionState(initialOpen), 100);
|
setTimeout(() => setExpansionState(initialOpen), 100);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleCancel = React.useCallback(() => {
|
const handleCancel = () => {
|
||||||
setExpansionState(false);
|
setExpansionState(false);
|
||||||
setSelectedColumns(columns.map(column => column.value));
|
setSelectedColumns(initialColumns);
|
||||||
}, [columns]);
|
};
|
||||||
|
|
||||||
const handleColumnToggle = (column: string) =>
|
const handleColumnToggle = (column: string) =>
|
||||||
setSelectedColumns(toggle(column, selectedColumns, (a, b) => a === b));
|
setSelectedColumns(toggle(column, selectedColumns, (a, b) => a === b));
|
||||||
|
|
|
@ -40,6 +40,9 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
boxShadow: `0px 0px 0px 0px ${theme.palette.background.paper}`,
|
boxShadow: `0px 0px 0px 0px ${theme.palette.background.paper}`,
|
||||||
transition: theme.transitions.duration.short + "ms"
|
transition: theme.transitions.duration.short + "ms"
|
||||||
},
|
},
|
||||||
|
cancelButton: {
|
||||||
|
marginRight: theme.spacing.unit * 2
|
||||||
|
},
|
||||||
content: {
|
content: {
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridColumnGap: theme.spacing.unit * 3,
|
gridColumnGap: theme.spacing.unit * 3,
|
||||||
|
@ -164,7 +167,11 @@ const ColumnPickerContent: React.FC<ColumnPickerContentProps> = props => {
|
||||||
<FormattedMessage defaultMessage="Reset" description="button" />
|
<FormattedMessage defaultMessage="Reset" description="button" />
|
||||||
</Button>
|
</Button>
|
||||||
<div>
|
<div>
|
||||||
<Button color="default" onClick={onCancel}>
|
<Button
|
||||||
|
className={classes.cancelButton}
|
||||||
|
color="default"
|
||||||
|
onClick={onCancel}
|
||||||
|
>
|
||||||
<FormattedMessage {...buttonMessages.cancel} />
|
<FormattedMessage {...buttonMessages.cancel} />
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="primary" variant="contained" onClick={onSave}>
|
<Button color="primary" variant="contained" onClick={onSave}>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Table from "@material-ui/core/Table";
|
||||||
import TableBody from "@material-ui/core/TableBody";
|
import TableBody from "@material-ui/core/TableBody";
|
||||||
import TableCell from "@material-ui/core/TableCell";
|
import TableCell from "@material-ui/core/TableCell";
|
||||||
import TableFooter from "@material-ui/core/TableFooter";
|
import TableFooter from "@material-ui/core/TableFooter";
|
||||||
|
import TableHead from "@material-ui/core/TableHead";
|
||||||
import TableRow from "@material-ui/core/TableRow";
|
import TableRow from "@material-ui/core/TableRow";
|
||||||
import EditIcon from "@material-ui/icons/Edit";
|
import EditIcon from "@material-ui/icons/Edit";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
@ -16,7 +17,6 @@ import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
import StatusLabel from "@saleor/components/StatusLabel";
|
import StatusLabel from "@saleor/components/StatusLabel";
|
||||||
import TableHead from "@saleor/components/TableHead";
|
|
||||||
import TablePagination from "@saleor/components/TablePagination";
|
import TablePagination from "@saleor/components/TablePagination";
|
||||||
import { translateBoolean } from "@saleor/intl";
|
import { translateBoolean } from "@saleor/intl";
|
||||||
import { maybe, renderCollection } from "@saleor/misc";
|
import { maybe, renderCollection } from "@saleor/misc";
|
||||||
|
@ -65,11 +65,7 @@ const PluginList = withStyles(styles, { name: "PluginList" })(
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<Table>
|
<Table>
|
||||||
<TableHead
|
<TableHead>
|
||||||
colSpan={numberOfColumns}
|
|
||||||
disabled={disabled}
|
|
||||||
items={plugins}
|
|
||||||
>
|
|
||||||
<TableCell className={classes.colName} padding="dense">
|
<TableCell className={classes.colName} padding="dense">
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
defaultMessage: "Name",
|
defaultMessage: "Name",
|
||||||
|
|
|
@ -75088,25 +75088,7 @@ exports[`Storyshots Views / Plugins / Plugin list default 1`] = `
|
||||||
<thead
|
<thead
|
||||||
class="MuiTableHead-root-id"
|
class="MuiTableHead-root-id"
|
||||||
>
|
>
|
||||||
<tr
|
<tr>
|
||||||
class="MuiTableRow-root-id MuiTableRow-head-id"
|
|
||||||
>
|
|
||||||
<th
|
|
||||||
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingCheckbox-id"
|
|
||||||
scope="col"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
|
||||||
tabindex="0"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
class="Checkbox-box-id Checkbox-checked-id"
|
|
||||||
type="checkbox"
|
|
||||||
value="true"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</th>
|
|
||||||
<th
|
<th
|
||||||
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
||||||
scope="col"
|
scope="col"
|
||||||
|
@ -75364,27 +75346,7 @@ exports[`Storyshots Views / Plugins / Plugin list loading 1`] = `
|
||||||
<thead
|
<thead
|
||||||
class="MuiTableHead-root-id"
|
class="MuiTableHead-root-id"
|
||||||
>
|
>
|
||||||
<tr
|
<tr>
|
||||||
class="MuiTableRow-root-id MuiTableRow-head-id"
|
|
||||||
>
|
|
||||||
<th
|
|
||||||
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingCheckbox-id"
|
|
||||||
scope="col"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="MuiButtonBase-root-id MuiButtonBase-disabled-id Checkbox-root-id"
|
|
||||||
disabled=""
|
|
||||||
tabindex="-1"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
class="Checkbox-box-id Checkbox-checked-id Checkbox-disabled-id"
|
|
||||||
disabled=""
|
|
||||||
type="checkbox"
|
|
||||||
value="true"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</th>
|
|
||||||
<th
|
<th
|
||||||
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
||||||
scope="col"
|
scope="col"
|
||||||
|
@ -75608,9 +75570,7 @@ exports[`Storyshots Views / Plugins / Plugin list no data 1`] = `
|
||||||
<thead
|
<thead
|
||||||
class="MuiTableHead-root-id"
|
class="MuiTableHead-root-id"
|
||||||
>
|
>
|
||||||
<tr
|
<tr>
|
||||||
class="MuiTableRow-root-id MuiTableRow-head-id"
|
|
||||||
>
|
|
||||||
<th
|
<th
|
||||||
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
class="MuiTableCell-root-id MuiTableCell-head-id MuiTableCell-paddingDense-id PluginList-colName-id"
|
||||||
scope="col"
|
scope="col"
|
||||||
|
|
Loading…
Reference in a new issue