This commit is contained in:
parent
2336262c57
commit
a5d325573c
3 changed files with 75 additions and 1 deletions
28
src/css/option.css
Normal file
28
src/css/option.css
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
.optionBox {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 60vw;
|
||||||
|
background-color: white;
|
||||||
|
color: #8391b8;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #8391b8;
|
||||||
|
border-width: 5px;
|
||||||
|
border-radius: 30px;
|
||||||
|
padding: 50px;
|
||||||
|
}
|
||||||
|
.optionSection {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
row-gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spriteBox {
|
||||||
|
height: 50vh;
|
||||||
|
width: 30vw;
|
||||||
|
}
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.spriteBox {
|
||||||
|
width: 75vw;
|
||||||
|
}
|
||||||
|
}
|
44
src/pages/optionPage.jsx
Normal file
44
src/pages/optionPage.jsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// src/OptionPage.js
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import '../css/global.css';
|
||||||
|
import '../css/textBox.css';
|
||||||
|
import '../css/nameBox.css';
|
||||||
|
import '../css/option.css'
|
||||||
|
import Animation from './components/animation.jsx';
|
||||||
|
|
||||||
|
function OptionPage({data , onClicked}) {
|
||||||
|
const backgroundSRC = `${import.meta.env.VITE_ASSETS_URL}/${data.background}`
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100svh',
|
||||||
|
width: '100svw',
|
||||||
|
flexDirection: 'column',
|
||||||
|
backgroundImage: `url(${backgroundSRC})`,
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className='spriteBox'>
|
||||||
|
<Animation src={`F${data.sprite}`}/>
|
||||||
|
</div>
|
||||||
|
{/* <div style={{width:'60vw'}}>
|
||||||
|
<div className='nameBox title'>
|
||||||
|
{data.name}
|
||||||
|
</div>
|
||||||
|
</div> */}
|
||||||
|
<div className='optionSection'>
|
||||||
|
{
|
||||||
|
data.option.map((item,i) =>
|
||||||
|
<div key={i} className='optionBox title'>{item.text}</div>)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OptionPage;
|
|
@ -5,8 +5,10 @@ import '../css/global.css';
|
||||||
import { fetchYamlData } from './components/fetchYamlData';
|
import { fetchYamlData } from './components/fetchYamlData';
|
||||||
import StoryPage from './storyPage';
|
import StoryPage from './storyPage';
|
||||||
import ConversationPage from './conversationPage.jsx';
|
import ConversationPage from './conversationPage.jsx';
|
||||||
|
import OptionPage from './optionPage.jsx';
|
||||||
import LoadingScene from './components/loadingScene.jsx';
|
import LoadingScene from './components/loadingScene.jsx';
|
||||||
|
|
||||||
|
|
||||||
function VitualNovelHandler() {
|
function VitualNovelHandler() {
|
||||||
const [data, setData] = useState(null);
|
const [data, setData] = useState(null);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
@ -61,7 +63,7 @@ function VitualNovelHandler() {
|
||||||
case "conversation":
|
case "conversation":
|
||||||
return <ConversationPage data={currentStepData} onClicked={handleNextStep}/>;
|
return <ConversationPage data={currentStepData} onClicked={handleNextStep}/>;
|
||||||
case "option":
|
case "option":
|
||||||
return <div onClick={handleNextStep}>option</div>;
|
return <OptionPage data={currentStepData} onClicked={handleNextStep}/>;
|
||||||
default:
|
default:
|
||||||
return <LoadingScene />;
|
return <LoadingScene />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue