mirror of
https://github.com/documenso/documenso.git
synced 2026-07-17 00:30:21 +10:00
b3ef92feb9
- Upgrade vite from v7 to v8 (Rolldown-based bundler) - Migrate server build from rollup to rolldown, eliminating 5 plugins (rolldown handles TS, JSX, JSON, CJS, and node resolution natively) - Replace vite-plugin-babel-macros with targeted lingui macro plugin that skips files without macro imports (~90% of files) - Replace vite-tsconfig-paths with native resolve.tsconfigPaths - Remove redundant lingui error-reporter plugin (51% of plugin time) - Narrow optimizeDeps.entries from ~1060 to ~460 files - Move typecheck out of build into separate CI job (43s -> 24s build) - Fix card.tsx var() typo exposed by LightningCSS - Remove 30 unused packages (rollup, babel presets, rollup plugins, etc.) - Add vite override for peer dep compatibility - Patch @lingui/vite-plugin with moduleType for Rolldown compat
101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
import * as React from 'react';
|
|
|
|
import { cn } from '../lib/utils';
|
|
|
|
export type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
spotlight?: boolean;
|
|
gradient?: boolean;
|
|
degrees?: number;
|
|
|
|
/**
|
|
* Not sure if this is needed, but added a toggle so it defaults to true since that was how it was before.
|
|
*
|
|
* This is required to be set false if you want drag drop to work within this element.
|
|
*/
|
|
backdropBlur?: boolean;
|
|
};
|
|
|
|
const Card = React.forwardRef<HTMLDivElement, CardProps>(
|
|
(
|
|
{ className, children, gradient = false, degrees = 120, backdropBlur = true, ...props },
|
|
ref,
|
|
) => {
|
|
return (
|
|
<div
|
|
ref={ref}
|
|
style={
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
{
|
|
'--card-gradient-degrees': `${degrees}deg`,
|
|
} as React.CSSProperties
|
|
}
|
|
className={cn(
|
|
'group relative rounded-lg border-2 bg-background text-foreground',
|
|
{
|
|
'backdrop-blur-[2px]': backdropBlur,
|
|
'gradient-border-mask before:pointer-events-none before:absolute before:-inset-[2px] before:rounded-lg before:p-[2px] before:[background:linear-gradient(var(--card-gradient-degrees),theme(colors.primary.DEFAULT/50%)_5%,theme(colors.border/80%)_30%)]':
|
|
gradient,
|
|
'dark:gradient-border-mask before:pointer-events-none before:absolute before:-inset-[2px] before:rounded-lg before:p-[2px] before:[background:linear-gradient(var(--card-gradient-degrees),theme(colors.primary.DEFAULT/70%)_5%,theme(colors.border/80%)_30%)]':
|
|
gradient,
|
|
'shadow-[0_0_0_4px_theme(colors.gray.100/70%),0_0_0_1px_theme(colors.gray.100/70%),0_0_0_0.5px_theme(colors.primary.DEFAULT/70%)]': true,
|
|
'dark:shadow-[0]': true,
|
|
},
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
},
|
|
);
|
|
|
|
Card.displayName = 'Card';
|
|
|
|
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
({ className, ...props }, ref) => (
|
|
<div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
|
|
),
|
|
);
|
|
|
|
CardHeader.displayName = 'CardHeader';
|
|
|
|
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
({ className, ...props }, ref) => (
|
|
<h3
|
|
ref={ref}
|
|
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
{...props}
|
|
/>
|
|
),
|
|
);
|
|
|
|
CardTitle.displayName = 'CardTitle';
|
|
|
|
const CardDescription = React.forwardRef<
|
|
HTMLParagraphElement,
|
|
React.HTMLAttributes<HTMLParagraphElement>
|
|
>(({ className, ...props }, ref) => (
|
|
<p ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
));
|
|
|
|
CardDescription.displayName = 'CardDescription';
|
|
|
|
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
({ className, ...props }, ref) => (
|
|
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
|
|
),
|
|
);
|
|
|
|
CardContent.displayName = 'CardContent';
|
|
|
|
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
({ className, ...props }, ref) => (
|
|
<div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
|
|
),
|
|
);
|
|
|
|
CardFooter.displayName = 'CardFooter';
|
|
|
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|