This repository was archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
dropdown #17
Open
ewof
wants to merge
17
commits into
PygmalionAI:dev
Choose a base branch
from
ewof:dropdown
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
dropdown #17
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e239a63
chore: flesh out RangeInput component
ewof f239cff
Merge branch 'dev' into dev
ewof 1dac0e8
fix typo with importing Register component
ewof 5c0ad6f
update ranger slider component
ewof 7d53533
merge upstream and swap window.onload for createEffect in RangeInput …
ewof f4ed039
Revert "merge upstream and swap window.onload for createEffect in Ran…
ewof 2a2fbc0
Merge remote-tracking branch 'upstream/dev' into dev
ewof 8c4b29e
swap window.onload for createEffect in RangeInput component
ewof 1d38a0a
Merge branch 'PygmalionAI:dev' into dev
ewof 469fd7c
merge upstream, add DropdownItem component
ewof 7f6d27e
style fix
ewof b065e5c
replace dropdown-menu div with popper
ewof 9e4c193
run style fix
ewof 3c00adc
Merge branch 'dev' into dropdown
ewof bb4ba7e
add another border in gen settings and make dropdown component hide w…
ewof 3e890f0
style fix
ewof 6dacd1c
Merge branch 'dev' into dropdown
ewof File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,58 @@ | ||
| import { ChevronDown } from "lucide-solid"; | ||
| import { Component, JSX, createSignal } from "solid-js"; | ||
| import usePopper from "solid-popper"; | ||
|
|
||
| import Button from "./Button"; | ||
|
|
||
| const Dropdown: Component<{ children: JSX.Element; label: string }> = ( | ||
| props | ||
| ) => { | ||
| const [open, setOpen] = createSignal(false); | ||
| const [dropdown, setDropdown] = createSignal(); | ||
| const [dropdownMenu, setDropdownMenu] = createSignal(); | ||
|
|
||
| usePopper(dropdown, dropdownMenu, { | ||
| placement: "bottom-start", | ||
| }); | ||
ewof marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| window.onclick = function (e) { | ||
| const dropdownButton = (dropdown() as unknown as HTMLElement).children[0]; | ||
| const dropdownButtonChevron = (dropdown() as unknown as HTMLElement) | ||
| .children[0].children[0]; | ||
|
|
||
| if ( | ||
| open() && | ||
| e.target !== dropdownButton && | ||
| e.target !== dropdownButtonChevron | ||
| ) { | ||
| setOpen(!open()); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <div ref={setDropdown} class="lol"> | ||
| <Button | ||
| onClick={() => { | ||
| setOpen(!open()); | ||
| }} | ||
| > | ||
| {props.label} | ||
| <ChevronDown /> | ||
| </Button> | ||
| </div> | ||
|
|
||
| <div | ||
| ref={setDropdownMenu} | ||
| id="dropdownMenu" | ||
| class={`${ | ||
| open() ? "visible" : "invisible" | ||
| } z-10 flex flex-col rounded-md bg-stone-600 drop-shadow-md`} | ||
| > | ||
| {props.children} | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default Dropdown; | ||
This file contains hidden or 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,17 @@ | ||
| import { Component, JSX } from "solid-js"; | ||
|
|
||
| const DropdownItem: Component<{ | ||
| children: JSX.Element; | ||
| reference?: any; | ||
| onClick?: JSX.EventHandler<HTMLAnchorElement, MouseEvent>; | ||
| }> = (props) => ( | ||
| <a | ||
| class="px-5 py-3 hover:bg-stone-500" | ||
| href={props.reference} | ||
| onClick={props.onClick} | ||
| > | ||
| {props.children} | ||
| </a> | ||
| ); | ||
|
|
||
| export default DropdownItem; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.