Skip to content

Commit 66e40cd

Browse files
committed
📦 NEW: Contact buttons (Phone + Email)
1 parent 2080807 commit 66e40cd

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can see a demo of the project at [https://linktreefreeclone.yoandev.co/](htt
1818

1919
1. **Customize your general settings**
2020

21-
Open `src/config.ts` and edit the `SUBTITLE', 'TITLE' and 'TAGLINE' variables.
21+
Open `src/config.ts` and edit the `SUBTITLE`, `TITLE`, `TAGLINE`, `contact`, `phone` and `email` variables.
2222

2323
2. **Customize your links**
2424

src/components/Contact.astro

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
export interface Props {
3+
contact: string;
4+
phone: string;
5+
email: string;
6+
}
7+
8+
const { contact, phone, email } = Astro.props;
9+
---
10+
<div>
11+
<div
12+
class="mx-auto max-w-7xl py-12 px-4 text-center sm:px-6 lg:py-16 lg:px-8"
13+
>
14+
<h2 class="text-2xl font-bold tracking-tight text-indigo-300 sm:text-2xl">
15+
<span class="block">{contact}</span>
16+
</h2>
17+
<div class="mt-5 flex justify-center">
18+
<div class="inline-flex rounded-md shadow">
19+
<a
20+
href={"tel://"+phone}
21+
class="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-100 px-5 py-3 text-base font-medium text-indigo-700 hover:bg-indigo-200 shadow-md hover:shadow-xl"
22+
>☎️ Call me</a
23+
>
24+
</div>
25+
<div class="ml-3 inline-flex">
26+
<a
27+
href={"mailto://"+email}
28+
class="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-100 px-5 py-3 text-base font-medium text-indigo-700 hover:bg-indigo-200 shadow-md hover:shadow-xl"
29+
>📪 Email me</a
30+
>
31+
</div>
32+
</div>
33+
</div>
34+
</div>

src/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
export const SUBTITLE = "A free clone of LinkTree"
22
export const TITLE = "LinkTreeFreeClone"
3-
export const TAGLINE = "Make your own LinkTree page for free"
3+
export const TAGLINE = "Make your own LinkTree page for free"
4+
5+
// Contacts
6+
export const contact = "Keep in touch"
7+
export const phone = "+33600000000"
8+
export const email = "contact@yoandev.co"

src/pages/index.astro

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@ import Layout from "../layouts/Layout.astro";
33
import Header from "../components/Header.astro";
44
import Link from "../components/Link.astro";
55
import Footer from "../components/Footer.astro";
6+
import Contact from "../components/Contact.astro";
67
7-
import { SUBTITLE, TITLE, TAGLINE } from "../config";
8+
import {
9+
SUBTITLE,
10+
TITLE,
11+
TAGLINE,
12+
contact,
13+
phone,
14+
email
15+
} from "../config";
816
917
// fetch all Markdown files in the links directory
1018
const links = await Astro.glob("./links/*.md");
@@ -32,6 +40,12 @@ const links = await Astro.glob("./links/*.md");
3240
</div>
3341
</section>
3442

43+
<Contact
44+
contact={contact}
45+
phone={phone}
46+
email={email}
47+
/>
48+
3549
<Footer
3650
title={TITLE}
3751
tagline={TAGLINE}

tests/index.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ test('homepage has title and links', async ({ page }) => {
1717
const blog = page.getByRole('link', { name: '📝 Blog' });
1818
await expect(blog).toHaveAttribute('href', 'https://yoandev.co');
1919

20+
const phone = page.getByRole('link', { name: '☎️ Call me' });
21+
await expect(phone).toHaveAttribute('href', 'tel://+33600000000');
22+
23+
const email = page.getByRole('link', { name: '📪 Email me' });
24+
await expect(email).toHaveAttribute('href', 'mailto://contact@yoandev.co');
2025
});

0 commit comments

Comments
 (0)