diff --git a/src/pages/optionPage.jsx b/src/pages/optionPage.jsx index 042a349..2f1aa1a 100644 --- a/src/pages/optionPage.jsx +++ b/src/pages/optionPage.jsx @@ -8,6 +8,12 @@ import Animation from './components/animation.jsx'; function OptionPage({data , onClicked}) { const backgroundSRC = `${import.meta.env.VITE_ASSETS_URL}/${data.background}` + const [name] = useState(() => { + return sessionStorage.getItem("name") || ''; + }); + + const DialogText = data.text ? data.text.replace("{name}", name) : null; + const DialogName = data.name ? data.name.replace("{name}", name) : null; return (
{ - data.option.map((item,i) => + data.option.map((item,i) =>
onClicked(item.goTo-1)} key={i} className='optionBox title'>{item.text}
) }
+ {DialogName && DialogText && ( + <> +
+
+ {DialogName} +
+
+
+ {DialogText} +
+ + )}
); }