Skip to content

Commit

Permalink
add welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Oct 20, 2024
1 parent 75b938c commit b033099
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
Binary file added src/assets/welcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/modules/Main/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Welcome } from './Welcome';
import { Background } from './Background';
import { PlayfieldsContainer } from './Playfield/PlayfieldsContainer';
import "./Main.scss";
Expand All @@ -7,6 +8,7 @@ export function Main() {
<div className="main">
<Background />
<PlayfieldsContainer />
<Welcome />
</div>
)
}
21 changes: 21 additions & 0 deletions src/modules/Main/Welcome.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useState, useContext, useEffect, useRef } from 'react';
import { MapPackContext } from '../../contexts/MapPackContext';
import { BeatmapsContext } from '../../contexts/BeatmapsContext';
import clsx from 'clsx';
import WelcomePng from '../../assets/welcome.png';
import './Welcome.scss';

export function Welcome() {
const { mapPack } = useContext(MapPackContext);

if (!mapPack) return (
<div className="welcome">
<img src={WelcomePng} className="welcome-image" onDragStart={e => e.preventDefault()} />
<div className="welcome-text">Catch Map Visualizer</div>
<div className="welcome-instructions">Select or drag a beatmap to start</div>
<a href="https://github.com/osu-ctb-vis/Catch-Map-Visualizer" target="_blank" className="welcome-link">GitHub</a>
</div>
);

return null;
}
40 changes: 40 additions & 0 deletions src/modules/Main/Welcome.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.welcome {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
user-select: none;
.welcome-image {
height: 300px;
max-height: 40vh;
object-fit: cover;
aspect-ratio: 1;
opacity: 0.55;
transition: transform 0.5s, opacity 0.5s;
&:hover {
transform: scale(1.02);
opacity: 0.6;
}
}
.welcome-text {
font-size: 2.25rem;
text-align: center;
margin-top: 1.5rem;
font-weight: 400;
}
.welcome-instructions {
font-size: 1.25rem;
text-align: center;
margin-top: 0.5rem;
opacity: 0.8;
}
.welcome-link {
transform: translateY(2rem);
font-size: 1.1rem;
text-decoration: none;
color: var(--accent-color);
filter: contrast(0.6);
}
}

0 comments on commit b033099

Please sign in to comment.