aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/components/clients/Clients.tsx
blob: 199794e12ae3f6dbf0fc974181154f224f17122c (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
59
60
61
import React from "react";
import cn from "classnames";
import { users } from "./users";
import { Logo } from "./Logo";

export function Clients({
  linked,
  staticWidth,
  companyList,
}: {
  linked?: boolean;
  staticWidth?: boolean;
  companyList?: string[];
}) {
  const showcaseDark = [];
  const showcaseLight = [];

  const LogoWrapper = ({ className, children }) => {
    if (!staticWidth) return children;
    return (
      <div
        className={cn(
          "w-48 lg:w-40 flex items-center justify-center",
          className
        )}
      >
        {children}
      </div>
    );
  };

  users
    .filter((i) => (companyList ? companyList.includes(i.caption) : true))
    .forEach((user) => {
      if (user.pinned) {
        showcaseDark.push(
          <LogoWrapper
            key={`${user.caption}-dark`}
            className="flex dark:hidden"
          >
            <Logo user={user} theme={"dark"} isLink={linked} />
          </LogoWrapper>
        );
        showcaseLight.push(
          <LogoWrapper
            key={`${user.caption}-light`}
            className="hidden dark:flex"
          >
            <Logo user={user} theme={"light"} isLink={linked} />
          </LogoWrapper>
        );
      }
    });

  return (
    <>
      {showcaseDark}
      {showcaseLight}
    </>
  );
}