Files
app/components/CurrentToast.tsx
zooqueenandHanzo Dev 91da549471 feat(app): scaffold lux cross-platform app (Expo+Tauri) on @hanzo/gui
Phase 1: rebranded @hanzogui/expo-router-starter as @luxfi/app. Targets iOS/Android/web
(Expo) + desktop (Tauri). Drives luxfi/node + luxfi/ai. See README.

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-01 23:30:05 -07:00

58 lines
1.4 KiB
TypeScript

import { Toast, useToastController, useToastState } from '@hanzogui/toast'
import { Button, H4, XStack, YStack, isWeb } from 'hanzogui'
export function CurrentToast() {
const currentToast = useToastState()
if (!currentToast || currentToast.isHandledNatively) return null
return (
<Toast
key={currentToast.id}
duration={currentToast.duration}
viewportName={currentToast.viewportName}
enterStyle={{ opacity: 0, scale: 0.5, y: -25 }}
exitStyle={{ opacity: 0, scale: 1, y: -20 }}
y={isWeb ? '$12' : 0}
theme="accent"
rounded="$6"
transition="quick"
>
<YStack items="center" p="$2" gap="$2">
<Toast.Title fontWeight="bold">{currentToast.title}</Toast.Title>
{!!currentToast.message && (
<Toast.Description>{currentToast.message}</Toast.Description>
)}
</YStack>
</Toast>
)
}
export function ToastControl() {
const toast = useToastController()
return (
<YStack gap="$2" items="center">
<H4>Toast demo</H4>
<XStack gap="$2" justify="center">
<Button
onPress={() => {
toast.show('Successfully saved!', {
message: "Don't worry, we've got your data.",
})
}}
>
Show
</Button>
<Button
onPress={() => {
toast.hide()
}}
>
Hide
</Button>
</XStack>
</YStack>
)
}