Skip to content

Commit 2294c31

Browse files
refactor(component): extract "Contribution CTA" to reusable component (#87)
### Description <!-- Please add PR description (don't leave blank) - example: This PR [adds/removes/fixes/replaces] the [feature/bug/etc] --> I extracted the "Contribution CTA" section from /editor/index.astro and /browse/[alpha]/[page].astro files into a standalone reusable component. ### Related Issue <!-- Please prefix the issue number with Fixes/Resolves - example: Fixes #123 or Resolves #123 --> fixes #69 ### Screenshots/Screencasts <!-- Please provide screenshots or video recording that demos your changes (especially if it's a visual change) --> ![screenshot (2)](https://github.com/user-attachments/assets/00dad5e2-9304-45dc-9e2b-b403d966b46a) ![screenshot (3)](https://github.com/user-attachments/assets/31d8e598-281a-4dfa-bb4e-d269f7e94c83) ![screenshot (4)](https://github.com/user-attachments/assets/1e93f038-29c7-4ac8-8003-11d23289d35d) ![screenshot (5)](https://github.com/user-attachments/assets/f7486ba9-e15c-457b-b801-b47ba5ce9273) ![screenshot](https://github.com/user-attachments/assets/876f2cfb-56d0-4485-b0f0-bd86bdf627db) ### Notes to Reviewer <!-- Please state here if you added a new npm packages, or any extra information that can help reviewer better review you changes --> --------- Co-authored-by: Olabode Lawal-Shittabey <babblebey@gmail.com>
1 parent 558ccad commit 2294c31

File tree

3 files changed

+23
-38
lines changed

3 files changed

+23
-38
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<section class="rounded-lg border shadow-sm">
2+
<div class="space-y-1.5 p-3 md:p-6 flex flex-col lg:flex-row lg:items-center justify-between gap-4">
3+
<div class="space-y-1">
4+
<h3 class="font-semibold tracking-tight text-2xl">Contribute Words</h3>
5+
<p class="text-sm">
6+
You can contribute new words to the jargons.dev dictionary.
7+
</p>
8+
</div>
9+
<a
10+
class="flex items-center w-fit justify-center no-underline px-4 py-2 rounded-md border border-gray-200 bg-white hover:bg-gray-100 text-sm shadow-sm hover:shadow transition-colors"
11+
href="/editor/new"
12+
>
13+
<span>Start Now</span>
14+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-4 h-4">
15+
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25" />
16+
</svg>
17+
</a>
18+
</div>
19+
</section>

src/pages/browse/[alpha]/[page].astro

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ALPHABETS } from "../../../../constants.js";
44
import BaseLayout from "../../../layouts/base.astro";
55
import Navbar from "../../../components/navbar.astro";
66
import Search from "../../../components/islands/search";
7+
import ContributionCTA from "../../../components/contribution-cta.astro";
78
89
const { page } = Astro.props;
910
const params = Astro.params;
@@ -55,25 +56,7 @@ export async function getStaticPaths({ paginate }) {
5556
<p>
5657
Looks like this alphabet is feeling a bit lonely! 🤔 Why not be the first to add a word and give it some company?
5758
</p>
58-
<section class="rounded-lg border shadow-sm">
59-
<div class="space-y-1.5 p-3 md:p-6 flex flex-col lg:flex-row lg:items-center justify-between gap-4">
60-
<div class="space-y-1">
61-
<h3 class="font-semibold tracking-tight text-2xl">Contribute Words</h3>
62-
<p class="text-sm">
63-
You can contribute new words to the jargons.dev dictionary.
64-
</p>
65-
</div>
66-
<a
67-
class="flex items-center w-fit justify-center no-underline px-4 py-2 rounded-md border border-gray-200 bg-white hover:bg-gray-100 text-sm shadow-sm hover:shadow transition-colors"
68-
href="/editor/new"
69-
>
70-
<span>Start Now</span>
71-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-4 h-4">
72-
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25" />
73-
</svg>
74-
</a>
75-
</div>
76-
</section>
59+
<ContributionCTA />
7760
</div>
7861
)}
7962
</div>

src/pages/editor/index.astro

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Navbar from "../../components/navbar.astro";
66
import { buildStatsUrl } from "../../lib/utils/index.js";
77
import { PROJECT_REPO_DETAILS } from "../../../constants.js";
88
import doContributionStats from "../../lib/actions/do-contribution-stats.js";
9+
import ContributionCTA from "../../components/contribution-cta.astro";
910
1011
const { url: { pathname }, redirect } = Astro;
1112
@@ -52,25 +53,7 @@ const totalWords = {
5253
</section>
5354

5455
<!-- Contribution CTA -->
55-
<section class="rounded-lg border shadow-sm">
56-
<div class="space-y-1.5 p-3 md:p-6 flex flex-col lg:flex-row lg:items-center justify-between gap-4">
57-
<div class="space-y-1">
58-
<h3 class="font-semibold tracking-tight text-2xl">Contribute Words</h3>
59-
<p class="text-sm">
60-
You can contribute new words to the jargons.dev dictionary.
61-
</p>
62-
</div>
63-
<a
64-
class="flex items-center w-fit justify-center no-underline px-4 py-2 rounded-md border border-gray-200 bg-white hover:bg-gray-100 text-sm shadow-sm hover:shadow transition-colors"
65-
href="/editor/new"
66-
>
67-
<span>Start Now</span>
68-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width={1.5} stroke="currentColor" class="w-4 h-4">
69-
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25" />
70-
</svg>
71-
</a>
72-
</div>
73-
</section>
56+
<ContributionCTA />
7457

7558
<!-- Contribution Stats -->
7659
<section class="">

0 commit comments

Comments
 (0)