Skip to content

Commit

Permalink
format all files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderjoe committed Jan 22, 2024
1 parent 7baa803 commit bcc89ee
Show file tree
Hide file tree
Showing 25 changed files with 432 additions and 366 deletions.
3 changes: 3 additions & 0 deletions ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore
**/env
**/.idea
12 changes: 5 additions & 7 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { Component, createSignal } from 'solid-js';
import { Navbar } from '~/components/navbar';
import { Component, createSignal } from "solid-js";
import { Navbar } from "~/components/navbar";

const App: Component = (props: any) => {
let preferredTheme = localStorage.getItem('theme');
const [theme, setTheme] = createSignal(
preferredTheme ? preferredTheme : 'blackout',
);
let preferredTheme = localStorage.getItem("theme");
const [theme, setTheme] = createSignal(preferredTheme ? preferredTheme : "blackout");

const changeThemeCallback = (theme: string) => {
setTheme(theme);
localStorage.setItem('theme', theme);
localStorage.setItem("theme", theme);
};

return (
Expand Down
18 changes: 9 additions & 9 deletions ui/src/components/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { A } from "@solidjs/router";
import { Component } from "solid-js";

interface ILink {
href: string;
children: string;
class?: string;
href: string;
children: string;
class?: string;
}

export const Link: Component<ILink> = (props: ILink) => {
return (
<A href={props.href} class={props.class} end={true}>
{props.children}
</A>
);
}
return (
<A href={props.href} class={props.class} end={true}>
{props.children}
</A>
);
};
2 changes: 1 addition & 1 deletion ui/src/components/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from 'solid-js';
import { Component } from "solid-js";

export const Loading: Component = () => {
return (
Expand Down
18 changes: 7 additions & 11 deletions ui/src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Link } from './link';
import { Component, createSignal } from 'solid-js';
import { Link } from "./link";
import { Component, createSignal } from "solid-js";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '~/components/ui/select.tsx';
SelectValue
} from "~/components/ui/select.tsx";

interface Props {
theme: string;
Expand All @@ -29,16 +29,12 @@ export const Navbar: Component<Props> = (props: Props) => {
<Select
value={theme()}
onChange={changeTheme}
options={['blackout', 'logan', 'lavender', 'light']}
options={["blackout", "logan", "lavender", "light"]}
placeholder="Select a theme"
itemComponent={(props) => (
<SelectItem item={props.item}>{props.item.rawValue}</SelectItem>
)}
itemComponent={props => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
>
<SelectTrigger aria-label="Theme" class="w-[180px]">
<SelectValue<string>>
{(state) => state.selectedOption()}
</SelectValue>
<SelectValue<string>>{state => state.selectedOption()}</SelectValue>
</SelectTrigger>
<SelectContent />
</Select>
Expand Down
54 changes: 27 additions & 27 deletions ui/src/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { Component } from "solid-js"
import { splitProps } from "solid-js"
import type { Component } from "solid-js";
import { splitProps } from "solid-js";

import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core"
import { TbX } from "solid-icons/tb"
import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core";
import { TbX } from "solid-icons/tb";

import { cn } from "~/lib/utils"
import { cn } from "~/lib/utils";

const AlertDialog = AlertDialogPrimitive.Root
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const AlertDialogPortal = AlertDialogPrimitive.Portal
const AlertDialog = AlertDialogPrimitive.Root;
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
const AlertDialogPortal = AlertDialogPrimitive.Portal;

const AlertDialogOverlay: Component<AlertDialogPrimitive.AlertDialogOverlayProps> = (props) => {
const [, rest] = splitProps(props, ["class"])
const AlertDialogOverlay: Component<AlertDialogPrimitive.AlertDialogOverlayProps> = props => {
const [, rest] = splitProps(props, ["class"]);
return (
<AlertDialogPrimitive.Overlay
class={cn(
Expand All @@ -20,11 +20,11 @@ const AlertDialogOverlay: Component<AlertDialogPrimitive.AlertDialogOverlayProps
)}
{...rest}
/>
)
}
);
};

const AlertDialogContent: Component<AlertDialogPrimitive.AlertDialogContentProps> = (props) => {
const [, rest] = splitProps(props, ["class", "children"])
const AlertDialogContent: Component<AlertDialogPrimitive.AlertDialogContentProps> = props => {
const [, rest] = splitProps(props, ["class", "children"]);
return (
<AlertDialogPortal>
<AlertDialogOverlay />
Expand All @@ -42,25 +42,25 @@ const AlertDialogContent: Component<AlertDialogPrimitive.AlertDialogContentProps
</AlertDialogPrimitive.CloseButton>
</AlertDialogPrimitive.Content>
</AlertDialogPortal>
)
}
);
};

const AlertDialogTitle: Component<AlertDialogPrimitive.AlertDialogTitleProps> = (props) => {
const [, rest] = splitProps(props, ["class"])
return <AlertDialogPrimitive.Title class={cn("text-lg font-semibold", props.class)} {...rest} />
}
const AlertDialogTitle: Component<AlertDialogPrimitive.AlertDialogTitleProps> = props => {
const [, rest] = splitProps(props, ["class"]);
return <AlertDialogPrimitive.Title class={cn("text-lg font-semibold", props.class)} {...rest} />;
};

const AlertDialogDescription: Component<AlertDialogPrimitive.AlertDialogDescriptionProps> = (
props
) => {
const [, rest] = splitProps(props, ["class"])
const AlertDialogDescription: Component<
AlertDialogPrimitive.AlertDialogDescriptionProps
> = props => {
const [, rest] = splitProps(props, ["class"]);
return (
<AlertDialogPrimitive.Description
class={cn("text-muted-foreground text-sm", props.class)}
{...rest}
/>
)
}
);
};

export {
AlertDialog,
Expand All @@ -70,4 +70,4 @@ export {
AlertDialogContent,
AlertDialogTitle,
AlertDialogDescription
}
};
39 changes: 26 additions & 13 deletions ui/src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
import type { Component } from 'solid-js';
import { splitProps } from 'solid-js';
import type { Component } from "solid-js";
import { splitProps } from "solid-js";

import { Image as ImagePrimitive } from '@kobalte/core';
import { Image as ImagePrimitive } from "@kobalte/core";

import { cn } from '~/lib/utils';
import { cn } from "~/lib/utils";

const Avatar: Component<ImagePrimitive.ImageRootProps> = (props) => {
const [, rest] = splitProps(props, ['class']);
return <ImagePrimitive.Root class={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', props.class)} {...rest} />;
const Avatar: Component<ImagePrimitive.ImageRootProps> = props => {
const [, rest] = splitProps(props, ["class"]);
return (
<ImagePrimitive.Root
class={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", props.class)}
{...rest}
/>
);
};

const AvatarImage: Component<ImagePrimitive.ImageImgProps> = (props) => {
const [, rest] = splitProps(props, ['class']);
return <ImagePrimitive.Img class={cn('aspect-square h-full w-full', props.class)} {...rest} />;
const AvatarImage: Component<ImagePrimitive.ImageImgProps> = props => {
const [, rest] = splitProps(props, ["class"]);
return <ImagePrimitive.Img class={cn("aspect-square h-full w-full", props.class)} {...rest} />;
};

const AvatarFallback: Component<ImagePrimitive.ImageFallbackProps> = (props) => {
const [, rest] = splitProps(props, ['class']);
return <ImagePrimitive.Fallback class={cn('bg-muted flex h-full w-full items-center justify-center rounded-full', props.class)} {...rest} />;
const AvatarFallback: Component<ImagePrimitive.ImageFallbackProps> = props => {
const [, rest] = splitProps(props, ["class"]);
return (
<ImagePrimitive.Fallback
class={cn(
"bg-muted flex h-full w-full items-center justify-center rounded-full",
props.class
)}
{...rest}
/>
);
};

export { Avatar, AvatarFallback, AvatarImage };
45 changes: 25 additions & 20 deletions ui/src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
import type { Component, ComponentProps } from 'solid-js';
import { splitProps } from 'solid-js';
import type { Component, ComponentProps } from "solid-js";
import { splitProps } from "solid-js";

import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";

import { cn } from '~/lib/utils';
import { cn } from "~/lib/utils";

const badgeVariants = cva('focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2', {
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent',
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent',
outline: 'text-foreground',
const badgeVariants = cva(
"focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/80 border-transparent",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent",
outline: "text-foreground"
}
},
},
defaultVariants: {
variant: 'default',
},
});
defaultVariants: {
variant: "default"
}
}
);

export interface BadgeProps extends ComponentProps<'div'>, VariantProps<typeof badgeVariants> {}
export interface BadgeProps extends ComponentProps<"div">, VariantProps<typeof badgeVariants> {}

const Badge: Component<BadgeProps> = (props) => {
const [, rest] = splitProps(props, ['variant', 'class']);
const Badge: Component<BadgeProps> = props => {
const [, rest] = splitProps(props, ["variant", "class"]);
return <div class={cn(badgeVariants({ variant: props.variant }), props.class)} {...rest} />;
};

Expand Down
70 changes: 40 additions & 30 deletions ui/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
import type { Component, ComponentProps } from 'solid-js';
import { splitProps } from 'solid-js';
import type { Component, ComponentProps } from "solid-js";
import { splitProps } from "solid-js";

import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";

import { cn } from '~/lib/utils';
import { cn } from "~/lib/utils";

const buttonVariants = cva('ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
outline: 'border-input hover:bg-accent hover:text-accent-foreground border',
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline',
const buttonVariants = cva(
"ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border-input hover:bg-accent hover:text-accent-foreground border",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10"
}
},
size: {
default: 'h-10 px-4 py-2',
sm: 'h-9 rounded-md px-3',
lg: 'h-11 rounded-md px-8',
icon: 'h-10 w-10',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
});
defaultVariants: {
variant: "default",
size: "default"
}
}
);

export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {}
export interface ButtonProps
extends ComponentProps<"button">,
VariantProps<typeof buttonVariants> {}

const Button: Component<ButtonProps> = (props) => {
const [, rest] = splitProps(props, ['variant', 'size', 'class']);
return <button class={cn(buttonVariants({ variant: props.variant, size: props.size }), props.class)} {...rest} />;
const Button: Component<ButtonProps> = props => {
const [, rest] = splitProps(props, ["variant", "size", "class"]);
return (
<button
class={cn(buttonVariants({ variant: props.variant, size: props.size }), props.class)}
{...rest}
/>
);
};

export { Button, buttonVariants };
Loading

0 comments on commit bcc89ee

Please sign in to comment.