mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 03:39: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,173 @@
|
||||
.card {
|
||||
position: relative;
|
||||
display: block;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&__lab {
|
||||
height: 300px;
|
||||
border: 1px solid transparent;
|
||||
color: $text-secondary;
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
z-index: 2;
|
||||
transition: bottom 0.3s ease;
|
||||
}
|
||||
|
||||
.description {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
transition: max-height 0.3s ease, opacity 0.3s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.link {
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.image {
|
||||
filter: brightness(0.7);
|
||||
}
|
||||
|
||||
.content {
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
.description {
|
||||
max-height: 200px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.link {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__news {
|
||||
height: 250px;
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 12px 16px;
|
||||
color: white;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 40%;
|
||||
background: linear-gradient(
|
||||
to top,
|
||||
rgba(0, 0, 0, 0.6),
|
||||
rgba(0, 0, 0, 0)
|
||||
);
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__project {
|
||||
height: 250px;
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
left: 11px;
|
||||
bottom: 0;
|
||||
padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
|
||||
color: $text-card-project;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: filter 0.3s ease;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0 0 12px;
|
||||
font-size: clamp(1.25rem, 1.0011rem + 0.5199vw, 1.625rem);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.description {
|
||||
p {
|
||||
font-size: clamp(1rem, 0.8755rem + 0.26vw, 1.1875rem);
|
||||
line-height: 140%;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 5;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.link {
|
||||
font-size: clamp(12px, 1.5vw, 20px);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.card {
|
||||
height: 215px !important;
|
||||
|
||||
&--lab {
|
||||
.content {
|
||||
left: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.card__lab {
|
||||
&:hover {
|
||||
.title {
|
||||
font-size: 20px;
|
||||
@include mediaMax($mobile-max-widthGosBlock) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 22px;
|
||||
@include mediaMax($mobile-max-widthGosBlock) {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
p {
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
@include mediaMax($mobile-max-widthGosBlock) {
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link {
|
||||
font-size: 18px;
|
||||
@include mediaMax($mobile-max-widthGosBlock) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
// Тип для вариантов карточки
|
||||
|
||||
export interface CardData {
|
||||
id?: string; // Опционально, если используется name как уникальный идентификатор
|
||||
name: string; // Название лаборатории
|
||||
previewText: string; // Описание
|
||||
link: string; // Ссылка
|
||||
preview: string; // URL изображения
|
||||
variant?: "lab" | "news" | "project"; // Вариант карточки
|
||||
}
|
||||
// Пропсы компонента Card
|
||||
export interface CardProps {
|
||||
data: CardData;
|
||||
}
|
||||
Reference in new issue
Block a user