forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: auto merge branches (ant-design#51236)
chore: auto merge branches
- Loading branch information
Showing
56 changed files
with
796 additions
and
267 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
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 |
---|---|---|
@@ -1,13 +1,48 @@ | ||
import React from 'react'; | ||
import { SoundOutlined } from '@ant-design/icons'; | ||
import { createStyles } from 'antd-style'; | ||
|
||
const Audio: React.FC<React.PropsWithChildren<{ domId: string }>> = ({ domId, children }) => { | ||
const useStyle = createStyles(({ css, token }) => { | ||
const { paddingXXS, fontSizeXL, motionDurationSlow, colorLink, colorLinkHover, colorLinkActive } = | ||
token; | ||
return { | ||
playBtn: css` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
column-gap: ${paddingXXS}px; | ||
margin: 0; | ||
`, | ||
icon: css` | ||
font-size: ${fontSizeXL}px; | ||
color: ${colorLink}; | ||
transition: all ${motionDurationSlow}; | ||
&:hover { | ||
color: ${colorLinkHover}; | ||
} | ||
&:active { | ||
color: ${colorLinkActive}; | ||
} | ||
`, | ||
}; | ||
}); | ||
|
||
interface AudioProps { | ||
id?: string; | ||
} | ||
|
||
const AudioControl: React.FC<React.PropsWithChildren<AudioProps>> = ({ id, children }) => { | ||
const { styles } = useStyle(); | ||
const onClick: React.MouseEventHandler<HTMLAnchorElement> = () => { | ||
const audio = document.querySelector<HTMLAudioElement>(`#${id}`); | ||
audio?.play(); | ||
}; | ||
return ( | ||
<a onClick={() => document.querySelector<HTMLAudioElement>(`#${domId}`)?.play()}> | ||
<a className={styles.playBtn} onClick={onClick}> | ||
{children} | ||
<SoundOutlined style={{ fontSize: 20, color: 'black' }} /> | ||
<SoundOutlined className={styles.icon} /> | ||
</a> | ||
); | ||
}; | ||
|
||
export default Audio; | ||
export default AudioControl; |
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
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
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
File renamed without changes.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"*.{ts,tsx,js,jsx,css,mjs,json}": ["biome check --write --no-errors-on-unmatched"], | ||
"*.{ts,tsx,js,jsx,css,mjs,json}": ["biome check --write --no-errors-on-unmatched", "eslint"], | ||
"*.{md,yml}": ["prettier --ignore-unknown --write"] | ||
} |
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
Oops, something went wrong.