This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge upstream, add DropdownItem component
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component, JSX, Show, createSignal } from "solid-js"; | ||
|
||
import Button from "./Button"; | ||
|
||
import { ChevronDown } from "lucide-solid"; | ||
|
||
const Dropdown: Component<{ children: JSX.Element, label: string }> = (props) => { | ||
const [open, setOpen] = createSignal(false); | ||
|
||
return( | ||
<div class="inline-block"> | ||
<Button onClick={() => {setOpen(!open())}}> | ||
<ChevronDown /> | ||
{props.label} | ||
</Button> | ||
<Show when={open()}><div class="flex flex-col rounded-md bg-stone-600 drop-shadow-md">{props.children}</div></Show> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
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,13 @@ | ||
import { Component, JSX, createSignal } from "solid-js"; | ||
|
||
const DropdownItem: Component<{ | ||
children: JSX.Element; | ||
reference?: any; | ||
onClick?: JSX.EventHandler<HTMLAnchorElement, MouseEvent>; | ||
}> = (props) => { | ||
return ( | ||
<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 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 |
---|---|---|
|
@@ -87,4 +87,5 @@ | |
border: none; | ||
background: transparent; | ||
} | ||
|
||
} |