Skip to content

Commit

Permalink
chore: initial formatting fixes (#15)
Browse files Browse the repository at this point in the history
Initial formatting for everything
  • Loading branch information
BlankParticle authored Apr 7, 2024
1 parent f824953 commit 509beb4
Show file tree
Hide file tree
Showing 41 changed files with 578 additions and 563 deletions.
2 changes: 1 addition & 1 deletion apps/mailtools/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"utils": "@lib/utils"
},
"typescript": true
}
}
23 changes: 11 additions & 12 deletions apps/mailtools/src/components/ui/badge/badge.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<script lang="ts">
import { cn } from "@lib/utils.js";
import { badgeVariants, type Variant } from "./index.js";
import { cn } from '@lib/utils.js';
import { badgeVariants, type Variant } from './index.js';
let className: string | undefined | null = undefined;
export let href: string | undefined = undefined;
export let variant: Variant = "default";
export { className as class };
let className: string | undefined | null = undefined;
export let href: string | undefined = undefined;
export let variant: Variant = 'default';
export { className as class };
</script>

<svelte:element
this={href ? "a" : "span"}
{href}
class={cn(badgeVariants({ variant, className }))}
{...$$restProps}
>
<slot />
this={href ? 'a' : 'span'}
{href}
class={cn(badgeVariants({ variant, className }))}
{...$$restProps}>
<slot />
</svelte:element>
35 changes: 18 additions & 17 deletions apps/mailtools/src/components/ui/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { tv, type VariantProps } from "tailwind-variants";
export { default as Badge } from "./badge.svelte";
import { tv, type VariantProps } from 'tailwind-variants';
export { default as Badge } from './badge.svelte';

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

export type Variant = VariantProps<typeof badgeVariants>["variant"];
export type Variant = VariantProps<typeof badgeVariants>['variant'];
35 changes: 17 additions & 18 deletions apps/mailtools/src/components/ui/button/button.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<script lang="ts">
import { Button as ButtonPrimitive } from "bits-ui";
import { cn } from "@lib/utils.js";
import { buttonVariants, type Props, type Events } from "./index.js";
import { Button as ButtonPrimitive } from 'bits-ui';
import { cn } from '@lib/utils.js';
import { buttonVariants, type Props, type Events } from './index.js';
type $$Props = Props;
type $$Events = Events;
type $$Props = Props;
type $$Events = Events;
let className: $$Props["class"] = undefined;
export let variant: $$Props["variant"] = "default";
export let size: $$Props["size"] = "default";
export let builders: $$Props["builders"] = [];
export { className as class };
let className: $$Props['class'] = undefined;
export let variant: $$Props['variant'] = 'default';
export let size: $$Props['size'] = 'default';
export let builders: $$Props['builders'] = [];
export { className as class };
</script>

<ButtonPrimitive.Root
{builders}
class={cn(buttonVariants({ variant, size, className }))}
type="button"
{...$$restProps}
on:click
on:keydown
>
<slot />
{builders}
class={cn(buttonVariants({ variant, size, className }))}
type="button"
{...$$restProps}
on:click
on:keydown>
<slot />
</ButtonPrimitive.Root>
75 changes: 38 additions & 37 deletions apps/mailtools/src/components/ui/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
import Root from "./button.svelte";
import { tv, type VariantProps } from "tailwind-variants";
import type { Button as ButtonPrimitive } from "bits-ui";
import Root from './button.svelte';
import { tv, type VariantProps } from 'tailwind-variants';
import type { Button as ButtonPrimitive } from 'bits-ui';

const buttonVariants = tv({
base: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring 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 border-input bg-background hover:bg-accent hover:text-accent-foreground",
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",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
base: 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring 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 border-input bg-background hover:bg-accent hover:text-accent-foreground',
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'
}
},
defaultVariants: {
variant: 'default',
size: 'default'
}
});

type Variant = VariantProps<typeof buttonVariants>["variant"];
type Size = VariantProps<typeof buttonVariants>["size"];
type Variant = VariantProps<typeof buttonVariants>['variant'];
type Size = VariantProps<typeof buttonVariants>['size'];

