Skip to content

Commit 145192f

Browse files
committed
feat: share to X button in toolbar
1 parent ac1aabc commit 145192f

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

.changeset/share-button.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"holosticker": minor
3+
---
4+
5+
Share button in the toolbar: posts to X with @jalcowastaken tagged and a link to holosticker.dev

src/App.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
History,
88
Image,
99
Moon,
10+
Share2,
1011
Sun,
1112
} from "lucide-react"
1213
import { DropdownMenu } from "radix-ui"
@@ -250,6 +251,21 @@ export default function App() {
250251
<SelectItem value="4096">4096 × 4096</SelectItem>
251252
</SelectContent>
252253
</Select>
254+
<Button
255+
variant="outline"
256+
onClick={() => {
257+
const text =
258+
"Just made a holographic sticker with Holosticker ✨ by @jalcowastaken"
259+
window.open(
260+
`https://x.com/intent/post?text=${encodeURIComponent(text)}&url=${encodeURIComponent("https://holosticker.dev")}`,
261+
"_blank",
262+
"noopener",
263+
)
264+
}}
265+
>
266+
<Share2 aria-hidden />
267+
Share
268+
</Button>
253269
<DropdownMenu.Root>
254270
<DropdownMenu.Trigger asChild>
255271
<Button disabled={!image || exporting}>

0 commit comments

Comments
 (0)