mirror of
https://github.com/remvze/moodist.git
synced 2025-09-29 15:30:49 -04:00
feat: add shortcuts to items
This commit is contained in:
parent
669df1f082
commit
42f82ab95d
@ -2,7 +2,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
column-gap: 8px;
|
column-gap: 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
@ -31,6 +31,13 @@
|
|||||||
border: 1px solid var(--color-neutral-300);
|
border: 1px solid var(--color-neutral-300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .label {
|
||||||
|
display: flex;
|
||||||
|
column-gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
& .icon {
|
& .icon {
|
||||||
color: var(--color-foreground);
|
color: var(--color-foreground);
|
||||||
}
|
}
|
||||||
@ -41,4 +48,8 @@
|
|||||||
background: var(--color-neutral-950);
|
background: var(--color-neutral-950);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .shortcut {
|
||||||
|
font-size: var(--font-2xsm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ interface ItemProps {
|
|||||||
icon: React.ReactElement;
|
icon: React.ReactElement;
|
||||||
label: string;
|
label: string;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
|
shortcut?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Item({
|
export function Item({
|
||||||
@ -18,6 +19,7 @@ export function Item({
|
|||||||
icon,
|
icon,
|
||||||
label,
|
label,
|
||||||
onClick = () => {},
|
onClick = () => {},
|
||||||
|
shortcut,
|
||||||
}: ItemProps) {
|
}: ItemProps) {
|
||||||
const Comp = href ? 'a' : 'button';
|
const Comp = href ? 'a' : 'button';
|
||||||
|
|
||||||
@ -28,8 +30,12 @@ export function Item({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
{...(href ? { href, target: '_blank' } : {})}
|
{...(href ? { href, target: '_blank' } : {})}
|
||||||
>
|
>
|
||||||
<span className={styles.icon}>{icon}</span> {label}
|
<span className={styles.label}>
|
||||||
{active && <div className={styles.active} />}
|
<span className={styles.icon}>{icon}</span> {label}
|
||||||
|
{active && <div className={styles.active} />}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{shortcut && <span className={styles.shortcut}>{shortcut}</span>}
|
||||||
</Comp>
|
</Comp>
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
);
|
);
|
||||||
|
@ -16,6 +16,7 @@ export function Notepad({ open }: NotepadProps) {
|
|||||||
active={!!note.length}
|
active={!!note.length}
|
||||||
icon={<MdNotes />}
|
icon={<MdNotes />}
|
||||||
label="Notepad"
|
label="Notepad"
|
||||||
|
shortcut="Alt + N"
|
||||||
onClick={open}
|
onClick={open}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -16,6 +16,7 @@ export function Pomodoro({ open }: PomodoroProps) {
|
|||||||
active={running}
|
active={running}
|
||||||
icon={<MdOutlineAvTimer />}
|
icon={<MdOutlineAvTimer />}
|
||||||
label="Pomodoro"
|
label="Pomodoro"
|
||||||
|
shortcut="Alt + P"
|
||||||
onClick={open}
|
onClick={open}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -7,5 +7,12 @@ interface PresetsProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Presets({ open }: PresetsProps) {
|
export function Presets({ open }: PresetsProps) {
|
||||||
return <Item icon={<RiPlayListFill />} label="Your Presets" onClick={open} />;
|
return (
|
||||||
|
<Item
|
||||||
|
icon={<RiPlayListFill />}
|
||||||
|
label="Your Presets"
|
||||||
|
shortcut="Shift + Alt + P"
|
||||||
|
onClick={open}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ export function Share({ open }: ShareProps) {
|
|||||||
disabled={noSelected}
|
disabled={noSelected}
|
||||||
icon={<IoShareSocialSharp />}
|
icon={<IoShareSocialSharp />}
|
||||||
label="Share Sounds"
|
label="Share Sounds"
|
||||||
|
shortcut="Alt + S"
|
||||||
onClick={open}
|
onClick={open}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
row-gap: 4px;
|
row-gap: 4px;
|
||||||
width: 240px;
|
width: 250px;
|
||||||
height: max-content;
|
height: max-content;
|
||||||
max-height: var(--radix-dropdown-menu-content-available-height);
|
max-height: var(--radix-dropdown-menu-content-available-height);
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user