-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
6 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,16 +1,30 @@ | ||
import styles from './item.module.css'; | ||
|
||
interface ItemProps { | ||
disabled: boolean; | ||
disabled?: boolean; | ||
href?: string; | ||
icon: React.ReactElement; | ||
label: string; | ||
onClick: () => void; | ||
onClick?: () => void; | ||
} | ||
|
||
export function Item({ disabled = false, icon, label, onClick }: ItemProps) { | ||
export function Item({ | ||
disabled = false, | ||
href, | ||
icon, | ||
label, | ||
onClick = () => {}, | ||
}: ItemProps) { | ||
const Comp = href ? 'a' : 'button'; | ||
|
||
return ( | ||
<button className={styles.item} disabled={disabled} onClick={onClick}> | ||
<Comp | ||
className={styles.item} | ||
disabled={disabled} | ||
onClick={onClick} | ||
{...(href ? { href, target: '_blank' } : {})} | ||
> | ||
<span className={styles.icon}>{icon}</span> {label} | ||
</button> | ||
</Comp> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { SiBuymeacoffee } from 'react-icons/si/index'; | ||
|
||
import { Item } from '../item'; | ||
|
||
export function Donate() { | ||
return ( | ||
<Item | ||
href="https://buymeacoffee.com" | ||
icon={<SiBuymeacoffee />} | ||
label="Buy Me a Coffe" | ||
/> | ||
); | ||
} |
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,2 +1,3 @@ | ||
export { Shuffle as ShuffleItem } from './shuffle'; | ||
export { Share as ShareItem } from './share'; | ||
export { Donate as DonateItem } from './donate'; |
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