Skip to content

Commit

Permalink
Add Leaderboard component to VictoryPage and refactor reponsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
judy0ye committed Nov 30, 2023
1 parent 15a5702 commit 9309b2c
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions src/components/VictoryPage/VictoryPage.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
import './VictoryPage.css';
import React from 'react';
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import background from '../../assets/big-donut.jpg'
import background from '../../assets/big-donut.jpg';
import Leaderboard from '../Leaderboard/Leaderboard';

export default function VictoryPage() {
const navigate = useNavigate();
const [openLeaderboard, setOpenLeaderboard] = useState(false);

const handleBackToStoryClick = () => {
navigate('/');
};

const handleLeaderboardClick = () => {
setOpenLeaderboard(!openLeaderboard);
};

return (
<div className="victory-page" style={{ '--background': `url(${background})` }}>
<div className='room-one-completion'>
<h2>Room 1 complete. A portal opens...Bob must be even further away than we thought.</h2>
<p>Your journey has just begun.</p>
<button className='back-home' onClick={handleBackToStoryClick}>Home</button>
<div
className="victory-page"
style={{ '--background': `url(${background})` }}>
{openLeaderboard && (
<Leaderboard handleLeaderboardClick={handleLeaderboardClick} />
)}
<div tabIndex="0" className="room-one-completion">
<h1>
Room 1 complete. A portal opens...Bob must be even further away than
we thought.
</h1>
<p>Your journey has just begun.</p>
<button className="back-home" onClick={handleBackToStoryClick}>
Home
</button>
{!openLeaderboard && (
<button className="see-leaderboard" onClick={handleLeaderboardClick}>
View Leaderboard
</button>
)}
</div>

</div>
);
}

0 comments on commit 9309b2c

Please sign in to comment.