Skip to content

Commit

Permalink
refactor view more+rss+json into component
Browse files Browse the repository at this point in the history
  • Loading branch information
crowdozer committed Jan 13, 2024
1 parent b8aeed5 commit 9acab09
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/components/Homepage/BlogLinks.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import EmojiList from '../EmojiList.astro'
import ViewMore from '../ViewMore.astro'
const links: [string, string, Date][] = [
['Lorem ipsum dolor sit', '/blog/lorem', new Date()],
Expand Down Expand Up @@ -34,12 +35,5 @@ const links: [string, string, Date][] = [
}
</EmojiList>

<div class="flex flex-row justify-between">
<a href="/blog">view more</a>
<span>
<a href="/rss" class="text-green-500">rss</a>
{''}
<a href="/json" class="text-yellow-500">json</a>
</span>
</div>
<ViewMore urlbase="/blog" rss json text="view 14 more" />
</div>
5 changes: 2 additions & 3 deletions src/components/Homepage/EmploymentStatus.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ const lfw = 0
)
}
</div>
<div class="flex flex-row gap-2">
<a href="/contact">contact anyway</a>
</div>

<a href="/contact">contact anyway</a>

<script>
;(() => {
Expand Down
9 changes: 6 additions & 3 deletions src/components/LayoutHelpers/SidebarChangelog.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
import EmojiList from '../EmojiList.astro'
import ViewMore from '../ViewMore.astro'
---

<EmojiList emoji="🔧">
<li><a href="/" class="inline text-ellipsis">2024 01 01</a></li>
<li><a href="/" class="inline text-ellipsis">2023 12 31</a></li>
<li><a href="/" class="inline text-ellipsis">2023 12 30</a></li>
<li><a href="/git/1" class="inline text-ellipsis">2024 01 01</a></li>
<li><a href="/git/2" class="inline text-ellipsis">2023 12 31</a></li>
<li><a href="/git/3" class="inline text-ellipsis">2023 12 30</a></li>
</EmojiList>

<ViewMore urlbase="/git" rss json text="view 12 more" />
13 changes: 9 additions & 4 deletions src/components/LayoutHelpers/SidebarNews.astro
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
---
import EmojiList from '../EmojiList.astro'
import ViewMore from '../ViewMore.astro'
---

<EmojiList emoji="🗞️">
<li class="line-clamp-1">
<a href="/" class="inline text-ellipsis">Lorem ipsum, dolor sit</a>
<a href="/news/1" class="inline text-ellipsis">Lorem ipsum, dolor sit</a>
</li>
<li class="line-clamp-1">
<a href="/" class="inline text-ellipsis">Dolore, quasi minus! Perferendis</a
<a href="/news/2" class="inline text-ellipsis"
>Dolore, quasi minus! Perferendis</a
>
</li>
<li class="line-clamp-1">
<a href="/" class="inline text-ellipsis"
<a href="/news/3" class="inline text-ellipsis"
>Quam magni nisi error culpa quasi</a
>
</li>
<li class="line-clamp-1">
<a href="/" class="inline text-ellipsis">Aspernatur illo similique cumque</a
<a href="/news/4" class="inline text-ellipsis"
>Aspernatur illo similique cumque</a
>
</li>
</EmojiList>

<ViewMore urlbase="/news" rss json text="view 4 more" />
32 changes: 32 additions & 0 deletions src/components/ViewMore.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
interface Props {
urlbase: string
text: string
rss?: boolean
json?: boolean
}
const { urlbase, text, rss = false, json = false } = Astro.props
---

<div class="flex flex-row justify-between">
<a href={`${urlbase}`} class="">{text}</a>
<span>
{
rss && (
<a href={`${urlbase}/rss`} class="text-green-500">
rss
</a>
)
}
{
json && (
<>
{''}
<a href={`${urlbase}/json`} class="text-yellow-500">
json
</a>
</>
)
}
</span>
</div>
2 changes: 1 addition & 1 deletion src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ body {

/* Links */
a {
@apply inline-block underline transition-colors duration-100 ease-in-out;
@apply inline-block underline underline-offset-2 transition-colors duration-100 ease-in-out;
@apply visited:text-blue-300;
@apply hover:text-blue-500;
}
Expand Down

0 comments on commit 9acab09

Please sign in to comment.