-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(share-buttons): Add social media share buttons component (#897)
* feat(share-buttons): Add social media share buttons component * chore(share-buttons): Add comments * fix: share buttons moved to Published --------- Co-authored-by: Quentin Deroubaix <[email protected]>
- Loading branch information
1 parent
a917905
commit 1f9e05f
Showing
6 changed files
with
95 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,58 @@ | ||
<script> | ||
<script lang="ts"> | ||
import {page} from '$app/stores'; | ||
import Svg from '$lib/layout/Svg.svelte'; | ||
import twitter from 'bootstrap-icons/icons/twitter-x.svg?raw'; | ||
import facebook from 'bootstrap-icons/icons/facebook.svg?raw'; | ||
import linkedin from 'bootstrap-icons/icons/linkedin.svg?raw'; | ||
import fbasso from '$resources/images/fbasso.webp'; | ||
type AuthorInfo = { | ||
icon: string; | ||
title: string; | ||
}; | ||
const authorLogo = { | ||
fbasso: { | ||
icon: fbasso, | ||
title: 'Fabrice Basso, Software engineer at Amadeus', | ||
}, | ||
} satisfies Record<string, AuthorInfo>; | ||
export let date; | ||
export let author: keyof typeof authorLogo; | ||
date = Intl.DateTimeFormat('en-US', {dateStyle: 'full'}).format(new Date(date)); | ||
$: encodedUrl = encodeURIComponent(`https://amadeusitgroup.github.io/AgnosUI/latest` + $page.url.pathname); | ||
$: formattedDate = Intl.DateTimeFormat('en-US', {dateStyle: 'medium'}).format(new Date(date)); | ||
</script> | ||
|
||
<strong class="d-flex mb-2">Published on {date}</strong> | ||
<div class="d-flex flex-wrap"> | ||
<div class="d-flex gap-3"> | ||
<img src={authorLogo[author].icon} alt="Publisher avatar" class="avatar" /> | ||
<div> | ||
<strong>{authorLogo[author].title}</strong> | ||
<div>Published on {formattedDate}</div> | ||
</div> | ||
</div> | ||
<div class="d-flex flex-grow-1 justify-content-end gap-2 ms-5 align-self-end"> | ||
<a target="_blank" class="nav-link" href="https://twitter.com/share?url={encodedUrl}" aria-label="Share on Twitter"> | ||
<Svg className="icon-20 align-middle" svg={twitter} /> | ||
</a> | ||
<a target="_blank" class="nav-link" href="https://www.facebook.com/sharer/sharer.php?u={encodedUrl}" aria-label="Share on Facebook"> | ||
<Svg className="icon-20 align-middle" svg={facebook} /> | ||
</a> | ||
<a target="_blank" class="nav-link" href="https://www.linkedin.com/sharing/share-offsite/?url={encodedUrl}" aria-label="Share on LinkedIn"> | ||
<Svg className="icon-20 align-middle" svg={linkedin} /> | ||
</a> | ||
</div> | ||
</div> | ||
<hr /> | ||
|
||
<style> | ||
.avatar { | ||
vertical-align: middle; | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
} | ||
</style> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters