Skip to content

Commit

Permalink
Minor CSS adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
philfreshman committed Apr 29, 2024
1 parent ac066e6 commit 75d7b10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/atoms/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { cn } from "@/lib/helpers/shadcn"
const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>>(
({ className, ...props }, ref) => (
<SliderPrimitive.Root ref={ref} className={cn("relative flex w-full touch-none select-none items-center ", className)} {...props}>
<SliderPrimitive.Track className="bg-[var(--glitch-rose) bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full">
<SliderPrimitive.Track className=" relative h-1.5 w-full grow overflow-hidden rounded-full bg-gray-200">
<SliderPrimitive.Range className="absolute h-full bg-[var(--glitch-rose)] dark:bg-[var(--glitch-green)]" />
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="border-primary/50 block h-4 w-4 rounded-full border bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
Expand Down
13 changes: 11 additions & 2 deletions src/components/nav-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { ui } from "@/lib/helpers/ui"
import { useContext } from "react"
import { SpeedMenu } from "./speed-menu"

interface RunMenuProps {
onReset?: () => void
}

export default function Index() {
const algorithmContext = useContext(AlgorithmContext)
if (!algorithmContext) throw new Error("AlgorithmContext is missing")
Expand Down Expand Up @@ -37,6 +41,11 @@ export default function Index() {
setMazeGenerationAlgorithm(key)
}

const onReset = () => {
console.log("onReset")
onMazeGenerationChange("CUSTOM")
}

return (
<Menubar>
<MenubarMenu>
Expand All @@ -54,7 +63,7 @@ export default function Index() {
<MenubarTrigger>Grid</MenubarTrigger>
<MenubarContent>
{Object.entries(mazeAlgorithms).map(([key, value]) => (
<MenubarCheckboxItem checked={mazeGenerationAlgorithm == key} key={key} onClick={() => onMazeGenerationChange(key)}>
<MenubarCheckboxItem checked={mazeGenerationAlgorithm === key} key={key} onClick={() => onMazeGenerationChange(key)}>
{value}
</MenubarCheckboxItem>
))}
Expand All @@ -63,7 +72,7 @@ export default function Index() {

<SpeedMenu />
<ThemeMenu />
<RunMenu />
<RunMenu onReset={onReset} />
</Menubar>
)
}
3 changes: 2 additions & 1 deletion src/components/nav-menu/run-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ui } from "@/lib/helpers/ui"
import { PauseIcon, PlayIcon } from "@radix-ui/react-icons"
import { useContext, useEffect } from "react"

export default function RunMenu() {
export default function RunMenu({ onReset }: { onReset: () => void }) {
const algorithmContext = useContext(AlgorithmContext)

if (!algorithmContext) throw new Error("AlgorithmContext is missing")
Expand All @@ -29,6 +29,7 @@ export default function RunMenu() {
setIsCompleted(true)
ui.clearVisitedAndWalls()
clearMatrixWalls()
onReset()
}

useEffect(() => {
Expand Down

0 comments on commit 75d7b10

Please sign in to comment.