mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 05:29:45 +00:00
Пересобрал компоненты карточек и CardList, обновил импорты
This commit is contained in:
1 parent
26018016e1
commit
05f7a7a1d7
12 files changed
+194
-193
No files matched your search
@@ -0,0 +1,38 @@
|
||||
// widgets/Card/Card.tsx
|
||||
import { Link } from "react-router-dom";
|
||||
import styles from "./Card.module.scss";
|
||||
import { classNames } from "@/shared/lib/classNames/classNames";
|
||||
import type { CardData } from "@/widgets/CardList/types";
|
||||
|
||||
interface CardProps {
|
||||
data: CardData & { variant?: "lab" | "news" | "project" };
|
||||
}
|
||||
|
||||
export const Card = ({ data }: CardProps) => {
|
||||
const { id, name, previewText, preview, link, variant = "lab" } = data;
|
||||
|
||||
return (
|
||||
<Link
|
||||
className={classNames(styles.card, {}, [styles[`card__${variant}`]])}
|
||||
to={link || `/${id || name}`}
|
||||
>
|
||||
<img src={preview} alt={name} className={styles.image} />
|
||||
|
||||
<div className={styles.content}>
|
||||
<h3 className={styles.title}>{name}</h3>
|
||||
|
||||
{previewText && variant === "lab" && (
|
||||
<div className={styles.description}>
|
||||
<p>{previewText}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{variant === "lab" && (
|
||||
<div className={styles.link}>
|
||||
<span>Перейти ⟶</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user