Sample Language Implementation for namePage.jsx

This commit is contained in:
fufu-girl-meow 2025-06-24 01:03:08 +07:00
parent c105f98d46
commit 98b04373b6

View file

@ -8,10 +8,19 @@ function NamePage() {
return sessionStorage.getItem("name") || '';
});
const [lang] = useState(() => {
return sessionStorage.getItem("lang") || 'English';
});
useEffect(() => {
sessionStorage.setItem("name", name);
}, [name]);
const text = {
title: lang === 'Thai' ? 'อยากให้เรียกคุณว่าอะไร?' : 'What should we call you?',
continue: lang === 'Thai' ? 'ดำเนินการต่อ' : 'Continue'
}
return (
<div style={{
display: 'flex',
@ -20,7 +29,7 @@ function NamePage() {
height: '100vh',
flexDirection: 'column',
}}>
<label className='title'>What should we call you?</label>
<label className='title'>{text.title}</label>
<div style={{
height: '8vh'
@ -35,7 +44,7 @@ function NamePage() {
name==''?
<></>
:
<BlackButton text="Continue" to='/introduction'/>
<BlackButton text={text.continue} to='/introduction'/>
}
</div>
)