Refine sharing and cookie consent button styles
This commit is contained in:
+38
@@ -240,6 +240,43 @@ function AnalyticsConsentBanner() {
|
||||
)
|
||||
}
|
||||
|
||||
function ShareShowButton() {
|
||||
const [feedback, setFeedback] = useState('')
|
||||
|
||||
async function handleShare() {
|
||||
const shareUrl = window.location.origin
|
||||
const shareTitle = 'Verse by Verse with Nate'
|
||||
const shareText = 'Check out Verse by Verse with Nate.'
|
||||
|
||||
try {
|
||||
if (navigator.share) {
|
||||
await navigator.share({ title: shareTitle, text: shareText, url: shareUrl })
|
||||
setFeedback('Shared successfully.')
|
||||
return
|
||||
}
|
||||
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(shareUrl)
|
||||
setFeedback('Link copied. Share it with a friend.')
|
||||
return
|
||||
}
|
||||
|
||||
setFeedback(`Copy this link: ${shareUrl}`)
|
||||
} catch {
|
||||
setFeedback('Share canceled.')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="share-show-wrap">
|
||||
<button type="button" className="btn-primary btn-share-show" onClick={handleShare}>
|
||||
Share the Show
|
||||
</button>
|
||||
{feedback && <p className="share-feedback">{feedback}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function LandingPage({ content }: { content: SiteContent }) {
|
||||
return (
|
||||
<div className="site">
|
||||
@@ -446,6 +483,7 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
>
|
||||
creators.spotify.com/pod/profile/nmemmert
|
||||
</a>
|
||||
<ShareShowButton />
|
||||
</div>
|
||||
<div className="qr-code-wrap">
|
||||
<div className="qr-frame">
|
||||
|
||||
Reference in New Issue
Block a user