This repository has been archived by the owner on Feb 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
220 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -30,6 +30,7 @@ yarn-error.log* | |
|
||
# vercel | ||
.vercel | ||
.turbo | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
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,31 @@ | ||
"use client"; | ||
|
||
import { Maximize, Minimize } from "lucide-react"; | ||
import { Hint } from "../hint"; | ||
|
||
interface FullscreenControlProps { | ||
isFullscreen: boolean; | ||
onToggle: () => void; | ||
} | ||
|
||
export const FullscreenControl = ({ | ||
isFullscreen, | ||
onToggle, | ||
}: FullscreenControlProps) => { | ||
const Icon = isFullscreen ? Minimize : Maximize; | ||
|
||
const label = isFullscreen ? "Exit fullscreen" : "Enter fullscreen"; | ||
|
||
return ( | ||
<div className="flex items-center justify-center gap-4"> | ||
<Hint label={label} asChild> | ||
<button | ||
onClick={onToggle} | ||
className="text-white p-1.5 hover:bg-white/10 rounded-lg" | ||
> | ||
<Icon className="h-5 w-5" /> | ||
</button> | ||
</Hint> | ||
</div> | ||
); | ||
}; |
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,55 @@ | ||
"use client"; | ||
|
||
import { Volume1, Volume2, VolumeX } from "lucide-react"; | ||
|
||
import { Hint } from "@/components/hint"; | ||
import { Slider } from "@/components/ui/slider"; | ||
|
||
interface VolumeControlProps { | ||
onToggle: () => void; | ||
onChange: (value: number) => void; | ||
value: number; | ||
} | ||
|
||
export const VolumeControl = ({ | ||
onToggle, | ||
onChange, | ||
value, | ||
}: VolumeControlProps) => { | ||
const isMuted = value === 0; | ||
const isAboveHalf = value > 50; | ||
|
||
let Icon = Volume1; | ||
|
||
if (isMuted) { | ||
Icon = VolumeX; | ||
} else if (isAboveHalf) { | ||
Icon = Volume2; | ||
} | ||
|
||
const label = isMuted ? "Unmute" : "Mute"; | ||
|
||
const handleChange = (value: number[]) => { | ||
onChange(value[0]); | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center gap-2"> | ||
<Hint label={label} asChild> | ||
<button | ||
onClick={onToggle} | ||
className="text-white hover:bg-white/10 p-1.5 rounded-lg" | ||
> | ||
<Icon className="h-6 w-6" /> | ||
</button> | ||
</Hint> | ||
<Slider | ||
className="w-[8rem] cursor-pointer" | ||
onValueChange={handleChange} | ||
value={[value]} | ||
max={100} | ||
step={1} | ||
/> | ||
</div> | ||
); | ||
}; |
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,28 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import * as SliderPrimitive from "@radix-ui/react-slider"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
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="relative h-0.5 w-full grow overflow-hidden rounded-full bg-white/10"> | ||
<SliderPrimitive.Range className="absolute h-full bg-primary" /> | ||
</SliderPrimitive.Track> | ||
<SliderPrimitive.Thumb className="block h-3.5 w-3.5 rounded-full border-2 border-primary bg-white ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" /> | ||
</SliderPrimitive.Root> | ||
)); | ||
Slider.displayName = SliderPrimitive.Root.displayName; | ||
|
||
export { Slider }; |
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