Skip to content

Commit 85c85e7

Browse files
shaireznaorpeledwmertens
committed
feat: add omit signal class util
Co-authored-by: Naor Peled <[email protected]> Co-authored-by: Wout Mertens <[email protected]>
1 parent 3256cba commit 85c85e7

File tree

4 files changed

+30
-25
lines changed

4 files changed

+30
-25
lines changed

packages/kit-fluffy/src/components/button/button.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,25 @@ export const buttonVariants = cva(
5656
primary: 'bg-primary text-primary-foreground hover:bg-primary/90',
5757
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
5858
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
59-
link: 'text-primary underline-offset-4 hover:underline'
59+
link: 'text-primary underline-offset-4 hover:underline',
6060
},
6161
look: {
6262
ghost: 'hover:bg-accent hover:text-accent-foreground',
6363
outline:
64-
'border border-input bg-background hover:bg-accent hover:text-accent-foreground'
64+
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
6565
},
6666
size: {
6767
default: 'h-10 px-4 py-2',
6868
sm: 'h-9 rounded-md px-3',
6969
lg: 'h-11 rounded-md px-8',
70-
icon: 'h-10 w-10'
71-
}
70+
icon: 'h-10 w-10',
71+
},
7272
},
7373
defaultVariants: {
7474
intent: 'primary',
75-
size: 'default'
76-
}
77-
}
75+
size: 'default',
76+
},
77+
},
7878
);
7979

8080
export type ButtonProps = AddVariantPropsTo<'button', typeof buttonVariants>;

packages/kit-tailwind/src/components/button-group/button-group.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { component$, HTMLAttributes, Slot } from '@builder.io/qwik';
1+
import { HTMLAttributes, Slot, component$ } from '@builder.io/qwik';
22
import { ButtonGroup as HeadlessButtonGroup } from '@qwik-ui/headless';
3+
// eslint-disable-next-line @nx/enforce-module-boundaries
4+
import type { OmitSignalClass } from '../../../../shared/src/utils';
35

4-
export type ButtonGroupProps = HTMLAttributes<HTMLElement>;
6+
export type ButtonGroupProps = OmitSignalClass<HTMLAttributes<HTMLElement>>;
57

68
// TODO: discuss this
79

packages/kit-tailwind/src/components/button/button.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,22 @@ export const Button = component$((props: ButtonProps) => {
5050
return (
5151
<button
5252
{...rest}
53-
// class={[
54-
// 'btn',
55-
// variants[variant],
56-
// sizes[size],
57-
// {
58-
// [options.active]: active,
59-
// [options.outline]: outline,
60-
// [options.disabled]: disabled,
61-
// [options.glass]: glass,
62-
// [options.loading]: loading,
63-
// [options.noAnimation]: noAnimation,
64-
// [options.circle]: circle,
65-
// [options.square]: square,
66-
// },
67-
// classNames,
68-
// ]}
53+
class={[
54+
'btn',
55+
variants[variant],
56+
sizes[size],
57+
{
58+
[options.active]: active,
59+
[options.outline]: outline,
60+
[options.disabled]: disabled,
61+
[options.glass]: glass,
62+
[options.loading]: loading,
63+
[options.noAnimation]: noAnimation,
64+
[options.circle]: circle,
65+
[options.square]: square,
66+
},
67+
classNames,
68+
]}
6969
>
7070
<Slot />
7171
</button>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ClassList } from '@builder.io/qwik';
2+
3+
export type OmitSignalClass<T> = Omit<T, 'class'> & { class?: ClassList };

0 commit comments

Comments
 (0)