delucis / astro-embed

Low-JavaScript embed components for Astro websites
https://astro-embed.netlify.app
MIT License
166 stars 24 forks source link

Add `hideMedia` prop to `LinkPreview` #132

Closed jasikpark closed 5 days ago

jasikpark commented 6 days ago

Fixes https://github.com/delucis/astro-embed/issues/129

Tried to be minimally invasive in my edits and add showImage and showVideo props which should function as if the OG url didn't have an image or video, essentially.

changeset-bot[bot] commented 6 days ago

πŸ¦‹ Changeset detected

Latest commit: 97fb2f36d08e82903fc4d589c6eeb11f79dbd9a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ----------------------------------------- | ----- | | @astro-community/astro-embed-link-preview | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jasikpark commented 5 days ago

I prefer extra control and positively named props, but I can switch to that if you want πŸ‘

"positively named props" = showMedia={false} with a default of true, instead of a don'tShowMedia={true} which adds a negative in the name

delucis commented 5 days ago

I get that, but if true is the default, I find they work less nicely.

For example: now there’s showMedia prop, do I need to set the showMedia prop to show media? It sounds like maybe I do. Perhaps I should set showMedia={true} just to be safe.

Given this is only ever used for hiding media, naming it with the user goal in mind is ideal I think.

jasikpark commented 5 days ago

btw, I'd reccomend turning on experimentalTernaries in Prettier, it makes ternary expressions much easier to read IMO

netlify[bot] commented 5 days ago

Deploy Preview for astro-embed ready!

Name Link
Latest commit 97fb2f36d08e82903fc4d589c6eeb11f79dbd9a8
Latest deploy log https://app.netlify.com/sites/astro-embed/deploys/66846b55ea211900084979fa
Deploy Preview https://deploy-preview-132--astro-embed.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.