-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporary scroll solution for too many settings Closes #1
- Loading branch information
Showing
11 changed files
with
212 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { ChevronDown, Check } from "lucide-react"; | ||
import { ReactElement } from "react"; | ||
import { | ||
Select, | ||
Label, | ||
Button, | ||
SelectValue, | ||
Popover, | ||
ListBox, | ||
ListBoxItem, | ||
} from "react-aria-components"; | ||
|
||
export interface GlassSelectProps { | ||
name: string; | ||
defaultSelectedKey: string; | ||
label: string; | ||
items: [string, string][]; | ||
} | ||
|
||
export default function GlassSelect({ | ||
name, | ||
defaultSelectedKey, | ||
label, | ||
items, | ||
}: GlassSelectProps): ReactElement { | ||
return ( | ||
<Select | ||
name={name} | ||
className="flex flex-col items-start" | ||
defaultSelectedKey={defaultSelectedKey} | ||
> | ||
<Label className="px-3 text-sm">{label}</Label> | ||
|
||
{/* Select Button */} | ||
<Button className="glass-tube-container h-8 w-48 text-nowrap pe-9 ps-3 text-start transition-colors hover:bg-blue-500/20"> | ||
<SelectValue className="block w-full overflow-hidden overflow-ellipsis" /> | ||
{/* Down arrow. Flips over on open */} | ||
<ChevronDown className="absolute end-3 top-1/2 -translate-y-1/2 stroke-1 transition-transform group-open/select:rotate-180" /> | ||
</Button> | ||
|
||
{/* Dropdown */} | ||
<Popover> | ||
<ListBox | ||
items={items} | ||
className="glass-surface flex flex-col gap-1 rounded-md bg-slate-50/20 p-2" | ||
> | ||
{(item) => ( | ||
<ListBoxItem | ||
key={item[0]} | ||
id={item[0]} | ||
textValue={item[1]} | ||
className="group/item relative flex h-8 cursor-pointer select-none items-center gap-1 ps-7 focus:outline-none" | ||
> | ||
{/* Blurred background on focus */} | ||
<div | ||
aria-hidden | ||
className="pointer-events-none absolute inset-0 -z-10 bg-gradient-to-r from-blue-500/30 opacity-0 blur transition duration-200 group-focus/item:opacity-100" | ||
></div> | ||
|
||
{/* Checkmark */} | ||
<Check | ||
aria-hidden | ||
className="invisible absolute left-0 top-1/2 shrink-0 -translate-y-1/2 stroke-1 group-selected/item:visible" | ||
/> | ||
|
||
{/* Label */} | ||
<span>{item[1]}</span> | ||
</ListBoxItem> | ||
)} | ||
</ListBox> | ||
</Popover> | ||
</Select> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Backtracker } from "./generating/Backtracking"; | ||
import { MazeGenerator } from "./generating/MazeGenerator"; | ||
import { Prims } from "./generating/Prims"; | ||
import { Wilsons } from "./generating/Wilsons"; | ||
import { BFS } from "./solving/BFS"; | ||
import { MazeSolver } from "./solving/MazeSolver"; | ||
import { Tremaux } from "./solving/Tremaux"; | ||
|
||
export { Backtracker, BFS, MazeGenerator, MazeSolver, Prims, Tremaux, Wilsons }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export const GENERATION_ALGORITHMS = [ | ||
"random", | ||
"wilsons", | ||
"backtracker", | ||
"prims", | ||
] as const; | ||
export type GenerationAlgorithm = (typeof GENERATION_ALGORITHMS)[number]; | ||
export const SOLVE_ALGORITHMS = ["random", "bfs", "tremaux"] as const; | ||
export type SolveAlgorithm = (typeof SOLVE_ALGORITHMS)[number]; | ||
export type MazeEvent = "generate" | "solve"; | ||
|
||
export interface MazeDimensions { | ||
rows: number; | ||
cols: number; | ||
/** | ||
* Width of cell vs wall. | ||
* | ||
* E.g., 0.5 means a cell is half the width of a wall. | ||
*/ | ||
cellWallRatio: number; | ||
} | ||
|
||
export interface MazeSettings { | ||
dimensions: MazeDimensions; | ||
generationAlgorithm: GenerationAlgorithm; | ||
doAnimateGenerating: boolean; | ||
solveAlgorithm: SolveAlgorithm; | ||
doAnimateSolving: boolean; | ||
} |