meshtastic/src/pages/showcase/_components/NetworkSection.tsx

68 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-01-19 04:41:44 -08:00
import React from "react";
2021-12-22 06:42:57 -08:00
2023-01-19 04:41:44 -08:00
import { Showcase } from "../../../utils/apiTypes";
import { Card, PlaceholderCard } from "./Card";
2021-12-22 06:42:57 -08:00
interface NetworkSectionProps {
title: string;
icon?: JSX.Element;
iconColor?: string;
networks?: Showcase[];
}
export const NetworkSection = ({
title,
icon,
iconColor,
2023-01-19 04:41:44 -08:00
networks
2021-12-22 06:42:57 -08:00
}: NetworkSectionProps): JSX.Element => {
return (
<div className="margin-top--lg container">
2021-12-22 06:42:57 -08:00
<div
className="margin-bottom--sm"
style={{
2023-01-19 04:41:44 -08:00
display: "flex",
alignItems: "center"
2021-12-22 06:42:57 -08:00
}}
>
<h2>{title}</h2>
{icon && (
<span
style={{
2023-01-19 04:41:44 -08:00
marginBottom: "0.5rem",
marginLeft: "0.5rem",
fontSize: "1.25rem",
lineHeight: "1.75rem",
color: iconColor
2021-12-22 06:42:57 -08:00
}}
>
{icon}
</span>
)}
</div>
<ul
style={{
2023-01-19 04:41:44 -08:00
position: "relative",
display: "grid",
gap: "1.5rem",
gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
paddingLeft: "0"
2021-12-22 06:42:57 -08:00
}}
>
{networks ? (
<>
{networks.map((network) => (
<Card key={network.title} network={network} />
))}
{networks.length === 0 && <h2>No result</h2>}
</>
) : (
2021-12-22 23:05:23 -08:00
<div>
<PlaceholderCard />
</div>
2021-12-22 06:42:57 -08:00
)}
</ul>
</div>
);
};