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