Skip to content

Commit

Permalink
feat: new VideoPlayer component
Browse files Browse the repository at this point in the history
fix: util function naming
  • Loading branch information
AlkenD committed Aug 11, 2024
1 parent 0bb748c commit 87bd0df
Show file tree
Hide file tree
Showing 27 changed files with 789 additions and 49 deletions.
2 changes: 1 addition & 1 deletion dist/assets/index-M_zpHYxC.js
Original file line number Diff line number Diff line change
Expand Up @@ -45694,7 +45694,7 @@ const Jr = ({
!r &&
x.jsx("div", {
className:
"h-full my-auto w-[1px] bg-gradient-to-t from-transparent via-white/10 to-transparent mr-2",
"h-full my-auto w-px bg-gradient-to-t from-transparent via-white/10 to-transparent mr-2",
}),
x.jsx(
$e.div,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"preview": "vite preview"
},
"dependencies": {
"@floating-ui/react-dom": "^2.1.1",
"@headlessui/react": "^2.0.4",
"@heroicons/react": "^2.1.3",
"@million/lint": "1.0.0-rc.26",
Expand All @@ -24,6 +25,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^15.0.0",
"react-player": "^2.16.0",
"react-router-dom": "^6.23.1",
"styled-components": "^6.1.11",
"swiper": "^11.1.4",
Expand Down
63 changes: 59 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import "./index.css";
import SettingsPage from "./lib/pages/SettingsPage";
import axios from "axios";
import { APP_API_PATHS } from "./config/config";
import VideoPlayerPage from "./lib/pages/VideoPlayerPage";

const App = () => {
const router = createBrowserRouter([
Expand Down Expand Up @@ -44,6 +45,10 @@ const App = () => {
path: "library",
element: <LibraryPage />,
},
{
path: "video",
element: <VideoPlayerPage />,
},
{
path: "movie/:id",
element: <MovieInfoPage />,
Expand Down
7 changes: 7 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
float: left;
}

input[type="range"]::-webkit-slider-thumb {
appearance: none;
width: 1px;
height: 1px;
background-color: black;
}

@layer base {
body {
@apply bg-neutral-950 text-white overflow-hidden cursor-default;
Expand Down
85 changes: 55 additions & 30 deletions src/lib/components/actions/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import HeroIcon from "../ui/HeroIcon";
import { IconName } from "../../types";
import { forwardRef } from "react";

const iconButton = cva(
[
Expand Down Expand Up @@ -31,15 +32,29 @@ const iconButton = cva(
],
},
size: {
small: ["text-sm", "h-8", "!w-8", "stroke-[1.5px]"],
small: ["text-sm", "h-8", "!w-8", "stroke-[0.2px]"],
large: ["text-lg", "h-12", "!w-12", "stroke-[1px]"],
extraLarge: ["text-xl", "h-16", "!w-16", "stroke-[1px]"],
},
rounded: {
true: ["rounded-full"],
false: ["rounded-xl"],
true: "rounded-full",
},
active: {
true: "text-emerald-400",
},
},
compoundVariants: [
{
size: "large",
rounded: false,
className: "rounded-xl",
},
{
size: "small",
rounded: false,
className: "rounded-lg",
},
],
defaultVariants: {
variant: "primary",
size: "small",
Expand All @@ -53,35 +68,45 @@ export interface IconButtonProps
icon?: IconName;
iconType?: "solid" | "outline";
rounded?: boolean;
active?: boolean;
}

const IconButton: React.FC<IconButtonProps> = ({
className,
variant,
title,
size = "small",
icon,
iconType = "outline",
rounded = false,
...props
}) => (
<button
title={title}
className={iconButton({ variant, size, rounded, className })}
{...props}
>
{icon ? (
<div
className={`flex justify-center items-center aspect-square overflow-hidden p-1 ${
size === "small" ? "w-6 h-6" : "w-8 h-8"
}`}
>
<HeroIcon iconName={icon} type={iconType} />
</div>
) : (
""
)}
</button>
const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
(
{
className,
variant,
title,
size = "small",
icon,
iconType = "outline",
rounded = false,
disabled = false,
active = false,
...props
},
ref
) => (
<button
title={title}
className={iconButton({ variant, size, rounded, active, className })}
disabled={disabled}
ref={ref}
{...props}
>
{icon ? (
<div
className={`flex justify-center items-center aspect-square overflow-hidden p-1 ${
size === "small" ? "w-6 h-6" : "w-8 h-8"
}`}
>
<HeroIcon iconName={icon} type={iconType} />
</div>
) : (
""
)}
</button>
)
);

export default IconButton;
13 changes: 13 additions & 0 deletions src/lib/components/actions/MenuItemButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

const MenuItemButton = ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => {
return (
<button
className="group flex w-full items-center gap-2 hover:bg-white/10 rounded-xl px-3 py-1.5"
{...props}
>
{children}
</button>
);
};

export default MenuItemButton;
Loading

0 comments on commit 87bd0df

Please sign in to comment.