add success variant to shadcn components

This commit is contained in:
Shahrad Elahi 2023-11-07 23:13:20 +03:30
parent b230d20aef
commit 8c7c95840b
4 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,16 @@
<script lang="ts">
import { cn } from '$lib/utils';
export let content: string;
export let maxLength: number = Math.floor(content.length / 2);
export let rootClass: string | undefined = undefined;
let className: string | undefined = undefined;
export { className as class };
</script>
<span class={rootClass}>
{content.slice(0, maxLength)}
<span class={cn('text-gray-400', className)}> ... </span>
{content.slice(content.length - maxLength)}
</span>

View File

@ -0,0 +1,7 @@
import Root from './MiddleEllipsis.svelte';
export {
Root,
//
Root as MiddleEllipsis,
};

View File

@ -7,7 +7,7 @@ export const badgeVariants = tv({
variant: { variant: {
default: 'bg-primary hover:bg-primary/80 border-transparent text-primary-foreground', default: 'bg-primary hover:bg-primary/80 border-transparent text-primary-foreground',
secondary: 'bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground', secondary: 'bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground',
success: 'bg-success hover:bg-success/80 border-transparent text-success-foreground', success: 'bg-green-500 hover:bg-green-500/80 border-transparent text-white',
destructive: 'bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground', destructive: 'bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground',
outline: 'text-foreground', outline: 'text-foreground',
}, },

View File

@ -9,6 +9,8 @@ const buttonVariants = tv({
default: 'bg-primary text-primary-foreground hover:bg-primary/90', default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive: destructive:
'bg-destructive text-destructive-foreground hover:bg-destructive/90', 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
success:
'bg-green-500 text-white hover:bg-green-500/90 hover:text-gray-50',
outline: outline:
'border border-input bg-background hover:bg-accent hover:text-accent-foreground', 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
secondary: secondary: