Skip to content

Commit 44ae175

Browse files
outsource section header
1 parent c1a5cfb commit 44ae175

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/components/feed/Feed.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
CarouselNext,
2020
CarouselPrevious,
2121
} from '@/components/ui/carousel'
22+
import { SectionHeader } from '@/components/ui/sectionheader'
2223
import { Skeleton } from '@/components/ui/skeleton'
2324
import { ContextContentLoaded } from '@/context/ContextContentLoaded'
2425
import { ContextTopTenPosts } from '@/context/ContextTopTenPosts'
@@ -70,9 +71,7 @@ const Feed = () => {
7071
>
7172
<div className="w-full flex flex-col items-center px-14 sm:px-16 py-6 bg-stone-400/60 rounded-lg shadow-md shadow-stone-500">
7273
<div className="w-full flex flex-col gap-4 max-w-3xl">
73-
<h2 className="self-start text-very-large font-semibold underline">
74-
Top 10 Posts of the Week
75-
</h2>
74+
<SectionHeader>Top 10 Posts of the Week</SectionHeader>
7675
<div className="w-full">
7776
<Carousel>
7877
<CarouselContent>
@@ -130,9 +129,7 @@ const Feed = () => {
130129
</div>
131130
{feedItems.length > 10 && (
132131
<div className="flex flex-col gap-4 lg:gap-6">
133-
<h2 className="self-start text-very-large font-semibold underline px-4">
134-
More Hot Posts
135-
</h2>
132+
<SectionHeader>More Hot Posts</SectionHeader>
136133
<div className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,448px),1fr))] grid-flow-row-dense w-full gap-4 lg:gap-6">
137134
{feedItems.slice(10).map((item) => (
138135
<Card key={item.id} className="gap-6">

src/components/quote/Quote.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useCallback, useContext, useState } from 'react'
2+
import { SectionHeader } from '@/components/ui/sectionheader'
23
import { ContextContentLoaded } from '@/context/ContextContentLoaded'
34
import { ContextQuote } from '@/context/ContextQuote'
45
import { QuoteType } from '@/types/types'
@@ -39,9 +40,7 @@ const Quote = () => {
3940
return (
4041
<section className="w-full max-w-7xl" ref={quoteRef}>
4142
<blockquote className="flex flex-col gap-2 sm:gap-4 text-center text-pretty bg-stone-100 text-stone-950 p-4 sm:p-8 lg:p-10 lg:px-12 my-6 lg:my-8">
42-
<h2 className="self-start text-very-large font-semibold underline">
43-
Quote of the Day
44-
</h2>
43+
<SectionHeader>Quote of the Day</SectionHeader>
4544
{quote ? (
4645
<div className="flex flex-col text-normal">
4746
<i>&quot;{quote.body}&quot;</i>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type SectionHeaderProps = {
2+
children: string
3+
}
4+
5+
export const SectionHeader = ({ children }: SectionHeaderProps) => {
6+
return (
7+
<h2 className="self-start text-very-large font-semibold underline">
8+
{children}
9+
</h2>
10+
)
11+
}

src/components/users/Users.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
CardHeader,
1515
CardTitle,
1616
} from '@/components/ui/card'
17+
import { SectionHeader } from '@/components/ui/sectionheader'
1718
import { Skeleton } from '@/components/ui/skeleton'
1819
import { ContextContentLoaded } from '@/context/ContextContentLoaded'
1920
import { ContextTopUsers } from '@/context/ContextTopUsers'
@@ -61,9 +62,7 @@ const Users = () => {
6162
>
6263
<div className="w-full flex flex-col items-center">
6364
<div className="w-full flex flex-col gap-0 sm:gap-4">
64-
<h2 className="text-very-large font-semibold text-zinc-50 underline">
65-
Most Active Users
66-
</h2>
65+
<SectionHeader>Most Active Users</SectionHeader>
6766
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 w-full">
6867
<div className="md:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4">
6968
{users.length > 0

0 commit comments

Comments
 (0)