Skip to content

Commit 8a2ab2f

Browse files
committed
Display no articles on blog yet
1 parent e986cda commit 8a2ab2f

File tree

3 files changed

+54
-90
lines changed

3 files changed

+54
-90
lines changed

src/assets/state/articles/2.tsx

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/assets/state/articles/index.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import IArticle from "./article";
22

3-
import article1 from "./1";
4-
import article2 from "./2";
5-
63
export default [
7-
{
8-
filename: "1",
9-
article: article1
10-
},
11-
{
12-
filename: "2",
13-
article: article2
14-
}
4+
155
] as { filename: string; article: IArticle }[];

src/pages/blog/index.tsx

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -95,56 +95,61 @@ const BlogPage: Page<BlogPageProps> = ({ articles, pathname }) => {
9595
<Heading.H1 id="blog" className="text-center text-secondary">
9696
Blog
9797
</Heading.H1>
98-
<div className="mx-0 sm:mx-16 md:mx-0 motion-safe:transition-[margin-inline] motion-safe:duration-500 flex gap-2 items-end">
99-
<div>
100-
<Label htmlFor="search-input" className="text-secondary">
101-
Search:
102-
</Label>
103-
<Input
104-
id="search-input"
105-
type="text"
106-
color="secondary"
107-
placeholder="Search..."
108-
{...register("search")}
109-
/>
110-
</div>
111-
<div>
112-
<Label htmlFor="sort-input" className="text-secondary">
113-
Sort:
114-
</Label>
115-
<ControlledSelect
116-
id="sort-input"
117-
name="sort"
118-
color="secondary"
119-
control={control}
120-
options={SORT_OPTIONS}
121-
getDisplayName={(opt) => opt.name}
122-
/>
123-
</div>
124-
125-
<AnimatePresence>
126-
{tags.length > 0 && <motion.div
127-
variants={fadeAnim}
128-
initial="in"
129-
animate="anim"
130-
exit="exit"
131-
>
132-
<LinkButton
133-
href="/blog"
98+
{computedArticles.length > 0 && <>
99+
<div className="mx-0 sm:mx-16 md:mx-0 motion-safe:transition-[margin-inline] motion-safe:duration-500 flex gap-2 items-end">
100+
<div>
101+
<Label htmlFor="search-input" className="text-secondary">
102+
Search:
103+
</Label>
104+
<Input
105+
id="search-input"
106+
type="text"
134107
color="secondary"
135-
className="w-fit"
108+
placeholder="Search..."
109+
{...register("search")}
110+
/>
111+
</div>
112+
<div>
113+
<Label htmlFor="sort-input" className="text-secondary">
114+
Sort:
115+
</Label>
116+
<ControlledSelect
117+
id="sort-input"
118+
name="sort"
119+
color="secondary"
120+
control={control}
121+
options={SORT_OPTIONS}
122+
getDisplayName={(opt) => opt.name}
123+
/>
124+
</div>
125+
126+
<AnimatePresence>
127+
{tags.length > 0 && <motion.div
128+
variants={fadeAnim}
129+
initial="in"
130+
animate="anim"
131+
exit="exit"
136132
>
137-
Clear Tags
138-
<TagIcon className="w-4 h-4" />
139-
</LinkButton>
140-
</motion.div>}
141-
</AnimatePresence>
142-
</div>
143-
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" aria-label="blog articles">
144-
<AnimatePresence>
145-
{computedArticles.map((brief) => <ArticleBrief key={brief.url} {...brief} />)}
146-
</AnimatePresence>
147-
</ul>
133+
<LinkButton
134+
href="/blog"
135+
color="secondary"
136+
className="w-fit"
137+
>
138+
Clear Tags
139+
<TagIcon className="w-4 h-4" />
140+
</LinkButton>
141+
</motion.div>}
142+
</AnimatePresence>
143+
</div>
144+
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" aria-label="blog articles">
145+
<AnimatePresence>
146+
{computedArticles.map((brief) => <ArticleBrief key={brief.url} {...brief} />)}
147+
</AnimatePresence>
148+
</ul>
149+
</>}
150+
{computedArticles.length < 1 && <p role="note" className="text-3xl font-semibold text-center">
151+
There are no blog posts yet! Stay tuned!
152+
</p>}
148153
</main>
149154
</>
150155
);

0 commit comments

Comments
 (0)