aboutsummaryrefslogtreecommitdiff
path: root/components/anime/mobile/reused/infoChip.tsx
blob: 80ebf8399e4c8956c77078a012b30f9f02840538 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, { CSSProperties, FC } from "react";
import { getFormat } from "@/utils/getFormat";

interface Info {
  episodes?: number;
  averageScore?: number;
  format?: string;
  status?: string;
}

interface InfoChipProps {
  info: Info;
  color: any;
  className: string;
}

const InfoChip: FC<InfoChipProps> = ({ info, color, className }) => {
  return (
    <div
      className={`flex-wrap w-full justify-start md:pt-1 gap-4 ${className}`}
    >
      {info?.episodes && (
        <div
          className={`dynamic-text rounded-md px-2 font-karla font-bold`}
          style={color}
        >
          {info?.episodes} Episodes
        </div>
      )}
      {info?.averageScore && (
        <div
          className={`dynamic-text rounded-md px-2 font-karla font-bold`}
          style={color}
        >
          {info?.averageScore}%
        </div>
      )}
      {info?.format && (
        <div
          className={`dynamic-text rounded-md px-2 font-karla font-bold`}
          style={color}
        >
          {getFormat(info?.format)}
        </div>
      )}
      {info?.status && (
        <div
          className={`dynamic-text rounded-md px-2 font-karla font-bold`}
          style={color}
        >
          {info?.status}
        </div>
      )}
    </div>
  );
};

export default InfoChip;