미리보기는 샘플 데이터로 동작합니다. 네트워크도 채널도 필요 없습니다.
tsx
import { YuvaSubscribe } from "@/components/yuva-subscribe"
export function Newsletter() {
return (
<YuvaSubscribe
server={process.env.NEXT_PUBLIC_YUVA_SERVER}
channel={process.env.NEXT_PUBLIC_YUVA_CHANNEL}
name="optional"
privacyUrl="/privacy"
/>
)
}설치
shadcn 프로젝트에서 실행하세요. 파일이 여러분의 코드로 복사됩니다.
Shell
npx shadcn@latest add https://useyuva.com/r/yuva-subscribe.jsonShell
pnpm dlx shadcn@latest add https://useyuva.com/r/yuva-subscribe.jsonShell
yarn dlx shadcn@latest add https://useyuva.com/r/yuva-subscribe.jsonShell
bunx --bun shadcn@latest add https://useyuva.com/r/yuva-subscribe.json사용법
tsx
import { YuvaSubscribe } from "@/components/yuva-subscribe"
<YuvaSubscribe server={server} channel={channel} />Props
YuvaSubscribeProps
| Prop | 유형 |
|---|---|
server? | string |
channel? | string |
client? | YuvaClient |
identityToken? | IdentityTokenSource | null |
lists? | string[] |
layout? | "stacked" | "inline" |
name? | "off" | "optional" | "required" |
consent? | string |
privacyUrl? | string |
locale? | string |
labels? | Partial<YuvaSubscribeLabels> |
onSubscribe? | (detail: { lists: string[]; confirmation: boolean }) => void |
className? | string |
레이블
모든 레이블에는 영어 기본값이 있습니다. 바꾸거나 번역하려면 labels 객체의 일부를 전달하세요.
| 레이블 | 기본값 |
|---|---|
lists | "Lists" |
email | "E-mail address" |
name | "Your name" |
nameOptional | "Your name (optional)" |
button | "Subscribe" |
sending | "Subscribing…" |
consent | (lists, inbox) => `I want to receive e-mails about ${lists} from ${inbox}. I can unsubscribe at any time.` |
privacy | "Privacy policy" |
checkInbox | "Almost done. Check your inbox and confirm your subscription." |
subscribed | "Thanks! You are subscribed." |
pending | "Check your inbox to confirm." |
chooseList | "Choose at least one list." |
invalidEmail | "Enter a valid e-mail address." |
nameRequired | "Enter your name." |
consentRequired | "Tick the box to agree." |
noEmail | "Your account has no e-mail address yet." |
rateLimited | "Too many attempts. Wait a moment and try again." |
offline | "You seem to be offline." |
generic | "Could not subscribe. Try again." |
의존성
이 항목을 설치하면 다음도 함께 추가됩니다.