nextui/apps/docs/components/demos/music-player.tsx
Junior Garcia b8e7b94586
🚀 (#4570)
* docs: optimize route higtlight (#4520)

* docs: optimize home display (#4519)

* docs: optimize home display and route highlight

* docs: optimize home display

* fix(alert): propagate className (#4535)

* fix(alert): propagate className

* chore(alert): remove className from alert theme

* fix(avatar): title type in Avatar (#4529)

* fix(avatar): title type in Avatar

* fix(alert): apply isEmpty check on title

* fix(alert): alert interface props type

* refactor: remove unnecessary props types (#4530)

* refactor(docs): remove string type as it is included in ReactNode

* refactor: remove unnecessary types

* feat(changeset): add changeset

* chore: remove changeset

* refactor: remove null since ReactNode unions it already

* fix(input): use onPress for wrapper click focus (#4483)

* fix(input): use onPress for wrapper click focus

* test(input): wrapper click focus test

* chore(changeset): input onPress for wrapper click focus

* chore(changeset): minor wording

* Refactor/rebrand (#4532)

* chore: rebrand in progress

* chore: update docs to use heroui

* chore: components renbranded

* chore: figma moved to the docs files

* fix: posthog config

* fix(docs): extra classname in form example (#4465)

* chore: clean git

* chore: make heroui private

* chore: new logo

* chore: node env var renamed

* chore: public robots txt deleted

* chore: wrangler installed

* chore: wrangler renamed

* chore: cloudlfare workers removed

* chore: force vercel deploy

* refactor: first migration and provider

* refactor: rename nextui plugin

* refactor: rename github site

* refactor: rename CONTRIBUTING

* refactor: rename package name

* refactor: nextjs image hostname

* refactor: mdx repo nextui-org rename frontio-ai

* refactor: nextui.org rename heroui.com

* refactor: add heroui to missing places

* fix: heroui plugin name

* fix: update docs

* docs: nextui to heroui add npmrc pnpm migratation

* chore: rename all packages with new org name

* chore: replace frontio-ai by frontioai

* chore: revert previous changes

* chore: small adjustment

* chore: doc updated

* feat: blog

* chore: avatar updated

* fix: url

* chore: add new ogimage

* fix: ogimage command

* fix: heroui name and storybook welcome page

* fix: og image url

* feat: favicon and icon changed

---------

Co-authored-by: աӄա <wingkwong.code@gmail.com>
Co-authored-by: winches <329487092@qq.com>

* fix: postbuild script

* chore: core package updates

* ci(changesets): version packages (#4569)

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat: contributors added to the blog

---------

Co-authored-by: winches <329487092@qq.com>
Co-authored-by: աӄա <wingkwong.code@gmail.com>
Co-authored-by: Peterl561 <76144929+Peterl561@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-16 16:24:32 -03:00

134 lines
4.3 KiB
TypeScript

"use client";
import {Card, CardBody, Button, Image, Slider, CardProps} from "@heroui/react";
import {useState, FC} from "react";
import {clsx} from "@heroui/shared-utils";
import NextImage from "next/image";
import {
PauseCircleBoldIcon,
NextBoldIcon,
PreviousBoldIcon,
RepeatOneBoldIcon,
ShuffleBoldIcon,
HeartLinearIcon,
} from "@/components/icons";
export interface MusicPlayerProps extends CardProps {}
export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) => {
const [liked, setLiked] = useState(false);
return (
<Card
isBlurred
className={clsx("border-none bg-background/60 dark:bg-default-100/50", className)}
shadow="sm"
{...otherProps}
>
<CardBody>
<div className="md:max-h-[200px] grid grid-cols-6 md:grid-cols-12 gap-6 md:gap-4 items-center justify-center">
<div className="relative col-span-6 md:col-span-4">
<Image
alt="Album cover"
as={NextImage}
className="object-cover"
height={160}
shadow="md"
src="/images/album-cover.png"
width={240}
/>
</div>
<div className="flex flex-col col-span-6 md:col-span-8">
<div className="flex justify-between items-start">
<div className="flex flex-col gap-0">
<p className="text-sm font-semibold text-foreground">Daily Mix</p>
<p className="text-xs text-foreground/80">12 Tracks</p>
<p className="text-lg font-medium mt-2">Frontend Radio</p>
</div>
<Button
isIconOnly
aria-label="Like"
className="text-default-900/60 data-[hover]:bg-foreground/10 -translate-y-2 translate-x-2"
radius="full"
variant="light"
onPress={() => setLiked((v) => !v)}
>
<HeartLinearIcon
className={liked ? "[&>path]:stroke-transparent" : ""}
fill={liked ? "currentColor" : "none"}
/>
</Button>
</div>
<div className="flex flex-col mt-3 gap-1">
<Slider
aria-label="Music progress"
classNames={{
track: "bg-default-500/30",
thumb: "w-2 h-2 after:w-2 after:h-2 after:bg-foreground",
}}
color="foreground"
defaultValue={33}
size="sm"
/>
<div className="flex justify-between">
<p className="text-sm">1:23</p>
<p className="text-sm text-foreground/50">4:32</p>
</div>
</div>
<div className="flex w-full items-center justify-center">
<Button
isIconOnly
aria-label="Repeat"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
>
<RepeatOneBoldIcon className="text-foreground/80" />
</Button>
<Button
isIconOnly
aria-label="Previous"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
>
<PreviousBoldIcon />
</Button>
<Button
isIconOnly
aria-label="Play"
className="w-auto h-auto data-[hover]:bg-foreground/10"
radius="full"
variant="light"
>
<PauseCircleBoldIcon size={54} />
</Button>
<Button
isIconOnly
aria-label="Next"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
>
<NextBoldIcon />
</Button>
<Button
isIconOnly
aria-label="Shuffle"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
>
<ShuffleBoldIcon className="text-foreground/80" />
</Button>
</div>
</div>
</div>
</CardBody>
</Card>
);
};