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

98 lines
2.1 KiB
TypeScript
Raw Normal View History

2021-11-30 02:46:31 -08:00
import React from 'react';
import Image from '@theme/IdealImage';
2021-12-22 06:42:57 -08:00
import { Showcase } from '../../../utils/apiTypes';
import { mapUrl } from '../../../utils/map';
import { CardTags } from './CardTags';
2021-11-30 02:46:31 -08:00
2021-12-22 06:42:57 -08:00
export interface CardProps {
network: Showcase;
2021-11-30 02:46:31 -08:00
}
2021-12-22 06:42:57 -08:00
export const Card = React.memo(({ network }: CardProps) => (
<div className="card">
<div className="card__image">
<Image img={mapUrl(network.nodes ?? [])} alt={network.title} />
</div>
<div className="card__body">
<h4>{network.title}</h4>
<small>{network.summary}</small>
</div>
<div className="card__footer">
<a
href={`?id=${network.id}`}
className="button button--primary button--block"
style={{ marginBottom: "0.5rem" }}
>
2021-12-22 22:22:01 -08:00
Read more
2021-12-22 06:42:57 -08:00
</a>
<CardTags tags={network.tags} />
2021-11-30 02:46:31 -08:00
</div>
2021-12-22 06:42:57 -08:00
</div>
));
2021-12-22 23:05:23 -08:00
export const PlaceholderCard = (): JSX.Element => (
<div
className="card"
style={{
animation: "pulse 2s infinite",
transform: "scale(1)",
}}
>
<div className="card__image">
<div
style={{
height: "150px",
}}
/>
</div>
<div className="card__body">
<div
style={{
width: "30%",
height: "2rem",
borderRadius: "0.4rem",
backgroundColor: "gray",
marginBottom: "1rem",
}}
/>
<div
style={{
width: "100%",
height: "1rem",
borderRadius: "0.4rem",
backgroundColor: "gray",
marginBottom: "0.5rem",
}}
/>
<div
style={{
width: "100%",
height: "1rem",
borderRadius: "0.4rem",
backgroundColor: "gray",
}}
/>
</div>
<div className="card__footer">
<a
className="button disabled button--primary button--block"
style={{ marginBottom: "0.5rem" }}
>
&nbsp;
</a>
<div>
<div
style={{
width: "4rem",
height: "1.5rem",
borderRadius: "0.4rem",
backgroundColor: "gray",
}}
/>
</div>
</div>
</div>
);