feat: update breadcrumb component for improved slug display and enhance news detail page layout

This commit is contained in:
fredy.siswanto 2025-02-28 18:55:12 +07:00
parent 2b551aad28
commit 9b13733205
3 changed files with 14 additions and 14 deletions

View File

@ -7,14 +7,14 @@ type BreadcrumbProperty = {
export const Breadcrumb = (property: BreadcrumbProperty) => { export const Breadcrumb = (property: BreadcrumbProperty) => {
const { slug } = property const { slug } = property
return ( return (
<div className="flex items-center gap-2"> <div className="mb-5 flex items-center gap-2">
<Link to={'#'}>Blog</Link> <Link to={'#'}>Blog</Link>
<div>{'>'}</div> <div>{'>'}</div>
<Link <Link
to={'#'} to={'#'}
className="text-ellipsis md:text-clip ..." className="text-ellipsis md:text-clip ..."
> >
{slug} {slug.slice(0, 20) + '...'}
</Link> </Link>
</div> </div>
) )

View File

@ -35,7 +35,7 @@ export const CONTENT: TNewsDetail = {
author: 'John Doe', author: 'John Doe',
date: new Date(), date: new Date(),
categories: [], categories: [],
tags: ['Category', 'Popular'], tags: ['Category', 'Popular', 'Trending', 'Latest'],
} }
export const BERITA: TNews = { export const BERITA: TNews = {

View File

@ -2,7 +2,7 @@ import htmlParse from 'html-react-parser'
import { Breadcrumb } from '~/components/ui/breadcrumb' import { Breadcrumb } from '~/components/ui/breadcrumb'
import { Card } from '~/components/ui/card' import { Card } from '~/components/ui/card'
import { Carousel } from '~/components/ui/carousel' import { CarouselSection } from '~/components/ui/carousel-section'
import { IconsSocial } from '~/components/ui/social-share' import { IconsSocial } from '~/components/ui/social-share'
import { BERITA, CONTENT } from './data' import { BERITA, CONTENT } from './data'
@ -19,8 +19,8 @@ export const NewsDetailPage = () => {
</h2> </h2>
{/* next planing create component for this section */} {/* next planing create component for this section */}
<div className="my-5 flex w-full items-center justify-between align-middle"> <div className="my-5 w-full items-center justify-between gap-2 align-middle sm:flex">
<div className="flex items-center gap-2 align-middle"> <div className="mb-2 flex items-center gap-2 align-middle">
<img <img
src={'https://placehold.co/50x50.png'} src={'https://placehold.co/50x50.png'}
alt={title} alt={title}
@ -33,14 +33,14 @@ export const NewsDetailPage = () => {
</p> </p>
</div> </div>
</div> </div>
<IconsSocial className="ml-auto" /> <IconsSocial className="flex-row-reverse" />
</div> </div>
{/* end next planing create component for this section */} {/* end next planing create component for this section */}
<div className="w-full bg-amber-200"> <div className="w-full bg-amber-200">
<img <img
src={featured} src={featured}
alt={title} alt={title}
className="h-[600px] w-full object-cover object-center" className="w-full object-cover object-center sm:h-[600px]"
/> />
</div> </div>
@ -49,16 +49,16 @@ export const NewsDetailPage = () => {
{htmlParse(content)} {htmlParse(content)}
</article> </article>
</div> </div>
<div className="flex items-end justify-between border-b-3 border-b-gray-300 py-4"> <div className="items-end justify-between border-b-3 border-b-gray-300 py-4 sm:flex">
<div className="flex flex-col"> <div className="flex flex-col max-sm:mb-3">
<p className="mb-2">Share this post</p> <p className="mb-2">Share this post</p>
<IconsSocial className="a" /> <IconsSocial className="a" />
</div> </div>
<div className="flex flex-wrap items-end"> <div className="flex flex-wrap items-end gap-2">
{tags?.map((tag) => ( {tags?.map((tag) => (
<span <span
key={tag} key={tag}
className="mx-2 rounded bg-gray-300 p-1" className="rounded bg-gray-300 p-1"
> >
{tag} {tag}
</span> </span>
@ -80,8 +80,8 @@ export const NewsDetailPage = () => {
</div> </div>
</Card> </Card>
<Card> <Card className="hidden sm:block">
<Carousel {...BERITA} /> <CarouselSection {...BERITA} />
</Card> </Card>
</div> </div>
) )