Skip to content

Commit

Permalink
feat: add fade in hover circle
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed May 27, 2024
1 parent 49a07cd commit 6d35b40
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 199 deletions.
2 changes: 1 addition & 1 deletion ui/summit-2024/src/__fixtures__/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ const nomineesData: NomineeArrayFixture[] = [
},
// Add more nominees as needed
],
}
},
];

export { CategoriesNames, nomineesData };
Expand Down
118 changes: 62 additions & 56 deletions ui/summit-2024/src/components/common/HoverCircle/HoverCircle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Box } from "@mui/material";
import { Box, Fade } from "@mui/material";
import CheckIcon from "@mui/icons-material/Check";
import theme from "../../../common/styles/theme";

Expand All @@ -20,67 +20,73 @@ const HoverCircle = ({ selected }) => {
>
{!selected ? (
<>
<Box
sx={{
position: "absolute",
width: 48,
height: 48,
backgroundColor: theme.palette.background.darker,
borderRadius: "50%",
opacity: hover ? 1 : 0,
transition: "opacity 0.3s",
}}
/>
<Box
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
sx={{
position: "absolute",
zIndex: 1,
width: "28px",
height: "28px",
border: `1px solid ${theme.palette.text.neutralLight}`,
borderRadius: "50%",
alignItems: "center",
justifyContent: "center",
}}
/>
<Box
sx={{
position: "absolute",
width: 48,
height: 48,
backgroundColor: theme.palette.background.darker,
borderRadius: "50%",
opacity: hover ? 1 : 0,
transition: "opacity 0.3s",
}}
/>
<Box
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
sx={{
position: "absolute",
zIndex: 1,
width: "28px",
height: "28px",
border: `1px solid ${theme.palette.text.neutralLight}`,
borderRadius: "50%",
alignItems: "center",
justifyContent: "center",
}}
/>

</>
) : (
<>
<Box
sx={{
position: "absolute",
width: 48,
height: 48,
backgroundColor: theme.palette.background.darker,
borderRadius: "50%",
opacity: hover ? 1 : 0,
transition: "opacity 0.3s",
}}
/>
<Box
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
sx={{
position: "absolute",
zIndex: 1,
width: "28px",
height: "28px",
backgroundColor: theme.palette.secondary.main,
borderRadius: "50%",
alignItems: "center",
justifyContent: "center",
}}
>
<CheckIcon
<Fade in={selected} timeout={400}>
<Box
sx={{
color: theme.palette.primary.main,
width: 20,
margin: "3px 4px",
position: "absolute",
width: 48,
height: 48,
backgroundColor: theme.palette.background.darker,
borderRadius: "50%",
opacity: hover ? 1 : 0,
transition: "opacity 0.3s",
}}
/>
</Box>
</Fade>

<Fade in={selected} timeout={400}>
<Box
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
sx={{
position: "absolute",
zIndex: 1,
width: "28px",
height: "28px",
backgroundColor: theme.palette.secondary.main,
borderRadius: "50%",
alignItems: "center",
justifyContent: "center",
}}
>
<CheckIcon
sx={{
color: theme.palette.primary.main,
width: 20,
margin: "3px 4px",
}}
/>
</Box>
</Fade>
</>
)}
</Box>
Expand Down
Loading

0 comments on commit 6d35b40

Please sign in to comment.