mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 08:54:13 +00:00
feat: add donate item
This commit is contained in:
parent
17b4f25ff1
commit
f12ca4806c
5 changed files with 36 additions and 6 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
color: var(--color-foreground-subtle);
|
color: var(--color-foreground-subtle);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 1px solid var(--color-neutral-200);
|
border: 1px solid var(--color-neutral-200);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,30 @@
|
||||||
import styles from './item.module.css';
|
import styles from './item.module.css';
|
||||||
|
|
||||||
interface ItemProps {
|
interface ItemProps {
|
||||||
disabled: boolean;
|
disabled?: boolean;
|
||||||
|
href?: string;
|
||||||
icon: React.ReactElement;
|
icon: React.ReactElement;
|
||||||
label: string;
|
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 (
|
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}
|
<span className={styles.icon}>{icon}</span> {label}
|
||||||
</button>
|
</Comp>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/components/menu/items/donate.tsx
Normal file
13
src/components/menu/items/donate.tsx
Normal file
|
|
@ -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,2 +1,3 @@
|
||||||
export { Shuffle as ShuffleItem } from './shuffle';
|
export { Shuffle as ShuffleItem } from './shuffle';
|
||||||
export { Share as ShareItem } from './share';
|
export { Share as ShareItem } from './share';
|
||||||
|
export { Donate as DonateItem } from './donate';
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import {
|
||||||
FloatingFocusManager,
|
FloatingFocusManager,
|
||||||
} from '@floating-ui/react';
|
} from '@floating-ui/react';
|
||||||
|
|
||||||
import { ShuffleItem, ShareItem } from './items';
|
import { ShuffleItem, ShareItem, DonateItem } from './items';
|
||||||
import { ShareLinkModal } from '@/components/modals/share-link';
|
import { ShareLinkModal } from '@/components/modals/share-link';
|
||||||
|
|
||||||
import { slideY, fade, mix } from '@/lib/motion';
|
import { slideY, fade, mix } from '@/lib/motion';
|
||||||
|
|
@ -76,6 +76,7 @@ export function Menu() {
|
||||||
>
|
>
|
||||||
<ShareItem open={() => setShowShareLink(true)} />
|
<ShareItem open={() => setShowShareLink(true)} />
|
||||||
<ShuffleItem />
|
<ShuffleItem />
|
||||||
|
<DonateItem />
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
</FloatingFocusManager>
|
</FloatingFocusManager>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue