-
Notifications
You must be signed in to change notification settings - Fork 2
Migrate from flowbite to Shadcn ui components slg 55 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
aryadhruv
wants to merge
6
commits into
main
Choose a base branch
from
migrate-button-component-slg-55
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a1d3dbc
Init Shadcn ui components
aryadhruv 7c243b0
formatting d'oh !
aryadhruv 13e2818
Merge branch 'main' into migrate-button-component-slg-55
dokterbob afca113
Extend tailwind css to support sdhcdn during migration
aryadhruv 1961e34
Added Semantic foreground colors for text
aryadhruv 0dc7573
Migrate button component slg 55 (#136)
aryadhruv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,16 @@ | ||
| { | ||
| "$schema": "https://shadcn-svelte.com/schema.json", | ||
| "tailwind": { | ||
| "css": "src/app.css", | ||
| "baseColor": "gray" | ||
| }, | ||
| "aliases": { | ||
| "components": "$lib/components", | ||
| "utils": "$lib/utils", | ||
| "ui": "$lib/components/ui", | ||
| "hooks": "$lib/hooks", | ||
| "lib": "$lib" | ||
| }, | ||
| "typescript": true, | ||
| "registry": "https://shadcn-svelte.com/registry" | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| <script> | ||
| import { SignIn } from '@auth/sveltekit/components'; | ||
| import { Button } from 'flowbite-svelte'; | ||
| import { Button } from '$lib/components/ui/button'; | ||
| import { m } from '$lib/paraglide/messages.js'; | ||
| </script> | ||
|
|
||
| <SignIn provider="oidc"> | ||
| <Button slot="submitButton" size="sm" tag="span">{m.auth_sign_in()}</Button> | ||
| <Button variant="default" slot="submitButton" size="sm"> | ||
| {m.auth_sign_in()} | ||
| </Button> | ||
| </SignIn> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,82 @@ | ||
| <script lang="ts" module> | ||
| import { cn, type WithElementRef } from '$lib/utils.js'; | ||
| import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'; | ||
| import { type VariantProps, tv } from 'tailwind-variants'; | ||
|
|
||
| export const buttonVariants = tv({ | ||
| base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", | ||
| variants: { | ||
| variant: { | ||
| default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90', | ||
| destructive: | ||
| 'bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white', | ||
| outline: | ||
| 'bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border', | ||
| secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80', | ||
| ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50', | ||
| link: 'text-primary underline-offset-4 hover:underline' | ||
| }, | ||
| size: { | ||
| default: 'h-9 px-4 py-2 has-[>svg]:px-3', | ||
| sm: 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5', | ||
| lg: 'h-10 rounded-md px-6 has-[>svg]:px-4', | ||
| icon: 'size-9', | ||
| 'icon-sm': 'size-8', | ||
| 'icon-lg': 'size-10' | ||
| } | ||
| }, | ||
| defaultVariants: { | ||
| variant: 'default', | ||
| size: 'default' | ||
| } | ||
| }); | ||
|
|
||
| export type ButtonVariant = VariantProps<typeof buttonVariants>['variant']; | ||
| export type ButtonSize = VariantProps<typeof buttonVariants>['size']; | ||
|
|
||
| export type ButtonProps = WithElementRef<HTMLButtonAttributes> & | ||
| WithElementRef<HTMLAnchorAttributes> & { | ||
| variant?: ButtonVariant; | ||
| size?: ButtonSize; | ||
| }; | ||
| </script> | ||
|
|
||
| <script lang="ts"> | ||
| let { | ||
| class: className, | ||
| variant = 'default', | ||
| size = 'default', | ||
| ref = $bindable(null), | ||
| href = undefined, | ||
| type = 'button', | ||
| disabled, | ||
| children, | ||
| ...restProps | ||
| }: ButtonProps = $props(); | ||
| </script> | ||
|
|
||
| {#if href} | ||
| <a | ||
| bind:this={ref} | ||
| data-slot="button" | ||
| class={cn(buttonVariants({ variant, size }), className)} | ||
| href={disabled ? undefined : href} | ||
| aria-disabled={disabled} | ||
| role={disabled ? 'link' : undefined} | ||
| tabindex={disabled ? -1 : undefined} | ||
| {...restProps} | ||
| > | ||
| {@render children?.()} | ||
| </a> | ||
| {:else} | ||
| <button | ||
| bind:this={ref} | ||
| data-slot="button" | ||
| class={cn(buttonVariants({ variant, size }), className)} | ||
| {type} | ||
| {disabled} | ||
| {...restProps} | ||
| > | ||
| {@render children?.()} | ||
| </button> | ||
| {/if} |
This file contains hidden or 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,17 @@ | ||
| import Root, { | ||
| type ButtonProps, | ||
| type ButtonSize, | ||
| type ButtonVariant, | ||
| buttonVariants | ||
| } from './button.svelte'; | ||
|
|
||
| export { | ||
| Root, | ||
| type ButtonProps as Props, | ||
| // | ||
| Root as Button, | ||
| buttonVariants, | ||
| type ButtonProps, | ||
| type ButtonSize, | ||
| type ButtonVariant | ||
| }; |
This file contains hidden or 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 { clsx, type ClassValue } from 'clsx'; | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| export function cn(...inputs: ClassValue[]) { | ||
| return twMerge(clsx(inputs)); | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T; | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T; | ||
| export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>; | ||
| export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.