mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 04:39:45 +00:00
исправила карточки новостей
This commit is contained in:
1 parent
586d3c64e8
commit
a600e91744
5 files changed
+88
-34
No files matched your search
@@ -12,6 +12,7 @@ import Slider from "@/widgets/Slider/Slider";
|
||||
export const vkWallUrl = "https://vk.com/skbkit?w=wall-172789021";
|
||||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { stripHtmlTags } from "@/shared/utils/sanitizeText";
|
||||
|
||||
export const ScrollToTop = () => {
|
||||
const { pathname } = useLocation();
|
||||
@@ -86,7 +87,7 @@ function NewsItem() {
|
||||
<meta name="robots" content="index,follow" />
|
||||
</Helmet>
|
||||
<PageHeader className="header">
|
||||
<h1>{news.heading}</h1>
|
||||
<h1>{stripHtmlTags(news.heading)}</h1>
|
||||
</PageHeader>
|
||||
<PageContent className="content" id="news-item-page">
|
||||
{news.photos.length !== 0 &&
|
||||
|
||||
@@ -80,15 +80,36 @@
|
||||
&__news {
|
||||
height: 250px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
|
||||
.slide_background {
|
||||
position: absolute;
|
||||
top: -10%;
|
||||
left: -10%;
|
||||
right: -10%;
|
||||
bottom: -10%;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
filter: blur(12px) brightness(0.9);
|
||||
transform: scale(1.05);
|
||||
z-index: 1;
|
||||
opacity: 0.8;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: filter 0.3s ease;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
transition: transform 0.3s ease;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.content {
|
||||
@@ -98,7 +119,16 @@
|
||||
right: 0;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
z-index: 2;
|
||||
z-index: 3;
|
||||
max-height: 60%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 4;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&::before {
|
||||
@@ -109,7 +139,7 @@
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
@@ -151,16 +181,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: filter 0.3s ease;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
||||
font-size: clamp(1.25rem, 1.0011rem + 0.5199vw, 1.625rem);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// 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";
|
||||
import { stripHtmlTags } from "@/shared/utils/sanitizeText";
|
||||
|
||||
interface CardProps {
|
||||
data: CardData & { variant?: "lab" | "news" | "project" };
|
||||
@@ -17,26 +17,36 @@ export const Card = ({ data }: CardProps) => {
|
||||
to={link || `/${id || name}`}
|
||||
>
|
||||
{preview ? (
|
||||
<img src={preview} alt={name} className={styles.image} />
|
||||
<>
|
||||
<div
|
||||
className={styles.slide_background}
|
||||
style={{ backgroundImage: `url(${preview})` }}
|
||||
/>
|
||||
|
||||
<img
|
||||
src={preview}
|
||||
alt={name}
|
||||
className={styles.image}
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
<div className={styles.content}>
|
||||
<h3 className={styles.title}>{stripHtmlTags(name)}</h3>
|
||||
{previewText && variant === "lab" && (
|
||||
<div className={styles.description}>
|
||||
<p>{previewText}</p>
|
||||
</div>
|
||||
)}
|
||||
{variant === "lab" && (
|
||||
<div className={styles.link}>
|
||||
<span>Перейти ⟶</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className={styles.placeholder} />
|
||||
)}
|
||||
|
||||
<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,4 @@
|
||||
export const stripHtmlTags = (html: string): string => {
|
||||
if (!html) return '';
|
||||
return html.replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim();
|
||||
};
|
||||
Reference in new issue
Block a user