58 lines
2.0 KiB
TypeScript
58 lines
2.0 KiB
TypeScript
import { useState } from 'react'
|
|
import { IS_TOSS } from '../lib/platform'
|
|
import { Ic } from './ui'
|
|
|
|
const KEY = 'nalssigak.b.tossIntroSeen'
|
|
|
|
const POINTS = [
|
|
['sun', '세차·빨래·러닝 각 점수'],
|
|
['sunset', '오늘 노을이 예쁜 시간'],
|
|
['fireworks', '이번 주말 가까운 행사'],
|
|
] as const
|
|
|
|
function seen() {
|
|
try {
|
|
return localStorage.getItem(KEY) === '1'
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|
|
|
|
/** 토스판을 처음 열면 서비스 소개를 먼저 보여 준다 (앱인토스 검수: 로그인 전에 서비스 설명) */
|
|
export function TossIntro() {
|
|
const [open, setOpen] = useState(() => IS_TOSS && !seen())
|
|
if (!open) return null
|
|
|
|
const start = () => {
|
|
try {
|
|
localStorage.setItem(KEY, '1')
|
|
} catch (e) {
|
|
console.warn('[intro] 본 기록을 저장하지 못함', e)
|
|
}
|
|
setOpen(false)
|
|
}
|
|
|
|
return (
|
|
<div role="dialog" aria-modal="true" aria-labelledby="toss-intro-title" className="fixed inset-0 z-70 flex flex-col items-center justify-center gap-6 bg-[#d6ebff] px-8 text-(--ink)">
|
|
<Ic name="rabbit" className="w-24" />
|
|
<div className="text-center">
|
|
<h1 id="toss-intro-title" className="m-0 font-jua text-[28px] font-normal">
|
|
날씨각
|
|
</h1>
|
|
<p className="m-0 mt-1.5 text-[15px] font-semibold text-(--ink2)">오늘 날씨에 맞는 일을 점수로 알려 줘요</p>
|
|
</div>
|
|
<ul className="m-0 flex w-full max-w-xs list-none flex-col gap-2.5 p-0">
|
|
{POINTS.map(([icon, label]) => (
|
|
<li key={label} className="flex items-center gap-3 rounded-[18px] bg-white/80 px-4 py-3 text-[15px] font-extrabold">
|
|
<Ic name={icon} className="w-8 shrink-0" />
|
|
{label}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
<button type="button" onClick={start} className="w-full max-w-xs cursor-pointer rounded-[14px] bg-(--orange) p-[13px] font-jua text-[17px] text-white shadow-[inset_0_-5px_0_var(--orange-deep)]">
|
|
시작하기
|
|
</button>
|
|
</div>
|
|
)
|
|
}
|