feat: pre-existing local changes — fischerei, verband, modules, members, packages
Commits all remaining uncommitted local work: - apps/web: fischerei, verband, modules, members-cms, documents, newsletter, meetings, site-builder, courses, bookings, events, finance pages and components - apps/web: marketing page updates, layout, paths config, next.config.mjs, styles/makerkit.css - apps/web/i18n: documents, fischerei, marketing, verband (de+en) - packages/features: finance, fischerei, member-management, module-builder, newsletter, sitzungsprotokolle, verbandsverwaltung server APIs and components - packages/ui: button.tsx updates - pnpm-lock.yaml
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '#lib/utils';
|
||||
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
||||
import { type VariantProps, cva } from 'class-variance-authority';
|
||||
@@ -43,18 +45,52 @@ const buttonVariants = cva(
|
||||
},
|
||||
);
|
||||
|
||||
export interface ButtonProps
|
||||
extends ButtonPrimitive.Props, VariantProps<typeof buttonVariants> {
|
||||
/**
|
||||
* When true, the button will delegate rendering to its child element,
|
||||
* applying button styles to that child. Implemented via Base UI's `render` prop.
|
||||
*/
|
||||
asChild?: boolean;
|
||||
}
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant = 'default',
|
||||
size = 'default',
|
||||
asChild = false,
|
||||
children,
|
||||
...props
|
||||
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
||||
}: ButtonProps) {
|
||||
// When asChild is true, use Base UI's render prop to delegate to the child element
|
||||
const renderProp =
|
||||
asChild && React.isValidElement(children)
|
||||
? React.cloneElement(
|
||||
children as React.ReactElement<{ className?: string }>,
|
||||
{
|
||||
className: cn(
|
||||
buttonVariants({ variant, size, className }),
|
||||
(children as React.ReactElement<{ className?: string }>).props
|
||||
.className,
|
||||
),
|
||||
},
|
||||
)
|
||||
: undefined;
|
||||
|
||||
if (renderProp) {
|
||||
return (
|
||||
<ButtonPrimitive data-slot="button" render={renderProp} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ButtonPrimitive
|
||||
data-slot="button"
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
>
|
||||
{children}
|
||||
</ButtonPrimitive>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user