aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/Card.tsx
blob: fb29f728f89f02f7ff4e5a9d9c10ce85ed9d0fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { ComponentPropsWithoutRef, Ref } from "react";
import classNames from "classnames";

import { ThemeColor } from "./common";
import "./Card.css";

interface CardProps extends ComponentPropsWithoutRef<"div"> {
  containerRef?: Ref<HTMLDivElement>;
  color?: ThemeColor;
  noBackground?: boolean;
}

export default function Card({
  color,
  noBackground,
  className,
  children,
  containerRef,
  ...otherProps
}: CardProps) {
  return (
    <div
      ref={containerRef}
      className={classNames(
        "cru-card",
        `cru-card-${color ?? "primary"}`,
        noBackground && "cru-card-no-background",
        className,
      )}
      {...otherProps}
    >
      {children}
    </div>
  );
}