type Props = ButtonPrimitive.Props & {
variant?: Variant;
size?: Size;
variant?: Variant;
size?: Size;
};

type Events = ButtonPrimitive.Events;

export {
Root,
type Props,
type Events,
//
Root as Button,
type Props as ButtonProps,
type Events as ButtonEvents,
buttonVariants,
Root,
type Props,
type Events,
//
Root as Button,
type Props as ButtonProps,
type Events as ButtonEvents,
buttonVariants
};
16 changes: 9 additions & 7 deletions apps/mailtools/src/components/ui/card/card-content.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts">
import { cn } from "@lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from '@lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
type $$Props = HTMLAttributes<HTMLDivElement>;
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
let className: $$Props['class'] = undefined;
export { className as class };
</script>

<div class={cn("p-6 pt-0", className)} {...$$restProps}>
<slot />
<div
class={cn('p-6 pt-0', className)}
{...$$restProps}>
<slot />
</div>
16 changes: 9 additions & 7 deletions apps/mailtools/src/components/ui/card/card-description.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "@lib/utils.js";
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
type $$Props = HTMLAttributes<HTMLParagraphElement>;
type $$Props = HTMLAttributes<HTMLParagraphElement>;
let className: $$Props["class"] = undefined;
export { className as class };
let className: $$Props['class'] = undefined;
export { className as class };
</script>

<p class={cn("text-sm text-muted-foreground", className)} {...$$restProps}>
<slot />
<p
class={cn('text-muted-foreground text-sm', className)}
{...$$restProps}>
<slot />
</p>
16 changes: 9 additions & 7 deletions apps/mailtools/src/components/ui/card/card-footer.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "@lib/utils.js";
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
type $$Props = HTMLAttributes<HTMLDivElement>;
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
let className: $$Props['class'] = undefined;
export { className as class };
</script>

<div class={cn("flex items-center p-6 pt-0", className)} {...$$restProps}>
<slot />
<div
class={cn('flex items-center p-6 pt-0', className)}
{...$$restProps}>
<slot />
</div>
16 changes: 9 additions & 7 deletions apps/mailtools/src/components/ui/card/card-header.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "@lib/utils.js";
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
type $$Props = HTMLAttributes<HTMLDivElement>;
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
let className: $$Props['class'] = undefined;
export { className as class };
</script>

<div class={cn("flex flex-col space-y-1.5 p-6", className)} {...$$restProps}>
<slot />
<div
class={cn('flex flex-col space-y-1.5 p-6', className)}
{...$$restProps}>
<slot />
</div>
27 changes: 13 additions & 14 deletions apps/mailtools/src/components/ui/card/card-title.svelte
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "@lib/utils.js";
import type { HeadingLevel } from "./index.js";
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import type { HeadingLevel } from './index.js';
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
tag?: HeadingLevel;
};
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
tag?: HeadingLevel;
};
let className: $$Props["class"] = undefined;
export let tag: $$Props["tag"] = "h3";
export { className as class };
let className: $$Props['class'] = undefined;
export let tag: $$Props['tag'] = 'h3';
export { className as class };
</script>

<svelte:element
this={tag}
class={cn("text-lg font-semibold leading-none tracking-tight", className)}
{...$$restProps}
>
<slot />
this={tag}
class={cn('text-lg font-semibold leading-none tracking-tight', className)}
{...$$restProps}>
<slot />
</svelte:element>
20 changes: 11 additions & 9 deletions apps/mailtools/src/components/ui/card/card.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "@lib/utils.js";
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
type $$Props = HTMLAttributes<HTMLDivElement>;
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
let className: $$Props['class'] = undefined;
export { className as class };
</script>

<div
class={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
{...$$restProps}
>
<slot />
class={cn(
'bg-card text-card-foreground rounded-lg border shadow-sm',
className
)}
{...$$restProps}>
<slot />
</div>
Loading

0 comments on commit 509beb4

Please sign in to comment.