Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57b1f68

Browse files
committed
emotion: PageButton
1 parent 2b49f62 commit 57b1f68

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed
Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Button from "@mui/material/Button";
2-
import { makeStyles } from "@mui/styles";
2+
import { css, useTheme } from "@emotion/react";
33

44
interface PageButtonProps {
55
activePage?: number;
@@ -18,14 +18,20 @@ export const PageButton = ({
1818
onPageClick,
1919
disabled = false,
2020
}: PageButtonProps): JSX.Element => {
21-
const styles = useStyles();
21+
const theme = useTheme();
2222
return (
2323
<Button
24-
className={
25-
activePage === page
26-
? `${styles.pageButton} ${styles.activePageButton}`
27-
: styles.pageButton
28-
}
24+
css={[
25+
css`
26+
&:not(:last-of-type) {
27+
margin-right: ${theme.spacing(0.5)};
28+
}
29+
`,
30+
activePage === page && {
31+
borderColor: `${theme.palette.info.main}`,
32+
backgroundColor: `${theme.palette.info.dark}`,
33+
},
34+
]}
2935
aria-label={`${page === activePage ? "Current Page" : ""} ${
3036
page === numPages ? "Last Page" : ""
3137
} Page${page}`}
@@ -37,16 +43,3 @@ export const PageButton = ({
3743
</Button>
3844
);
3945
};
40-
41-
const useStyles = makeStyles((theme) => ({
42-
pageButton: {
43-
"&:not(:last-of-type)": {
44-
marginRight: theme.spacing(0.5),
45-
},
46-
},
47-
48-
activePageButton: {
49-
borderColor: `${theme.palette.info.main}`,
50-
backgroundColor: `${theme.palette.info.dark}`,
51-
},
52-
}));

0 commit comments

Comments
 (0)