@@ -4,6 +4,8 @@ import React, { useEffect } from 'react'
44import { BrowserRouter as Router , Route , Routes } from 'react-router-dom'
55import { ToastContainer } from 'react-toastify'
66import 'react-toastify/dist/ReactToastify.css'
7+ import { isMobile } from 'react-device-detect'
8+ import styled from 'styled-components'
79
810// Styles
911import 'bootstrap/dist/css/bootstrap.min.css'
@@ -19,44 +21,71 @@ import Copyright from './pages/general/copyright/Copyright'
1921import Rocksat from './pages/rocksat/Rocksat'
2022import Ballooning from './pages/ballooning/Ballooning'
2123import NoMatch404 from './pages/general/NoMatch404'
24+ import spaceBackground from './assets/pics/outreach/space-background.jpeg'
2225
2326// Images
2427import backgroundVideo1 from './assets/vids/nasa-vid-1.webm'
2528import { PATHS } from './tools/Constants'
2629
30+ class Styles {
31+ static readonly AppContainer = styled . div < { height : number } > `
32+ min-height: ${ props => props . height + 'px' } ;
33+ `
34+
35+ static readonly Content = styled . div < { height : number } > `
36+ min-height: ${ props => props . height + 'px' } ;
37+ display: grid;
38+ `
39+ }
40+
2741const App = ( ) : React . ReactElement => {
2842 // Used for Sign-Ups
2943 useEffect ( ( ) => { getEventToasts ( ) } )
44+ const height = window . innerHeight
45+
46+ const getBackground = ( ) : React . ReactElement => {
47+ if ( isMobile ) {
48+ return (
49+ < img src = { spaceBackground } id = 'video-background' />
50+ )
51+ } else {
52+ return (
53+ < video loop muted autoPlay playsInline id = 'video-background' >
54+ < source src = { backgroundVideo1 } type = 'video/webm' />
55+ </ video >
56+ )
57+ }
58+ }
3059
3160 return (
32- < >
61+ < Styles . AppContainer height = { height } >
3362 < ToastContainer style = { { fontSize : 'var(--bs-body-font-size)' } } />
34- < video loop muted autoPlay playsInline id = 'video-background' >
35- < source src = { backgroundVideo1 } type = 'video/webm' />
36- </ video >
63+ { getBackground ( ) }
3764 < GlobalStyles />
3865 { /* The basename is if this is not a org website <Router basename='website-2.0'> */ }
39- < Router >
40- < div className = 'App' >
41- < Navigation />
42- < div className = 'content' >
43- { /* Define routes within the website */ }
44- < Routes >
45- < Route path = '/' element = { < Home /> } />
46- < Route path = { PATHS . HOME } element = { < Home /> } />
47- < Route path = { PATHS . EVENTS } element = { < Events /> } />
48- < Route path = { PATHS . ROBOTICS } element = { < RoboticMining /> } />
49- < Route path = { PATHS . SPONSORS } element = { < Sponsors /> } />
50- < Route path = { PATHS . ROCKSAT } element = { < Rocksat /> } />
51- < Route path = { PATHS . BALLOONING } element = { < Ballooning /> } />
52- { /* If no path was matched, go to 404 page */ }
53- < Route path = '*' element = { < NoMatch404 /> } />
54- </ Routes >
66+ < Styles . Content height = { height } >
67+ < Router >
68+ < div className = 'App' >
69+ < Navigation />
70+ < div className = 'content' >
71+ { /* Define routes within the website */ }
72+ < Routes >
73+ < Route path = '/' element = { < Home /> } />
74+ < Route path = { PATHS . HOME } element = { < Home /> } />
75+ < Route path = { PATHS . EVENTS } element = { < Events /> } />
76+ < Route path = { PATHS . ROBOTICS } element = { < RoboticMining /> } />
77+ < Route path = { PATHS . SPONSORS } element = { < Sponsors /> } />
78+ < Route path = { PATHS . ROCKSAT } element = { < Rocksat /> } />
79+ < Route path = { PATHS . BALLOONING } element = { < Ballooning /> } />
80+ { /* If no path was matched, go to 404 page */ }
81+ < Route path = '*' element = { < NoMatch404 /> } />
82+ </ Routes >
83+ </ div >
5584 </ div >
56- </ div >
57- </ Router >
58- < Copyright / >
59- </ >
85+ </ Router >
86+ < Copyright / >
87+ </ Styles . Content >
88+ </ Styles . AppContainer >
6089 )
6190}
6291
0 commit comments