mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 10:35:08 +02:00
Fix up viewer
This commit is contained in:
parent
8a48f5fc24
commit
d18b8b003c
@ -61,7 +61,7 @@ a img {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 120%;
|
width: 120%;
|
||||||
min-width: 1920px;
|
min-width: 1920px;
|
||||||
opacity: .5;
|
opacity: .1;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Container, Loading } from './components/generic'
|
import { Container, Loading } from './components/generic'
|
||||||
import { log, callApi, exportSvg } from './modules/helpers'
|
import { log, callApi, exportSvg } from './modules/helpers'
|
||||||
import download from 'downloadjs'
|
import download from 'downloadjs'
|
||||||
|
import DraftRocketeer from './assets/draft-rocketeer.png'
|
||||||
|
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
@ -22,11 +23,11 @@ function App() {
|
|||||||
// Get ID from url
|
// Get ID from url
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
|
|
||||||
// Expecting /rocketeer/:id
|
const { search } = window.location
|
||||||
const { pathname } = window.location
|
const query = new URLSearchParams( search )
|
||||||
|
const id = Number( query.get( 'rocketeer' ) || 'none' )
|
||||||
|
|
||||||
// Remove '/rocketeer/'
|
log( 'Id found: ', id )
|
||||||
const id = Number( pathname.replace( '/rocketeer/', '' ) )
|
|
||||||
|
|
||||||
// Check if id is a number
|
// Check if id is a number
|
||||||
if( isNaN( id ) ) return setError( 'No rocketeer selected' )
|
if( isNaN( id ) ) return setError( 'No rocketeer selected' )
|
||||||
@ -105,15 +106,15 @@ function App() {
|
|||||||
|
|
||||||
if( rocketeer ) return <Container>
|
if( rocketeer ) return <Container>
|
||||||
|
|
||||||
<img src={ rocketeer.image } />
|
<img alt={ `Rocketeer ${ rocketeerId }` } src={ rocketeer.image || DraftRocketeer } />
|
||||||
<h1>{ rocketeer.name }</h1>
|
<h1>{ rocketeer.name }</h1>
|
||||||
<p>{ rocketeer.description }</p>
|
<p>{ rocketeer.description || "This is a generic Rocketeer without a description. That should only happen during testing. Contact us on Discord if you see this." }</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<a href={ rocketeer.image } className="button">Download SVG</a>
|
<a href={ rocketeer.image } className="button">Download SVG</a>
|
||||||
|
|
||||||
<a onClick={ e => downloadJPEG( e, 500 ) } className="button">Download JPEG</a>
|
<a href='/#' onClick={ e => downloadJPEG( e, 500 ) } className="button">Download JPEG</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
BIN
viewer/src/assets/draft-rocketeer.png
Normal file
BIN
viewer/src/assets/draft-rocketeer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
1
viewer/src/assets/undraw_To_the_stars_qhyy.svg
Normal file
1
viewer/src/assets/undraw_To_the_stars_qhyy.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 16 KiB |
1
viewer/src/assets/undraw_connected_world_wuay.svg
Normal file
1
viewer/src/assets/undraw_connected_world_wuay.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 34 KiB |
@ -1,4 +1,4 @@
|
|||||||
// import ContainerBackground from '../assets/undraw_launch_day_4e04.svg'
|
import ContainerBackground from '../assets/undraw_connected_world_wuay.svg'
|
||||||
|
|
||||||
export const Container = ( { children } ) => <main>
|
export const Container = ( { children } ) => <main>
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ export const Container = ( { children } ) => <main>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ /* <img className="stretchBackground" src={ ContainerBackground } alt="Launching rocket" /> */ }
|
<img className="stretchBackground" src={ ContainerBackground } alt="Launching rocket" />
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user