Skip to content

Commit

Permalink
feat: add donate item
Browse files Browse the repository at this point in the history
  • Loading branch information
remvze committed Feb 1, 2024
1 parent 17b4f25 commit f12ca48
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/menu/item/item.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
line-height: 1;
color: var(--color-foreground-subtle);
text-align: left;
text-decoration: none;
cursor: pointer;
background-color: transparent;
border: 1px solid var(--color-neutral-200);
Expand Down
24 changes: 19 additions & 5 deletions src/components/menu/item/item.tsx
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>
);
}
13 changes: 13 additions & 0 deletions src/components/menu/items/donate.tsx
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"
/>
);
}
1 change: 1 addition & 0 deletions src/components/menu/items/index.ts
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';
3 changes: 2 additions & 1 deletion src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
FloatingFocusManager,
} from '@floating-ui/react';

import { ShuffleItem, ShareItem } from './items';
import { ShuffleItem, ShareItem, DonateItem } from './items';
import { ShareLinkModal } from '@/components/modals/share-link';

import { slideY, fade, mix } from '@/lib/motion';
Expand Down Expand Up @@ -76,6 +76,7 @@ export function Menu() {
>
<ShareItem open={() => setShowShareLink(true)} />
<ShuffleItem />
<DonateItem />
</motion.div>
</div>
</FloatingFocusManager>
Expand Down

0 comments on commit f12ca48

Please sign in to comment.