ant-design/.dumi/theme/builtins/Audio/index.tsx

14 lines
393 B
TypeScript
Raw Normal View History

2024-09-26 14:02:10 +08:00
import React from 'react';
import { SoundOutlined } from '@ant-design/icons';
const Audio: React.FC<React.PropsWithChildren<{ domId: string }>> = ({ domId, children }) => {
return (
<a onClick={() => document.querySelector<HTMLAudioElement>(`#${domId}`)?.play()}>
{children}
<SoundOutlined style={{ fontSize: 20, color: 'black' }} />
</a>
);
};
export default Audio;