Skip to content

Commit 514cf0e

Browse files
committed
Fix some eslint errors; animate button
1 parent 820f73b commit 514cf0e

13 files changed

Lines changed: 673 additions & 655 deletions

File tree

src/components/BottomControls/BottomControls.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,26 @@ export const BottomControls = () => {
6060
<Stack gap={1} direction="row" sx={{ alignItems: "center" }}>
6161
<Box
6262
sx={{
63-
backgroundImage: "conic-gradient(#ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c1, #ff0000)",
63+
"@keyframes rotate": {
64+
from: { "--angle": "0deg" },
65+
to: { "--angle": "360deg" },
66+
},
67+
"--angle": "0deg",
68+
backgroundImage:
69+
"conic-gradient(from var(--angle), #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c1, #ff0000)",
70+
transition: "all 0.5s",
6471
borderRadius: 1,
6572
p: "1px",
73+
"&:has(button:hover), &:has(button:focus)": {
74+
animation: "rotate 1.6s linear infinite",
75+
},
6676
}}
6777
>
68-
<Button variant="contained" onClick={() => setThemeOptions(generateTheme())} sx={SHARED_BUTTON_STYLES}>
78+
<Button
79+
variant="contained"
80+
onClick={() => setThemeOptions(generateTheme())}
81+
sx={{ ...SHARED_BUTTON_STYLES, outlineOffset: "1px" }}
82+
>
6983
Randomize!
7084
</Button>
7185
</Box>

src/components/ColourPicker/ColorPicker.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import { FieldContainer, type FieldContainerProps } from "../FieldContainer/Fiel
66

77
interface ColorPickerProps extends FieldContainerProps {
88
value: string;
9+
name: string;
910
onChange: (hex: string) => void;
1011
}
1112

12-
export const ColorPicker = ({ value, onChange, ...fieldContainerProps }: ColorPickerProps) => {
13+
export const ColorPicker = ({ value, onChange, name, ...fieldContainerProps }: ColorPickerProps) => {
1314
const inputRef = useRef<HTMLInputElement>(null);
14-
15-
const popverId = Math.random().toString();
16-
1715
const handleNewInputValue = (inputValue: string) => {
1816
const newValue = toStandardHex(inputValue, value);
1917
if (newValue === value) return;
@@ -34,7 +32,7 @@ export const ColorPicker = ({ value, onChange, ...fieldContainerProps }: ColorPi
3432
<FieldContainer {...fieldContainerProps}>
3533
<Box
3634
component="button"
37-
popoverTarget={popverId}
35+
popoverTarget={name}
3836
sx={{
3937
border: 1,
4038
borderInlineEnd: 0,
@@ -60,7 +58,7 @@ export const ColorPicker = ({ value, onChange, ...fieldContainerProps }: ColorPi
6058
}}
6159
/>
6260
<Box
63-
id={popverId}
61+
id={name}
6462
popover="auto"
6563
sx={{
6664
insetInlineEnd: "anchor(start)",
@@ -81,6 +79,7 @@ export const ColorPicker = ({ value, onChange, ...fieldContainerProps }: ColorPi
8179
</Box>
8280
<Box
8381
component="input"
82+
name={name}
8483
ref={inputRef}
8584
key={value}
8685
sx={{

src/components/MockApp/MockApp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ import {
4848
type ChipProps,
4949
} from "@mui/material";
5050
import { useState } from "react";
51-
import { FAKE_DATA_1, FAKE_DATA_2, FAKE_DATA_3, Sparkline } from "../Sparkline/Sparkline";
51+
import { Sparkline } from "../Sparkline/Sparkline";
52+
import { FAKE_DATA_1, FAKE_DATA_2, FAKE_DATA_3 } from "./mockData";
5253

5354
// Remove these styled components when MUI fixes table border colors
5455
// https://github.com/mui/material-ui/issues/47749

0 commit comments

Comments
 (0)