-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from justin13888/dev
Merge v1 (alpha)
- Loading branch information
Showing
36 changed files
with
2,759 additions
and
1,065 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,6 @@ | |
}, | ||
"vcs": { | ||
"enabled": true, | ||
"clientKind":"git" | ||
"clientKind": "git" | ||
} | ||
} |
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,43 @@ | ||
import { ColorModeContext } from "@kobalte/core"; | ||
import { Moon, Sun } from "lucide-solid"; | ||
import { Motion } from "solid-Motionone"; | ||
import { type Component, useContext } from "solid-js"; | ||
|
||
export const DarkModeSwitcher: Component = () => { | ||
const { colorMode, toggleColorMode } = useContext(ColorModeContext)!; | ||
|
||
return ( | ||
<button | ||
onClick={toggleColorMode} | ||
class="p-2 rounded-full bg-gray-200 dark:bg-gray-800 transition-colors duration-300" | ||
aria-label={ | ||
colorMode() === "dark" | ||
? "Switch to light mode" | ||
: "Switch to dark mode" | ||
} | ||
> | ||
<Motion.div | ||
animate={{ rotate: colorMode() === "dark" ? 360 : 0 }} | ||
transition={{ duration: 0.5, easing: "ease-in-out" }} | ||
class="relative w-6 h-6" | ||
> | ||
<Motion.div | ||
initial={false} | ||
animate={{ opacity: colorMode() === "dark" ? 0 : 1 }} | ||
transition={{ duration: 0.25 }} | ||
class="absolute inset-0" | ||
> | ||
<Sun class="w-6 h-6 text-yellow-500" /> | ||
</Motion.div> | ||
<Motion.div | ||
initial={false} | ||
animate={{ opacity: colorMode() === "dark" ? 1 : 0 }} | ||
transition={{ duration: 0.25 }} | ||
class="absolute inset-0" | ||
> | ||
<Moon class="w-6 h-6 text-blue-500" /> | ||
</Motion.div> | ||
</Motion.div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { type Component, type ComponentProps, createSignal } from "solid-js"; | ||
import { CardTitle } from "./ui/card"; | ||
|
||
export const EditableCardTitle: Component< | ||
Omit< | ||
ComponentProps<"h3"> & { | ||
initialValue: string; | ||
onUpdateValue: (val: string) => any; | ||
}, | ||
"children" | ||
> | ||
> = (props) => { | ||
let lastValue = props.initialValue; | ||
const [isEditing, setIsEditing] = createSignal(false); | ||
const [value, setValue] = createSignal(props.initialValue); // use children as initial value | ||
|
||
const handleDoubleClick = () => { | ||
setIsEditing(true); | ||
}; | ||
|
||
const handleBlur = () => { | ||
setIsEditing(false); | ||
const currentValue = value(); | ||
if (props.onUpdateValue && currentValue) { | ||
props.onUpdateValue(currentValue); | ||
lastValue = currentValue; | ||
} | ||
}; | ||
|
||
const handleReset = () => { | ||
setIsEditing(false); | ||
setValue(props.initialValue); | ||
}; | ||
|
||
return ( | ||
<CardTitle | ||
{...props} | ||
onDblClick={handleDoubleClick} | ||
class={props.class} | ||
> | ||
{isEditing() ? ( | ||
<input | ||
type="text" | ||
value={value()} | ||
onInput={(e) => { | ||
setValue(e.target.value); | ||
}} | ||
onKeyDown={(e) => { | ||
if (e.key === "Enter") { | ||
handleBlur(); | ||
} else if (e.key === "Escape") { | ||
handleReset(); | ||
} | ||
}} | ||
onBlur={handleBlur} | ||
class="w-full border rounded px-2 py-1" | ||
autofocus | ||
/> | ||
) : ( | ||
value() || <span class="italic">Untitled</span> | ||
)} | ||
</CardTitle> | ||
); | ||
}; |
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,42 @@ | ||
import { cn } from "@/utils"; | ||
import type { VariantProps } from "class-variance-authority"; | ||
import { cva } from "class-variance-authority"; | ||
import { type ComponentProps, splitProps } from "solid-js"; | ||
|
||
export const badgeVariants = cva( | ||
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-shadow focus-visible:outline-none focus-visible:ring-[1.5px] focus-visible:ring-ring", | ||
{ | ||
variants: { | ||
variant: { | ||
default: | ||
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", | ||
secondary: | ||
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", | ||
destructive: | ||
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", | ||
outline: "text-foreground", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
}, | ||
}, | ||
); | ||
|
||
export const Badge = ( | ||
props: ComponentProps<"div"> & VariantProps<typeof badgeVariants>, | ||
) => { | ||
const [local, rest] = splitProps(props, ["class", "variant"]); | ||
|
||
return ( | ||
<div | ||
class={cn( | ||
badgeVariants({ | ||
variant: local.variant, | ||
}), | ||
local.class, | ||
)} | ||
{...rest} | ||
/> | ||
); | ||
}; |
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.