Skip to content

Commit

Permalink
Improve layout for card links
Browse files Browse the repository at this point in the history
This commit improves the layout in the following ways: First, we ensure a proper
spacing, both between icon and text but also between the links. Second, we also
improve the accessibility a bit, by underlining links when hovering them.
  • Loading branch information
nachtjasmin authored and schroedingersZombie committed Jul 28, 2024
1 parent 3cfe7d5 commit 54cfeef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
12 changes: 0 additions & 12 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@ body {
.map-popup .leaflet-popup-content p {
@apply m-0 mb-1;
}

li.contact-email::marker {
content: "📧";
}

li.contact-phone::marker {
content: "☎";
}

li.contact-website::marker {
content: "🌐";
}
25 changes: 15 additions & 10 deletions ts/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,22 @@ const buildContent = (o: Organisation): string => {
let result = `
<h3 class="font-semibold text-base">${o.name}</h3>
<address class="inline">${o.location.address ?? "auf Nachfrage"}</address>
<ul class="list-disc my-4 pl-2 list-inside">`;
<ul class="my-4 space-y-1 pl-2 list-inside">`;

const li = (label: string, link: string, icon: string): string => {
return `<li>
<span aria-hidden=true class=mr-2>${icon}</span>
<a href="${link}" class="hover:underline">
${label}
</a>
</li>`;
};

for (const { label, url } of o.websites) result += li(label, url, "🌐");
for (const { label, email } of o.emails) result += li(label, email, "📧");
for (const { label, phone } of o.phones)
result += li(`${label} (${phone})`, "tel:" + phone, "☎");

o.websites.forEach((website) => {
result += `<li class="contact-website"><a href="${website.url}">${website.label}</a></li>`;
});
o.emails.forEach((email) => {
result += `<li class="contact-email"><a href="mailto:${email.email}">${email.label}</a></li>`;
});
o.phones.forEach((phone) => {
result += `<li class="contact-phone">${phone.label}: <a href="tel:${phone.phone}">${phone.phone}</a></li>`;
});
result += `</ul>`;

if (o.activities && o.activities !== "")
Expand Down

0 comments on commit 54cfeef

Please sign in to comment.