mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
25 lines
648 B
TypeScript
25 lines
648 B
TypeScript
'use client';
|
|
|
|
import type { AudioHTMLAttributes } from 'react';
|
|
import { forwardRef } from 'react';
|
|
|
|
import { useMediaAttach } from '../player/context';
|
|
import { useComposedRefs } from '../utils/use-composed-refs';
|
|
|
|
export interface AudioProps extends AudioHTMLAttributes<HTMLAudioElement> {}
|
|
|
|
export const Audio = forwardRef<HTMLAudioElement, AudioProps>(function Audio({ children, ...props }, ref) {
|
|
const setMedia = useMediaAttach();
|
|
const composedRef = useComposedRefs(ref, setMedia);
|
|
|
|
return (
|
|
<audio ref={composedRef} {...props}>
|
|
{children}
|
|
</audio>
|
|
);
|
|
});
|
|
|
|
export namespace Audio {
|
|
export type Props = AudioProps;
|
|
}
|