mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-04 17:07:22 +00:00
Views: replace css files with scss modules
This commit is contained in:
parent
40a6e7eb3a
commit
ae9456d6dd
17 changed files with 147 additions and 141 deletions
|
|
@ -12,7 +12,9 @@ import HomeView from '~/src/views/HomeView/HomeView'
|
||||||
import GamesView from '~/src/views/GamesView/GamesView'
|
import GamesView from '~/src/views/GamesView/GamesView'
|
||||||
import ThemesView from '~/src/views/ThemesView/ThemesView'
|
import ThemesView from '~/src/views/ThemesView/ThemesView'
|
||||||
import PlayerView from '~/src/views/PlayerView/PlayerView'
|
import PlayerView from '~/src/views/PlayerView/PlayerView'
|
||||||
import NotFoundView from '~/src/views/NotFoundView'
|
import NotFoundView from '~/src/views/NotFoundView/NotFoundView'
|
||||||
|
|
||||||
|
import * as style from './style/App.module.scss'
|
||||||
|
|
||||||
export default function App () {
|
export default function App () {
|
||||||
const themeEngine = useThemeEngine()
|
const themeEngine = useThemeEngine()
|
||||||
|
|
@ -30,8 +32,8 @@ export default function App () {
|
||||||
return (
|
return (
|
||||||
<Router hook={useHashLocation}>
|
<Router hook={useHashLocation}>
|
||||||
<div className={[
|
<div className={[
|
||||||
'app',
|
style.app,
|
||||||
extractView(currentLocation),
|
style[extractView(currentLocation)],
|
||||||
themeEngine.currentTheme].join(' ')}>
|
themeEngine.currentTheme].join(' ')}>
|
||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { Link } from 'wouter-preact'
|
||||||
import * as s from './Status.module.scss'
|
import * as s from './Status.module.scss'
|
||||||
|
|
||||||
const fail = (details) => (
|
const fail = (details) => (
|
||||||
<div className={[s.status, s.fail].join(' ')}>
|
<div className={[s.status].join(' ')}>
|
||||||
<h1>
|
<h1>
|
||||||
Error
|
Error
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
padding: var(--inner-padding);
|
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
|
padding-block: var(--inner-padding);
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
padding: var(--inner-padding);
|
||||||
|
}
|
||||||
|
|
||||||
&.loading > div:after {
|
&.loading > div:after {
|
||||||
animation: dots0123 1s infinite;
|
animation: dots0123 1s infinite;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ export const buildPlayLinkHref = ({ url }) =>
|
||||||
`/#/play/${encodeURIComponent(url)}`
|
`/#/play/${encodeURIComponent(url)}`
|
||||||
|
|
||||||
export const extractView = (location) => {
|
export const extractView = (location) => {
|
||||||
|
if (location === '/') return 'home'
|
||||||
|
|
||||||
const currentView = location.split('/').filter(Boolean)[0]
|
const currentView = location.split('/').filter(Boolean)[0]
|
||||||
|
|
||||||
return currentView || ''
|
return currentView || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
49
src/style/App.module.scss
Normal file
49
src/style/App.module.scss
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
.app {
|
||||||
|
min-height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
color: var(--main-color);
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
|
||||||
|
/* */
|
||||||
|
&.home, &.games, &.themes {
|
||||||
|
padding: var(--inner-padding);
|
||||||
|
|
||||||
|
/* Fix for Jumping Scrollbar Issue */
|
||||||
|
@media (min-width: 800px) {
|
||||||
|
padding-left: calc(100vw - 100% + var(--inner-padding));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Player view */
|
||||||
|
&.play, &.focus {
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100dvh;
|
||||||
|
|
||||||
|
@media (min-width: 800px) {
|
||||||
|
& > main {
|
||||||
|
max-height: 90%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
& > main {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
@media (min-width: 800px) {
|
||||||
|
margin: 5vh 0;
|
||||||
|
max-width: 800px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,34 +15,3 @@ html, body {
|
||||||
#root {
|
#root {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app {
|
|
||||||
min-height: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
color: var(--main-color);
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
|
|
||||||
/* Fix for Jumping Scrollbar Issue */
|
|
||||||
@media (min-width: 800px) {
|
|
||||||
padding-left: calc(100vw - 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
& > main {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
@media (min-width: 800px) {
|
|
||||||
margin: 5vh 0;
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
.app > .view.games {
|
|
||||||
padding: var(--inner-padding);
|
|
||||||
}
|
|
||||||
|
|
||||||
.view.games h4 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.view.games li {
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
@ -5,7 +5,7 @@ import GameEntry from
|
||||||
|
|
||||||
import top2019 from './top2019'
|
import top2019 from './top2019'
|
||||||
|
|
||||||
import './GamesView.css'
|
import * as s from './GamesView.module.scss'
|
||||||
|
|
||||||
const tutorialGame = {
|
const tutorialGame = {
|
||||||
name: 'The Dreamhold',
|
name: 'The Dreamhold',
|
||||||
|
|
@ -15,8 +15,7 @@ const tutorialGame = {
|
||||||
|
|
||||||
export default function GamesView () {
|
export default function GamesView () {
|
||||||
return (
|
return (
|
||||||
<main className='view games'>
|
<main className={s.games}>
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
<a
|
<a
|
||||||
target='_blank'
|
target='_blank'
|
||||||
|
|
@ -32,25 +31,25 @@ export default function GamesView () {
|
||||||
go back</Link>.
|
go back</Link>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>
|
<section className={s.tutorial}>
|
||||||
Tutorial
|
<h2>
|
||||||
</h2>
|
Tutorial
|
||||||
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you are not familiar with Interactive Fiction,
|
If you are not familiar with Interactive Fiction,
|
||||||
you should start with this tutorial game
|
you should start with this tutorial game
|
||||||
by Andrew Plotkin:
|
by Andrew Plotkin:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<GameEntry {...{
|
<GameEntry {...{
|
||||||
...tutorialGame,
|
...tutorialGame,
|
||||||
}} />
|
}} />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</section>
|
||||||
<br />
|
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
Interactive Fiction Top 50 of All Time
|
Interactive Fiction Top 50 of All Time
|
||||||
|
|
|
||||||
13
src/views/GamesView/GamesView.module.scss
Normal file
13
src/views/GamesView/GamesView.module.scss
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
.games {
|
||||||
|
.tutorial {
|
||||||
|
margin-block: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
.app > .view.home {
|
|
||||||
padding: var(--inner-padding);
|
|
||||||
}
|
|
||||||
|
|
@ -12,13 +12,11 @@ import TargetURLSelector from
|
||||||
import ThemeSelector from
|
import ThemeSelector from
|
||||||
'~/src/components/ThemeSelector/ThemeSelector'
|
'~/src/components/ThemeSelector/ThemeSelector'
|
||||||
|
|
||||||
import './HomeView.css'
|
|
||||||
|
|
||||||
export default function HomeView ({ themeEngine }) {
|
export default function HomeView ({ themeEngine }) {
|
||||||
const setLocation = useHashLocation()[1]
|
const setLocation = useHashLocation()[1]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className='view home'>
|
<main>
|
||||||
<h1>
|
<h1>
|
||||||
ElseIFPlayer
|
ElseIFPlayer
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
.app.play,
|
|
||||||
.app.focus {
|
|
||||||
height: 100%;
|
|
||||||
max-height: 100dvh;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 800px) {
|
|
||||||
.app.play main,
|
|
||||||
.app.focus main {
|
|
||||||
max-height: 90%;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,8 +3,6 @@ import { useState, useEffect } from 'preact/hooks'
|
||||||
import UrlPlayer from '~/src/components/Player/UrlPlayer'
|
import UrlPlayer from '~/src/components/Player/UrlPlayer'
|
||||||
import MenuOverlay from '~/src/components/Player/MenuOverlay/MenuOverlay'
|
import MenuOverlay from '~/src/components/Player/MenuOverlay/MenuOverlay'
|
||||||
|
|
||||||
import './PlayerView.css'
|
|
||||||
|
|
||||||
const decode = (encodedUrl) => decodeURIComponent(encodedUrl)
|
const decode = (encodedUrl) => decodeURIComponent(encodedUrl)
|
||||||
|
|
||||||
export default function PlayerView ({
|
export default function PlayerView ({
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
.app > .view.themes {
|
|
||||||
padding: var(--inner-padding);
|
|
||||||
--current-border: var(--main-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview {
|
|
||||||
border: 2px solid var(--current-border);
|
|
||||||
padding: calc(2 * var(--inner-padding));
|
|
||||||
margin-bottom: 32px;
|
|
||||||
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
color: var(--main-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview.current {
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
margin-bottom: 64px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview .output {
|
|
||||||
border: 2px solid var(--main-color);
|
|
||||||
padding: var(--inner-padding);
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview .output .message.subheader {
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--accent-color);
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview .output .message.input {
|
|
||||||
color: var(--input-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.themePreview button {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
import { Link } from 'wouter-preact'
|
import { Link } from 'wouter-preact'
|
||||||
|
|
||||||
import './ThemesView.css'
|
import * as s from './ThemesView.module.scss'
|
||||||
|
|
||||||
const Preview = (themeEngine, theme) =>
|
const Preview = (themeEngine, theme) =>
|
||||||
<section key={theme} className={`themePreview ${theme}`}>
|
<section key={theme} className={[s.themePreview, theme].join(' ')}>
|
||||||
<div className='output'>
|
<div className={s.output}>
|
||||||
<div className='message input'>
|
<div className={[s.message, s.input].join(' ')}>
|
||||||
> look
|
> look
|
||||||
</div>
|
</div>
|
||||||
<div><br /></div>
|
<div><br /></div>
|
||||||
<div className='message subheader'>
|
<div className={[s.message, s.subheader].join(' ')}>
|
||||||
{theme}
|
{theme}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -29,7 +29,7 @@ export default function ThemesView ({ themeEngine }) {
|
||||||
.map((theme) => Preview(themeEngine, theme))
|
.map((theme) => Preview(themeEngine, theme))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className='view themes'>
|
<main className={s.themes}>
|
||||||
<h1>
|
<h1>
|
||||||
Themes Page
|
Themes Page
|
||||||
</h1>
|
</h1>
|
||||||
|
|
@ -39,17 +39,16 @@ export default function ThemesView ({ themeEngine }) {
|
||||||
go back</Link>.
|
go back</Link>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>
|
<section className={[s.themePreview, s.current].join(' ')}>
|
||||||
Current Theme
|
<h2>
|
||||||
</h2>
|
Current Theme
|
||||||
|
</h2>
|
||||||
<section className={'themePreview current'}>
|
<div className={s.output}>
|
||||||
<div className='output'>
|
<div className={[s.message, s.input].join(' ')}>
|
||||||
<div className='message input'>
|
|
||||||
> look
|
> look
|
||||||
</div>
|
</div>
|
||||||
<div><br /></div>
|
<div><br /></div>
|
||||||
<div className='message subheader'>
|
<div className={[s.message, s.subheader].join(' ')}>
|
||||||
Selected: {themeEngine.currentTheme}
|
Selected: {themeEngine.currentTheme}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
38
src/views/ThemesView/ThemesView.module.scss
Normal file
38
src/views/ThemesView/ThemesView.module.scss
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
.themes {
|
||||||
|
--current-border: var(--main-color);
|
||||||
|
|
||||||
|
.themePreview {
|
||||||
|
border: 2px solid var(--current-border);
|
||||||
|
padding: calc(2 * var(--inner-padding));
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
color: var(--main-color);
|
||||||
|
|
||||||
|
&.current {
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
margin-block: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.output {
|
||||||
|
border: 2px solid var(--main-color);
|
||||||
|
padding: var(--inner-padding);
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
.message.subheader {
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--accent-color);
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message.input {
|
||||||
|
color: var(--input-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue