Skip to content

Commit 5b23edd

Browse files
committed
feat: add icons to external community links
1 parent 1e881a2 commit 5b23edd

4 files changed

Lines changed: 37 additions & 15 deletions

File tree

assets/css/site.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/site.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,32 @@
4141
const pick = (value) => value && typeof value === 'object'
4242
? (value[lang] || value.pt || value.en || '') : (value || '');
4343
const text = (key) => COPY[lang][key];
44+
const externalIcon = (href) => {
45+
const value = String(href || '').toLowerCase();
46+
if (value.startsWith('mailto:')) return 'bi-envelope';
47+
if (value.includes('meetup.com')) return 'bi-calendar-event';
48+
if (value.includes('github.com')) return 'bi-github';
49+
if (value.includes('instagram.com')) return 'bi-instagram';
50+
if (value.includes('youtube.com') || value.includes('youtu.be')) return 'bi-youtube';
51+
if (value.includes('telegram.me') || value.includes('t.me/')) return 'bi-telegram';
52+
if (value.includes('linkedin.com')) return 'bi-linkedin';
53+
if (value.includes('twitter.com') || value.includes('x.com')) return 'bi-twitter-x';
54+
if (value.includes('facebook.com')) return 'bi-facebook';
55+
if (value.includes('bsky.app')) return 'bi-cloud';
56+
if (value.includes('threads.net')) return 'bi-threads';
57+
if (value.includes('mastodon')) return 'bi-mastodon';
58+
return 'bi-box-arrow-up-right';
59+
};
4460
const external = (href, label, className) => {
45-
const link = element('a', { href: safeHref(href), text: label, class: className });
61+
const link = element('a', { href: safeHref(href), class: className });
4662
if (/^https?:/i.test(link.href)) {
4763
link.target = '_blank';
4864
link.rel = 'noreferrer';
4965
}
66+
if (label) link.append(
67+
element('i', { class: `bi ${externalIcon(href)} external-link-icon`, 'aria-hidden': 'true' }),
68+
document.createTextNode(label)
69+
);
5070
return link;
5171
};
5272
const safeHref = (href) => /^(https?:|mailto:|#)/i.test(href || '') ? href : '#';

data/site.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
"home": {
1212
"heading": { "pt": "O que fazemos", "en": "What we do" },
1313
"cards": [
14-
{ "route": "comunidade", "title": { "pt": "Comunidade", "en": "Community" }, "text": { "pt": "Conversamos na lista de emails e no Telegram, e promovemos almoços, coding dojos e palestras.", "en": "We connect through the mailing list and Telegram, and run lunches, coding dojos and talks." }, "cta": { "pt": "Saiba mais", "en": "Learn more" } },
14+
{ "route": "comunidade", "title": { "pt": "Comunidade", "en": "Community" }, "text": { "pt": "Conversamos no Telegram e nas redes sociais, e promovemos almoços, coding dojos e palestras.", "en": "We connect through Telegram and social media, and run lunches, coding dojos and talks." }, "cta": { "pt": "Saiba mais", "en": "Learn more" } },
1515
{ "route": "membros", "title": { "pt": "Membros", "en": "Members" }, "text": { "pt": "Colaboradores mantêm a comunicação ativa e ajudam a organizar e divulgar os encontros.", "en": "Contributors keep communication active and help organise and share our events." }, "cta": { "pt": "Conheça", "en": "Meet them" } },
1616
{ "route": "projetos", "title": { "pt": "Projetos", "en": "Projects" }, "text": { "pt": "Iniciativas colaborativas para levar conhecimento e Python a mais pessoas.", "en": "Collaborative initiatives that bring Python and knowledge to more people." }, "cta": { "pt": "Ver projetos", "en": "View projects" } }
1717
]
1818
},
1919
"community": [
20-
{ "title": { "pt": "Mídias sociais", "en": "Social media" }, "text": { "pt": "Acompanhe encontros, novidades e publicações da comunidade.", "en": "Follow meetups, news and community posts." }, "links": [{ "text": "Telegram", "href": "https://telegram.me/pythonmg" }, { "text": "Twitter", "href": "https://twitter.com/PythonMG" }, { "text": "Facebook", "href": "https://facebook.com/uaipython" }] },
21-
{ "title": { "pt": "Meetup", "en": "Meetup" }, "text": { "pt": "Nos encontramos regularmente para trocar conhecimento e experiências.", "en": "We meet regularly to share knowledge and experience." }, "links": [{ "text": "Meetup", "href": "http://www.meetup.com/Belo-Horizonte-Python-User-Group/" }] },
22-
{ "title": { "pt": "Lista de emails", "en": "Mailing list" }, "text": { "pt": "A lista oficial no Google Groups continua aberta para toda a comunidade.", "en": "The official Google Groups list is open to the entire community." }, "links": [{ "text": "Google Groups", "href": "https://groups.google.com/forum/#!forum/python-mg" }] }
20+
{ "title": { "pt": "Mídias sociais", "en": "Social media" }, "text": { "pt": "Acompanhe encontros, novidades e publicações da comunidade.", "en": "Follow meetups, news and community posts." }, "links": [{ "text": "Instagram", "href": "https://www.instagram.com/python.mg" }, { "text": "YouTube", "href": "https://www.youtube.com/c/PythonMinasGerais" }, { "text": "Telegram", "href": "https://telegram.me/pythonmg" }, { "text": "Twitter", "href": "https://twitter.com/PythonMG" }, { "text": "Facebook", "href": "https://facebook.com/uaipython" }] },
21+
{ "title": { "pt": "Meetup", "en": "Meetup" }, "text": { "pt": "Nos encontramos regularmente para trocar conhecimento e experiências.", "en": "We meet regularly to share knowledge and experience." }, "links": [{ "text": "Meetup", "href": "https://www.meetup.com/pythonmg/events" }] }
2322
],
2423
"projects": [
2524
{ "title": "Traduções do Django docs", "text": { "pt": "Tradução colaborativa da documentação oficial do Django para o português.", "en": "Collaborative translation of the official Django documentation into Portuguese." } },
@@ -35,8 +34,10 @@
3534
},
3635
"social": [
3736
{ "text": "GitHub", "href": "https://github.com/pythonmg" },
38-
{ "text": "Telegram", "href": "https://telegram.me/pythonmg" },
39-
{ "text": "Mailing list", "href": "https://groups.google.com/forum/#!forum/python-mg" }
37+
{ "text": "Meetup", "href": "https://www.meetup.com/pythonmg/events" },
38+
{ "text": "Instagram", "href": "https://www.instagram.com/python.mg" },
39+
{ "text": "YouTube", "href": "https://www.youtube.com/c/PythonMinasGerais" },
40+
{ "text": "Telegram", "href": "https://telegram.me/pythonmg" }
4041
],
4142
"footer": { "credit": { "pt": "Feito com Python, JSON e HTML.", "en": "Made with Python, JSON and HTML." }, "repo": "https://github.com/pythonmg/pythonmg.github.io" }
4243
}

