-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9332052
commit 1bbd679
Showing
5 changed files
with
67 additions
and
21 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,35 @@ | ||
import { JSX, Show } from "solid-js"; | ||
|
||
import { LoadingSpinner } from "./LoadingSpinner"; | ||
|
||
export function SubtleButton(props: { | ||
children: JSX.Element | string; | ||
onClick?: () => void; | ||
loading?: boolean; | ||
disabled?: boolean; | ||
intent?: "red" | "green" | "blue"; | ||
type?: "button" | "submit"; | ||
}) { | ||
return ( | ||
<button | ||
type={props.type || "button"} | ||
onClick={() => props.onClick && props.onClick()} | ||
disabled={props.loading || props.disabled} | ||
class="flex items-center justify-center gap-2 rounded-xl border border-white/10 bg-neutral-900 p-2 no-underline active:-mb-[1px] active:mt-[1px] active:opacity-70" | ||
classList={{ | ||
"text-m-grey-350": !props.intent, | ||
"text-m-red": props.intent === "red", | ||
"text-m-green": props.intent === "green", | ||
"text-m-blue": props.intent === "blue" | ||
}} | ||
> | ||
<Show when={props.loading}> | ||
{/* Loading spinner has a weird padding on it */} | ||
<div class="-my-1 -mr-2"> | ||
<LoadingSpinner smallest wide /> | ||
</div> | ||
</Show> | ||
<Show when={!props.loading}>{props.children}</Show> | ||
</button> | ||
); | ||
} |
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