From 3f76976d15f29b7922eebb033f8dab0ae731b855 Mon Sep 17 00:00:00 2001 From: Anna Tsybel Date: Tue, 26 May 2026 23:01:23 +0200 Subject: [PATCH] new-branding:remake blog images url --- new-branding/src/components/blog/ArticleCard/index.tsx | 7 ++----- new-branding/src/components/blog/Info/index.tsx | 4 +--- new-branding/src/lib/common.ts | 6 ------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/new-branding/src/components/blog/ArticleCard/index.tsx b/new-branding/src/components/blog/ArticleCard/index.tsx index ed38ac4..9b8dfbf 100644 --- a/new-branding/src/components/blog/ArticleCard/index.tsx +++ b/new-branding/src/components/blog/ArticleCard/index.tsx @@ -3,16 +3,13 @@ import Image from "next/image"; import "./index.scss"; import { Post } from "@/lib/axios/types"; import { formatPostDate } from "@/lib/date"; -import { getMediaUrl } from "@/lib/common"; export const ArticleCard: React.FC = ({ categoryLabel, source, title, date, thumbnail, sourceUrl, colorTheme }) => { - const thumbnailImage = getMediaUrl(thumbnail?.url); - return (
- {thumbnailImage ? ( - {title} + {thumbnail?.url ? ( + {title} ) : (
diff --git a/new-branding/src/components/blog/Info/index.tsx b/new-branding/src/components/blog/Info/index.tsx index ff5b298..9daf584 100644 --- a/new-branding/src/components/blog/Info/index.tsx +++ b/new-branding/src/components/blog/Info/index.tsx @@ -8,17 +8,15 @@ import { SkeletonWrapper } from "@/components/common/SkeletonWrapper"; import "react-loading-skeleton/dist/skeleton.css"; import { FeaturedNews } from "@/lib/axios/types"; import { formatPostDate } from "@/lib/date"; -import { getMediaUrl } from "@/lib/common"; import { useIsMobile } from "@/lib/hooks/useIsMobile"; export const BlogInfo: React.FC<{ isLoading: boolean; featured: FeaturedNews | undefined }> = ({ isLoading, featured }) => { const isMobile = useIsMobile(); - const thumbnailImage = getMediaUrl(featured?.thumbnail?.url); return (
- {thumbnailImage && preview image} + {featured?.thumbnail?.url && preview image}
diff --git a/new-branding/src/lib/common.ts b/new-branding/src/lib/common.ts index b47da90..88a17c3 100644 --- a/new-branding/src/lib/common.ts +++ b/new-branding/src/lib/common.ts @@ -9,10 +9,4 @@ export const copyToClipboard = async (text: string) => { export const wordpressUrl = new URL(process.env.CMS_API_URL || "http://localhost:3000"); -export const getMediaUrl = (url: string | null | undefined): string | null => { - if (!url) return null; - - return `${process.env.NEXT_PUBLIC_CMS_API_URL?.replace(/\/$/, "")}${url}`; -}; - export const formatLabel = (count: number, label: string) => (label?.trim() ? `${count} ${label.trim()}` : "");