-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/seed-completed-downloads' of github.com:hydrala…
…uncher/hydra into feature/seed-completed-downloads
- Loading branch information
Showing
12 changed files
with
585 additions
and
79 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
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
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
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
68 changes: 68 additions & 0 deletions
68
src/renderer/src/components/dropdown-menu/dropdown-menu.scss
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,68 @@ | ||
@use "../../scss/globals.scss"; | ||
|
||
.dropdown-menu { | ||
&__content { | ||
background-color: globals.$dark-background-color; | ||
border: 1px solid globals.$border-color; | ||
border-radius: 4px; | ||
min-width: 200px; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
&__group { | ||
width: 100%; | ||
padding: 4px; | ||
} | ||
|
||
&__title-bar { | ||
width: 100%; | ||
padding: 4px 12px; | ||
font-size: 14px; | ||
font-weight: 500; | ||
color: globals.$muted-color; | ||
} | ||
|
||
&__separator { | ||
width: 100%; | ||
height: 1px; | ||
background-color: globals.$border-color; | ||
} | ||
|
||
&__item { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-start; | ||
gap: 8px; | ||
border-radius: 4px; | ||
padding: 5px 12px; | ||
cursor: pointer; | ||
transition: background-color 0.1s ease-in-out; | ||
font-size: 14px; | ||
} | ||
|
||
&__item--disabled { | ||
cursor: default; | ||
opacity: 0.6; | ||
} | ||
|
||
&:not(&__item--disabled) &__item:hover { | ||
background-color: globals.$background-color; | ||
color: globals.$muted-color; | ||
} | ||
|
||
&__item:focus { | ||
background-color: globals.$background-color; | ||
outline: none; | ||
} | ||
|
||
&__item-icon { | ||
width: 16px; | ||
height: 16px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
src/renderer/src/components/dropdown-menu/dropdown-menu.tsx
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,81 @@ | ||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; | ||
import "./dropdown-menu.scss"; | ||
|
||
export interface DropdownMenuItem { | ||
icon?: React.ReactNode; | ||
label: string; | ||
disabled?: boolean; | ||
show?: boolean; | ||
onClick?: () => void; | ||
} | ||
|
||
interface DropdownMenuProps { | ||
children: React.ReactNode; | ||
title?: string; | ||
loop?: boolean; | ||
items: DropdownMenuItem[]; | ||
sideOffset?: number; | ||
side?: "top" | "bottom" | "left" | "right"; | ||
align?: "start" | "center" | "end"; | ||
alignOffset?: number; | ||
} | ||
|
||
export function DropdownMenu({ | ||
children, | ||
title, | ||
items, | ||
sideOffset = 5, | ||
side = "bottom", | ||
loop = true, | ||
align = "center", | ||
alignOffset = 0, | ||
}: DropdownMenuProps) { | ||
return ( | ||
<DropdownMenuPrimitive.Root> | ||
<DropdownMenuPrimitive.Trigger asChild> | ||
<button aria-label={title}>{children}</button> | ||
</DropdownMenuPrimitive.Trigger> | ||
|
||
<DropdownMenuPrimitive.Portal> | ||
<DropdownMenuPrimitive.Content | ||
sideOffset={sideOffset} | ||
side={side} | ||
loop={loop} | ||
align={align} | ||
alignOffset={alignOffset} | ||
className="dropdown-menu__content" | ||
> | ||
{title && ( | ||
<DropdownMenuPrimitive.Group className="dropdown-menu__group"> | ||
<div className="dropdown-menu__title-bar">{title}</div> | ||
</DropdownMenuPrimitive.Group> | ||
)} | ||
|
||
<DropdownMenuPrimitive.Separator className="dropdown-menu__separator" /> | ||
|
||
<DropdownMenuPrimitive.Group className="dropdown-menu__group"> | ||
{items.map( | ||
(item) => | ||
item.show !== false && ( | ||
<DropdownMenuPrimitive.Item | ||
key={item.label} | ||
aria-label={item.label} | ||
onSelect={item.onClick} | ||
className={`dropdown-menu__item ${item.disabled ? "dropdown-menu__item--disabled" : ""}`} | ||
disabled={item.disabled} | ||
> | ||
{item.icon && ( | ||
<div className="dropdown-menu__item-icon"> | ||
{item.icon} | ||
</div> | ||
)} | ||
{item.label} | ||
</DropdownMenuPrimitive.Item> | ||
) | ||
)} | ||
</DropdownMenuPrimitive.Group> | ||
</DropdownMenuPrimitive.Content> | ||
</DropdownMenuPrimitive.Portal> | ||
</DropdownMenuPrimitive.Root> | ||
); | ||
} |
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
Oops, something went wrong.