Set state on "Modify" button in list (side) quests

This commit is contained in:
Ceda EI 2019-04-04 12:01:19 +05:30
parent 065fd743e4
commit 5336be044f
1 changed files with 9 additions and 1 deletions

View File

@ -7,7 +7,13 @@ function QuestTile(props) {
<p>Difficulty: {["Low", "Medium", "High"][props.quest.difficulty - 1]}</p>
<p>Priority: {["Low", "Medium", "High"][props.quest.priority - 1]}</p>
<p>State: {props.quest.state ? "Complete": "Incomplete"}</p>
<button className="nes-btn is-primary">Modify</button>
<button
className="nes-btn is-primary"
onClick={() => props.setDisplay({
"type": props.type,
"id": props.quest.id
})}
>Modify</button>
</div>
);
}
@ -15,6 +21,7 @@ function QuestTile(props) {
QuestTile.propTypes = {
quest: PropTypes.object,
setDisplay: PropTypes.func,
type: PropTypes.string,
};
function Quests(props) {
@ -34,6 +41,7 @@ function Quests(props) {
{props.quests.map((cur) => <QuestTile
key={cur.id}
quest={cur}
type={ props.display.type === "quests" ? "quest" : "sideQuest"}
setDisplay={props.setDisplay}/>)}
</div>
);