Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update pagination component

dominik-zeglenc7113607f364
diff --git a/saleor/static/dashboard-next/components/TablePagination/TablePaginationActions.tsx b/saleor/static/dashboard-next/components/TablePagination/TablePaginationActions.tsx
index d4c9d38b74..09c29b863c 100644
--- a/saleor/static/dashboard-next/components/TablePagination/TablePaginationActions.tsx
+++ b/saleor/static/dashboard-next/components/TablePagination/TablePaginationActions.tsx
@@ -1,17 +1,50 @@
import IconButton from "@material-ui/core/IconButton";
-import KeyboardArrowLeft from "@material-ui/core/internal/svg-icons/KeyboardArrowLeft";
-import KeyboardArrowRight from "@material-ui/core/internal/svg-icons/KeyboardArrowRight";
import {
createStyles,
Theme,
withStyles,
WithStyles
} from "@material-ui/core/styles";
+import { fade } from "@material-ui/core/styles/colorManipulator";
+import ArrowLeft from "@material-ui/icons/ArrowLeft";
+import ArrowRight from "@material-ui/icons/ArrowRight";
import * as classNames from "classnames";
import * as React from "react";
+import useTheme from "../../hooks/useTheme";
const styles = (theme: Theme) =>
createStyles({
+ dark: {
+ "& > span:first-of-type": {
+ backgroundColor: theme.palette.background.default
+ },
+ "&$disabled": {
+ "& svg": {
+ color: fade(theme.palette.primary.main, 0.2)
+ }
+ },
+ "& svg": {
+ color: theme.palette.primary.main
+ },
+ "&:focus, &:hover": {
+ "& > span:first-of-type": {
+ backgroundColor: fade(theme.palette.primary.main, 0.2)
+ }
+ }
+ },
+ disabled: {},
+ iconButton: {
+ "& > span:first-of-type": {
+ backgroundColor: fade(theme.palette.primary.main, 0.12),
+ borderRadius: "100%"
+ },
+ "&:focus, &:hover": {
+ "& > span:first-of-type": {
+ backgroundColor: fade(theme.palette.primary.main, 0.2)
+ },
+ backgroundColor: "transparent"
+ }
+ },
root: {
color: theme.palette.text.secondary,
flexShrink: 0,
@@ -46,32 +79,35 @@ export const TablePaginationActions = withStyles(styles, {
onPreviousPage,
theme,
...other
- }: TablePaginationActionsProps) => (
- <div className={classNames(classes.root, className)} {...other}>
- <IconButton
- onClick={onPreviousPage}
- disabled={!hasPreviousPage}
- {...backIconButtonProps}
- >
- {theme.direction === "rtl" ? (
- <KeyboardArrowRight />
- ) : (
- <KeyboardArrowLeft />
- )}
- </IconButton>
- <IconButton
- onClick={onNextPage}
- disabled={!hasNextPage}
- {...nextIconButtonProps}
- >
- {theme.direction === "rtl" ? (
- <KeyboardArrowLeft />
- ) : (
- <KeyboardArrowRight />
- )}
- </IconButton>
- </div>
- )
+ }: TablePaginationActionsProps) => {
+ const { isDark } = useTheme();
+ return (
+ <div className={classNames(classes.root, className)} {...other}>
+ <IconButton
+ className={classNames(classes.iconButton, {
+ [classes.dark]: isDark,
+ [classes.disabled]: !hasPreviousPage
+ })}
+ onClick={onPreviousPage}
+ disabled={!hasPreviousPage}
+ {...backIconButtonProps}
+ >
+ {theme.direction === "rtl" ? <ArrowRight /> : <ArrowLeft />}
+ </IconButton>
+ <IconButton
+ className={classNames(classes.iconButton, {
+ [classes.dark]: isDark,
+ [classes.disabled]: !hasNextPage
+ })}
+ onClick={onNextPage}
+ disabled={!hasNextPage}
+ {...nextIconButtonProps}
+ >
+ {theme.direction === "rtl" ? <ArrowLeft /> : <ArrowRight />}
+ </IconButton>
+ </div>
+ );
+ }
);
TablePaginationActions.displayName = "TablePaginationActions";
diff --git a/saleor/static/dashboard-next/components/Timeline/Timeline.tsx b/saleor/static/dashboard-next/components/Timeline/Timeline.tsx
index 89ef388c36..dca538e926 100644
--- a/saleor/static/dashboard-next/components/Timeline/Timeline.tsx
+++ b/saleor/static/dashboard-next/components/Timeline/Timeline.tsx
@@ -45,7 +45,7 @@ const styles = (theme: Theme) =>
display: "flex"
},
root: {
- borderColor: grey[300],
+ borderColor: theme.typography.caption.color,
borderStyle: "solid",
borderWidth: "0 0 0 2px",
marginLeft: theme.spacing.unit * 5.5,
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index e47c21b004..a84bcad381 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -52,6 +52,7 @@ export default (colors: IThemeColors): Theme =>
flexDirection: "row-reverse" as "row-reverse"
}
},
+
MuiInput: {
input: {
"&:-webkit-autofill": {
@@ -67,6 +68,13 @@ export default (colors: IThemeColors): Theme =>
}
}
},
+ MuiInputBase: {
+ input: {
+ "&::placeholder": {
+ color: colors.font.gray
+ }
+ }
+ },
MuiInputLabel: {
formControl: {
transform: "translate(0, 1.5px) scale(0.75)",