headplane/app/components/Card.tsx

38 lines
898 B
TypeScript
Raw Normal View History

import React from 'react';
import Title from '~/components/Title';
2024-12-31 10:30:14 +05:30
import { cn } from '~/utils/cn';
2024-12-31 10:30:14 +05:30
function Text(props: React.HTMLProps<HTMLParagraphElement>) {
return (
2024-12-31 10:30:14 +05:30
<p {...props} className={cn('text-base leading-6 my-0', props.className)} />
);
}
type Props = React.HTMLProps<HTMLDivElement> & {
variant?: 'raised' | 'flat';
2024-12-31 10:30:14 +05:30
};
interface Props extends React.HTMLProps<HTMLDivElement> {
variant?: 'raised' | 'flat';
}
function Card({ variant = 'raised', ...props }: Props) {
return (
<div
2024-12-31 10:30:14 +05:30
{...props}
className={cn(
'w-full max-w-md overflow-hidden rounded-3xl p-5',
variant === 'flat'
? 'bg-transparent shadow-none'
: 'bg-headplane-50/50 dark:bg-headplane-950/50 shadow-sm',
'border border-headplane-100 dark:border-headplane-800',
2024-12-31 10:30:14 +05:30
props.className,
)}
>
2024-12-31 10:30:14 +05:30
{props.children}
</div>
2024-12-31 10:30:14 +05:30
);
}
2024-12-31 10:30:14 +05:30
export default Object.assign(Card, { Title, Text });