Skip to content

Commit

Permalink
Update icon size based on breakpoints instead of js media queries
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Apr 17, 2024
1 parent cf52398 commit d8719ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions ui/src/components/Player/DetectionCategoryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, useMediaQuery, useTheme } from "@mui/material";
import { Box } from "@mui/material";
import type { StaticImageData } from "next/legacy/image";
import Image from "next/legacy/image";

Expand All @@ -9,8 +9,6 @@ export default function DetectionCategoryButton({
icon: StaticImageData;
title: string;
}) {
const theme = useTheme();
const isDesktop = useMediaQuery(theme.breakpoints.up("sm"));
return (
<Box
sx={{
Expand All @@ -19,12 +17,12 @@ export default function DetectionCategoryButton({
alignItems: "center",
}}
>
<Image
src={icon.src}
alt={`${title} icon`}
width={isDesktop ? 100 : 20}
height={isDesktop ? 100 : 20}
/>
<Box sx={{ display: { xs: "block", sm: "none" } }}>
<Image src={icon.src} alt={`${title} icon`} width={20} height={20} />
</Box>
<Box sx={{ display: { xs: "none", sm: "block" } }}>
<Image src={icon.src} alt={`${title} icon`} width={100} height={100} />
</Box>
{title}
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Player/DetectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function DetectionDialog({
component={Paper}
sx={{
"&&&": {
marginX: [1, 5],
marginX: [1, 2],
marginY: [1, 0],
borderRadius: 1,
overflow: "visible",
Expand Down

0 comments on commit d8719ac

Please sign in to comment.