Equicord/src/components/Card.tsx
prism b7f6e23fff
update and add components (#691)
* update: switch

* add: notice

* update: link

* add: badge

* update heading

* update: basetext

* update: card

* fix: heading

* components-dev: fix

* lint

* update: margins
2026-01-27 09:21:12 -05:00

32 lines
1 KiB
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./Card.css";
import { classNameFactory } from "@utils/css";
import { classes } from "@utils/misc";
import { ComponentPropsWithRef } from "react";
const cl = classNameFactory("vc-card-");
export interface CardProps extends ComponentPropsWithRef<"div"> {
variant?: "primary" | "warning" | "danger" | "success" | "brand";
outline?: boolean;
/** Add a default padding of 1em to the card. This is implied if no className prop is passed */
defaultPadding?: boolean;
}
export function Card({ variant = "primary", outline = false, defaultPadding, children, className, ...restProps }: CardProps) {
const addDefaultPadding = defaultPadding != null
? defaultPadding
: !className;
return (
<div className={classes(cl("base", variant, outline && "outline", addDefaultPadding && "defaultPadding"), className)} {...restProps}>
{children}
</div>
);
}