Skip to content

Commit a947f4f

Browse files
committed
Refactor layout and feature cards for improved responsiveness; adjust padding and grid gaps for better alignment across components
1 parent aaa036d commit a947f4f

4 files changed

Lines changed: 31 additions & 21 deletions

File tree

app/components/feature-cards.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ const features = [
3333

3434
export function FeatureCards() {
3535
return (
36-
<section className="py-20">
37-
<div className="container">
38-
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
36+
<section className="py-12 sm:py-16 md:py-20">
37+
<div className="container px-3 sm:px-4 md:px-6">
38+
<div className="grid grid-cols-1 gap-4 sm:gap-6 md:gap-8 sm:grid-cols-2 lg:grid-cols-3">
3939
{features.map((feature) => (
4040
<div
4141
key={feature.title}
42-
className="group relative overflow-hidden rounded-lg border border-border/50 bg-card p-6 transition-all hover:border-border hover:shadow-md"
42+
className="group relative overflow-hidden rounded-lg border border-border/50 bg-card p-4 sm:p-6 transition-all hover:border-border hover:shadow-md"
4343
>
4444
<div
4545
className={cn(

app/components/layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ export function Layout({ children }: LayoutProps) {
1212
<ThemeProvider defaultTheme="system">
1313
<div className={cn('min-h-screen bg-background font-sans antialiased')}>
1414
<Header />
15-
<main className={cn('container mx-auto px-4 py-8 md:px-6 lg:px-8')}>
15+
<main
16+
className={cn(
17+
'container mx-auto px-3 py-6 sm:px-4 md:px-6 lg:px-8 md:py-8',
18+
)}
19+
>
1620
{children}
1721
</main>
1822
<Footer />

app/routes/articles.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,42 +61,46 @@ export default function Articles() {
6161
<Layout>
6262
<div className={cn('container mx-auto max-w-7xl')}>
6363
{/* Header Section */}
64-
<div className={cn('mb-8')}>
65-
<h1 className={cn('mb-4 text-4xl font-bold')}>Articles</h1>
66-
<p className={cn('text-lg text-muted-foreground')}>
64+
<div className={cn('mb-6 md:mb-8')}>
65+
<h1 className={cn('mb-2 md:mb-4 text-2xl md:text-4xl font-bold')}>
66+
Articles
67+
</h1>
68+
<p className={cn('text-base md:text-lg text-muted-foreground')}>
6769
Discover insightful articles from our community of frontend
6870
developers.
6971
</p>
7072
</div>
7173

7274
{/* Search and Filter Section */}
73-
<div className={cn('mb-8 flex flex-wrap items-center gap-4')}>
75+
<div className={cn('mb-6 md:mb-8 flex flex-wrap items-center gap-4')}>
7476
<Form
75-
className={cn('relative flex flex-1 gap-2')}
77+
className={cn('relative flex w-full gap-2')}
7678
onSubmit={handleSubmit}
7779
>
7880
<div className={cn('relative flex-1')}>
7981
<Search
8082
className={cn(
81-
'absolute left-3 top-2.5 h-5 w-5 text-muted-foreground',
83+
'absolute left-3 top-2.5 h-4 w-4 text-muted-foreground',
8284
)}
8385
/>
8486
<Input
8587
type="search"
8688
name="q"
8789
placeholder="Search articles..."
88-
className={cn('pl-10')}
90+
className={cn('pl-9 h-10')}
8991
defaultValue={searchParams.get('q') || ''}
9092
/>
9193
</div>
92-
<Button type="submit" variant="outline">
94+
<Button type="submit" variant="outline" size="sm">
9395
Search
9496
</Button>
9597
</Form>
9698
</div>
9799

98100
{/* Articles Grid */}
99-
<div className={cn('grid gap-6 md:grid-cols-2 lg:grid-cols-3')}>
101+
<div
102+
className={cn('grid gap-4 sm:gap-6 md:grid-cols-2 lg:grid-cols-3')}
103+
>
100104
{articles.map((article) => (
101105
<a
102106
key={article.id}
@@ -112,7 +116,7 @@ export default function Articles() {
112116
>
113117
<div
114118
className={cn(
115-
'relative aspect-video w-full overflow-hidden rounded-t-lg',
119+
'relative aspect-[2/1] w-full overflow-hidden rounded-t-lg',
116120
)}
117121
>
118122
<img
@@ -124,13 +128,15 @@ export default function Articles() {
124128
loading="lazy"
125129
/>
126130
</div>
127-
<div className={cn('flex flex-col p-6')}>
128-
<div className={cn('mb-4 flex items-center gap-2')}>
131+
<div className={cn('flex flex-col p-3 sm:p-4')}>
132+
<div
133+
className={cn('mb-2 flex flex-wrap items-center gap-1.5')}
134+
>
129135
{article.tags.map((tag) => (
130136
<span
131137
key={tag}
132138
className={cn(
133-
'rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary',
139+
'rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary',
134140
)}
135141
>
136142
{tag}
@@ -139,14 +145,14 @@ export default function Articles() {
139145
</div>
140146
<h2
141147
className={cn(
142-
'mb-2 text-xl font-semibold group-hover:text-primary',
148+
'mb-2 text-lg md:text-xl font-semibold group-hover:text-primary line-clamp-2',
143149
)}
144150
>
145151
{article.title}
146152
</h2>
147153
<p
148154
className={cn(
149-
'mb-4 flex-grow text-muted-foreground line-clamp-3',
155+
'mb-0 flex-grow text-sm text-muted-foreground line-clamp-2',
150156
)}
151157
>
152158
{article.description}

app/routes/jobs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export default function Jobs() {
435435
) : (
436436
<div
437437
className={cn(
438-
'grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
438+
'grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
439439
)}
440440
>
441441
{sortedJobs.map((job) => (

0 commit comments

Comments
 (0)