index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="preconnect" href="https://fonts.googleapis.com">
1010
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1111
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet">
12+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
1213
<link rel="stylesheet" href="assets/css/site.css">
1314
</head>
1415
<body>
@@ -33,8 +34,8 @@
3334
<h1 id="hero-title">Python-MG</h1>
3435
<p class="hero-text" id="hero-text"></p>
3536
<div class="hero-actions">
36-
<a class="button button-primary" href="https://www.meetup.com/pythonmg/events" target="_blank" rel="noreferrer" data-i18n="seeEvents">Ver eventos</a>
37-
<a class="button button-secondary" href="https://telegram.me/pythonmg" target="_blank" rel="noreferrer">Telegram <span aria-hidden="true"></span></a>
37+
<a class="button button-primary" href="https://www.meetup.com/pythonmg/events" target="_blank" rel="noreferrer"><i class="bi bi-calendar-event" aria-hidden="true"></i><span data-i18n="seeEvents">Ver eventos</span></a>
38+
<a class="button button-secondary" href="https://telegram.me/pythonmg" target="_blank" rel="noreferrer"><i class="bi bi-telegram" aria-hidden="true"></i>Telegram <span aria-hidden="true"></span></a>
3839
</div>
3940
</div>
4041
</section>
@@ -68,7 +69,7 @@ <h3 class="subheading" data-i18n="upcoming">Próximos</h3>
6869
<div class="event-list" id="upcoming-events"></div>
6970
<h3 class="subheading subdued" data-i18n="past">Eventos anteriores</h3>
7071
<div class="past-events" id="past-events"></div>
71-
<a class="section-external-link" href="https://www.meetup.com/pythonmg/events" target="_blank" rel="noreferrer" data-i18n="seeMoreEvents">Ver mais no Meetup ↗</a>
72+
<a class="section-external-link" href="https://www.meetup.com/pythonmg/events" target="_blank" rel="noreferrer"><i class="bi bi-calendar-event" aria-hidden="true"></i><span data-i18n="seeMoreEvents">Ver mais no Meetup ↗</span></a>
7273
</section>
7374

7475
<section class="section" id="projetos" aria-labelledby="projects-title">
@@ -83,7 +84,7 @@ <h3 class="subheading subdued" data-i18n="past">Eventos anteriores</h3>
8384

8485
<section class="section" id="conduta" aria-labelledby="conduct-title">
8586
<div class="section-heading"><h2 id="conduct-title"></h2><span></span></div>
86-
<div class="conduct-content"><ol class="conduct-list" id="conduct-list"></ol><a class="section-external-link" href="https://github.com/pythonmg/codigo-de-conduta" target="_blank" rel="noreferrer" data-i18n="fullConduct">Ver Código de Conduta completo ↗</a></div>
87+
<div class="conduct-content"><ol class="conduct-list" id="conduct-list"></ol><a class="section-external-link" href="https://github.com/pythonmg/codigo-de-conduta" target="_blank" rel="noreferrer"><i class="bi bi-github" aria-hidden="true"></i><span data-i18n="fullConduct">Ver Código de Conduta completo ↗</span></a></div>
8788
</section>
8889
</div>
8990
</main>
@@ -92,7 +93,7 @@ <h3 class="subheading subdued" data-i18n="past">Eventos anteriores</h3>
9293
<div class="shell footer-main">
9394
<div><img src="assets/images/logo/logo.png" alt="Python-MG"><p id="footer-about"></p></div>
9495
<div><p class="label">Social</p><div class="footer-links" id="social-links"></div></div>
95-
<div><p class="label">Site</p><div class="footer-links"><a href="#conduta" data-i18n="conduct">Código de conduta</a><a id="repository-link" href="https://github.com/pythonmg/pythonmg.github.io" target="_blank" rel="noreferrer">GitHub Pages repo</a></div></div>
96+
<div><p class="label">Site</p><div class="footer-links"><a href="#conduta" data-i18n="conduct">Código de conduta</a><a id="repository-link" href="https://github.com/pythonmg/pythonmg.github.io" target="_blank" rel="noreferrer"><i class="bi bi-github" aria-hidden="true"></i>GitHub Pages repo</a></div></div>
9697
</div>
9798
<div class="footer-credit"><div class="shell"><span id="footer-credit"></span><a class="avatar-credit" href="https://unavatar.io" target="_blank" rel="noreferrer">Avatares por Unavatar</a></div></div>
9899
</footer>

0 commit comments

Comments
 (0)