mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 08:54:13 +00:00
feat: add disabled state
This commit is contained in:
parent
c8e51226e5
commit
ff26597d22
3 changed files with 19 additions and 4 deletions
|
|
@ -17,7 +17,12 @@
|
|||
outline: none;
|
||||
transition: 0.2s;
|
||||
|
||||
&:hover {
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
&:not(:disabled):hover {
|
||||
color: var(--color-foreground);
|
||||
background-color: var(--color-neutral-200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
import styles from './item.module.css';
|
||||
|
||||
interface ItemProps {
|
||||
disabled: boolean;
|
||||
icon: React.ReactElement;
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
export function Item({ icon, label, onClick }: ItemProps) {
|
||||
export function Item({ disabled = false, icon, label, onClick }: ItemProps) {
|
||||
return (
|
||||
<button className={styles.item} onClick={onClick}>
|
||||
<button className={styles.item} disabled={disabled} onClick={onClick}>
|
||||
<span className={styles.icon}>{icon}</span> {label}
|
||||
</button>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,12 +2,21 @@ import { IoShareSocialSharp } from 'react-icons/io5/index';
|
|||
|
||||
import { Item } from '../item';
|
||||
|
||||
import { useSoundStore } from '@/store';
|
||||
|
||||
interface ShareProps {
|
||||
open: () => void;
|
||||
}
|
||||
|
||||
export function Share({ open }: ShareProps) {
|
||||
const noSelected = useSoundStore(state => state.noSelected());
|
||||
|
||||
return (
|
||||
<Item icon={<IoShareSocialSharp />} label="Share Sounds" onClick={open} />
|
||||
<Item
|
||||
disabled={noSelected}
|
||||
icon={<IoShareSocialSharp />}
|
||||
label="Share Sounds"
|
||||
onClick={open}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue