Skip to content

Commit 720887c

Browse files
committed
refactor(multi): updated buttons for blog-detail page & layout as per design
1 parent ae31298 commit 720887c

File tree

7 files changed

+60
-22
lines changed

7 files changed

+60
-22
lines changed

src/components/blocks/hero-section/hero-section.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const HeroSection = ({ blogData }: { blogData: BlogPost[] }) => {
2424
Learn how to design, develop, launch, and grow digital products through practical knowledge and proven
2525
frameworks.
2626
</p>
27-
<form className='gap-3 py-1 max-sm:space-y-2 sm:flex sm:flex-row md:w-sm'>
27+
<form className='gap-3 py-1 max-sm:w-full max-sm:space-y-2 sm:flex sm:flex-row md:w-sm'>
2828
<Input type='email' placeholder='Your email' className='bg-background h-10 flex-1 text-base' />
2929
<Button size='lg' className='text-base max-sm:w-full' asChild type='submit'>
3030
<a href='#'>Subscribe</a>
@@ -34,18 +34,18 @@ const HeroSection = ({ blogData }: { blogData: BlogPost[] }) => {
3434

3535
<div className='grid grid-cols-1 gap-6 sm:grid-cols-2'>
3636
{featuredPosts.map((item, index) => (
37-
<a href={`/blog/${item.slug}`} key={`${item.author}-${index}`} className='group'>
38-
<Card className='cursor-pointer py-0 shadow-none'>
37+
<div key={`${item.author}-${index}`} className='group'>
38+
<Card className='cursor-default py-0 shadow-none'>
3939
<CardContent className='grid grid-cols-1 px-0 xl:grid-cols-2'>
4040
<div className='p-6'>
41-
<div className='h-59.5 w-full overflow-hidden rounded-lg'>
41+
<a href={`/blog/${item.slug}`} className='block h-59.5 w-full overflow-hidden rounded-lg'>
4242
<img
4343
src={item.imageUrl}
4444
alt={item.imageAlt}
4545
className='w-full object-cover transition-transform duration-300 group-hover:scale-105'
4646
loading='lazy'
4747
/>
48-
</div>
48+
</a>
4949
</div>
5050
<div className='flex flex-col justify-center gap-3 p-6'>
5151
<div className='flex items-center gap-1.5 py-1'>
@@ -58,27 +58,33 @@ const HeroSection = ({ blogData }: { blogData: BlogPost[] }) => {
5858
onClick={e => {
5959
e.preventDefault()
6060
e.stopPropagation()
61+
window.location.href = `/#category-${item.category}`
6162
}}
6263
>
6364
{item.category}
6465
</Badge>
6566
</div>
66-
<h3 className='text-xl font-medium'>{item.title}</h3>
67+
<a href={`/blog/${item.slug}`}>
68+
<h3 className='text-xl font-medium'>{item.title}</h3>
69+
</a>
6770

6871
<p className='text-muted-foreground'>{item.description}</p>
6972
<div className='flex w-full items-center justify-between gap-1 py-1'>
7073
<span className='cursor-pointer text-sm font-medium'>{item.author}</span>
7174
<Button
7275
size='icon'
7376
className='group-hover:bg-primary! bg-background text-foreground hover:bg-primary! hover:text-primary-foreground group-hover:text-primary-foreground border group-hover:border-transparent hover:border-transparent'
77+
asChild
7478
>
75-
<ArrowUpRightIcon />
79+
<a href={`/blog/${item.slug}`}>
80+
<ArrowUpRightIcon />
81+
</a>
7682
</Button>
7783
</div>
7884
</div>
7985
</CardContent>
8086
</Card>
81-
</a>
87+
</div>
8288
))}
8389
</div>
8490
</div>

src/components/layout/footer.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,37 @@ const Footer = () => {
1414
</div>
1515
</a>
1616
<div className='flex flex-wrap items-center justify-center gap-x-3 gap-y-2 whitespace-nowrap sm:gap-5'>
17-
<a href='#' className='opacity-80 transition-opacity duration-300 hover:opacity-100'>
17+
<a
18+
href='#'
19+
className='text-muted-foreground hover:text-foreground opacity-80 transition-opacity duration-300 hover:opacity-100'
20+
>
1821
Support
1922
</a>
20-
<a href='#' className='opacity-80 transition-opacity duration-300 hover:opacity-100'>
23+
<a
24+
href='#'
25+
className='text-muted-foreground hover:text-foreground opacity-80 transition-opacity duration-300 hover:opacity-100'
26+
>
2127
Terms & Conditions
2228
</a>
23-
<a href='#' className='opacity-80 transition-opacity duration-300 hover:opacity-100'>
29+
<a
30+
href='#'
31+
className='text-muted-foreground hover:text-foreground opacity-80 transition-opacity duration-300 hover:opacity-100'
32+
>
2433
Privacy Policy
2534
</a>
2635
</div>
2736

2837
<div className='flex items-center gap-4'>
29-
<a href='#'>
38+
<a href='#' className='text-muted-foreground hover:text-foreground'>
3039
<FacebookIcon className='size-5' />
3140
</a>
32-
<a href='#'>
41+
<a href='#' className='text-muted-foreground hover:text-foreground'>
3342
<InstagramIcon className='size-5' />
3443
</a>
35-
<a href='#'>
44+
<a href='#' className='text-muted-foreground hover:text-foreground'>
3645
<TwitterIcon className='size-5' />
3746
</a>
38-
<a href='#'>
47+
<a href='#' className='text-muted-foreground hover:text-foreground'>
3948
<YoutubeIcon className='size-5' />
4049
</a>
4150
</div>

src/components/layout/header.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ const Header = ({ navigationData, className }: HeaderProps) => {
4040

4141
useEffect(() => {
4242
const handleScroll = () => {
43+
// Only handle scroll-based active section on the home page
44+
const path = window.location.pathname
45+
46+
if (path !== '/') {
47+
return
48+
}
49+
4350
const sections = document.querySelectorAll('section[id]')
4451
const scrollPosition = window.scrollY + window.innerHeight / 2
4552

@@ -76,7 +83,9 @@ const Header = ({ navigationData, className }: HeaderProps) => {
7683
if (path === '/' || path === '/#home') {
7784
setActiveSection('home')
7885
} else if (path.startsWith('/blog/')) {
79-
setActiveSection('blog')
86+
setActiveSection('') // Don't show any active state on blog post pages
87+
} else if (path.startsWith('/contact')) {
88+
setActiveSection('') // Don't show any active state on contact page
8089
} else {
8190
setActiveSection('') // Default case for other routes
8291
}

src/components/ui/navigation-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof
4444
}
4545

4646
const navigationMenuTriggerStyle = cva(
47-
'group bg-background hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50'
47+
'group bg-background hover:bg-accent hover:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50'
4848
)
4949

5050
function NavigationMenuTrigger({
@@ -104,7 +104,7 @@ function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof
104104
<NavigationMenuPrimitive.Link
105105
data-slot='navigation-menu-link'
106106
className={cn(
107-
"data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
107+
"data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
108108
className
109109
)}
110110
{...props}

src/content/blog/ai-driven-workflows.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ imageAlt: 'AI development tools'
88
pubDate: 'April 20, 2025'
99
author: 'Allen Reilly'
1010
avatarUrl: '/images/avatars/1.webp'
11-
category: 'UI'
11+
category: 'Design'
1212
readTime: 6
1313
featured: true
1414
---

src/content/blog/scalable-code.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: 'Architecture practices for building maintainable code that adapts
66
imageUrl: '/images/blog-post/post-8.webp'
77
imageAlt: 'Code architecture diagram'
88
pubDate: 'March 03, 2025'
9-
category: 'Coding'
9+
category: 'Product'
1010
author: 'Sara Wilkerson'
1111
avatarUrl: '/images/avatars/8.webp'
1212
readTime: 8

src/pages/blog/[slug].astro

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,23 @@ const schema = {
159159
<!-- Post Navigation -->
160160
<div class='flex w-full justify-between pt-8'>
161161
{
162-
previousPost && (
162+
previousPost ? (
163163
<a href={`/blog/${previousPost.id}`}>
164164
<Button className='rounded-xl' variant='outline'>
165165
<ChevronLeftIcon className='size-4' />
166166
Previous Post
167167
</Button>
168168
</a>
169+
) : (
170+
<Button className='rounded-xl' variant='outline' disabled>
171+
<ChevronLeftIcon className='size-4' />
172+
Previous Post
173+
</Button>
169174
)
170175
}
171176

172177
{
173-
nextPost && (
178+
nextPost ? (
174179
<a class='ms-auto' href={`/blog/${nextPost.id}`}>
175180
<Button
176181
className='rounded-xl bg-sky-600/10 text-sky-600 hover:bg-sky-600/20 focus-visible:ring-sky-600/20 dark:bg-sky-400/10 dark:text-sky-400 dark:hover:bg-sky-400/20 dark:focus-visible:ring-sky-400/40'
@@ -180,6 +185,15 @@ const schema = {
180185
<ChevronRightIcon className='size-4' />
181186
</Button>
182187
</a>
188+
) : (
189+
<Button
190+
className='ml-auto rounded-xl bg-sky-600/10 text-sky-600 hover:bg-sky-600/20 focus-visible:ring-sky-600/20 dark:bg-sky-400/10 dark:text-sky-400 dark:hover:bg-sky-400/20 dark:focus-visible:ring-sky-400/40'
191+
variant='outline'
192+
disabled
193+
>
194+
Next Post
195+
<ChevronRightIcon className='size-4' />
196+
</Button>
183197
)
184198
}
185199
</div>

0 commit comments

Comments
 (0)