-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use astro:assets for social .svgs too (#262)
* feat: use astro:assets for social .svgs too * chore: remove unused Solid JSX * pnpm lint --fix * fix: children
- Loading branch information
1 parent
943f3a3
commit 3aa0197
Showing
20 changed files
with
128 additions
and
128 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
import type { ImageMetadata } from "astro"; | ||
import { Image } from "astro:assets"; | ||
interface Props { | ||
alt: string; | ||
class?: string; | ||
image: ImageMetadata; | ||
} | ||
--- | ||
|
||
<Image | ||
alt={Astro.props.alt} | ||
class:list={["social-image", Astro.props.class]} | ||
src={Astro.props.image} | ||
/> | ||
|
||
<style> | ||
.social-image { | ||
height: 1.25rem; | ||
width: 1.25rem; | ||
vertical-align: text-bottom; | ||
} | ||
|
||
:global(html.dark) .social-image { | ||
filter: invert() hue-rotate(180deg); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
import linkedin from "~/assets/icons/linkedin.svg"; | ||
import twitter from "~/assets/icons/twitter.svg"; | ||
import SocialImage from "../SocialImage.astro"; | ||
interface Props { | ||
class?: string; | ||
description: string; | ||
title: string; | ||
url: URL; | ||
} | ||
const channels = [ | ||
[ | ||
"LinkedIn", | ||
`https://linkedin.com/sharing/share-offsite/?url=${Astro.props.url.toString()}`, | ||
linkedin, | ||
], | ||
[ | ||
"Twitter", | ||
`https://twitter.com/intent/tweet?text=${[ | ||
`📝 ${Astro.props.title}`, | ||
`"${Astro.props.description}" - by @JoshuaKGoldberg`, | ||
"", | ||
].join("%0a%0a")}&url=${Astro.props.url.toString()}`, | ||
twitter, | ||
], | ||
] as const; | ||
--- | ||
|
||
<span class:list={["shares", Astro.props.class]}> | ||
<slot /> | ||
{ | ||
channels.map(([network, href, image]) => ( | ||
<a | ||
class="share" | ||
href={href} | ||
target="_blank" | ||
title={`Share on ${network}`} | ||
> | ||
<SocialImage alt={`${network} logo`} class="share-img" image={image} /> | ||
</a> | ||
)) | ||
} | ||
</span> | ||
|
||
<style> | ||
.shares { | ||
align-items: baseline; | ||
display: inline-flex; | ||
gap: 1rem; | ||
margin: 0.5em 0 0; | ||
} | ||
|
||
@media (min-width: 700px) { | ||
.shares { | ||
margin: 0 0 -0.25em; | ||
} | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
import BlogShare from "./BlogShare.astro"; | ||
interface Props { | ||
description: string; | ||
title: string; | ||
url: URL; | ||
} | ||
--- | ||
|
||
<hr /> | ||
<BlogShare {...Astro.props} class="blog-share-bottom"> | ||
Liked this post? Thanks! Let the world know: | ||
</BlogShare> | ||
|
||
<style> | ||
.blog-share-bottom { | ||
font-size: var(--fontSizeSmall); | ||
font-weight: var(--fontWeightMedium); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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