mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Add a special class to the app container when the player page is active
This commit is contained in:
parent
42015eca8f
commit
5b283d2789
6 changed files with 31 additions and 13 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
.app.play {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.ifplayer {
|
.ifplayer {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
13
src/index.js
13
src/index.js
|
|
@ -1,7 +1,10 @@
|
||||||
import { h, render } from 'preact'
|
import { h, render } from 'preact'
|
||||||
import { Route, Router, Switch } from 'wouter-preact'
|
import { Route, Router, Switch } from 'wouter-preact'
|
||||||
|
|
||||||
import { useHashLocation } from '~/src/utils/utils.routing'
|
import {
|
||||||
|
useHashLocation,
|
||||||
|
extractView
|
||||||
|
} from '~/src/utils/utils.routing'
|
||||||
import {
|
import {
|
||||||
useThemeEngine
|
useThemeEngine
|
||||||
} from '~/src/themes/themes'
|
} from '~/src/themes/themes'
|
||||||
|
|
@ -14,10 +17,15 @@ import '~/src/style/base.css'
|
||||||
|
|
||||||
function App () {
|
function App () {
|
||||||
const themeEngine = useThemeEngine()
|
const themeEngine = useThemeEngine()
|
||||||
|
const [location] = useHashLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router hook={useHashLocation}>
|
<Router hook={useHashLocation}>
|
||||||
<div className={['app', themeEngine.currentTheme].join(' ')}>
|
<div className={[
|
||||||
|
'app',
|
||||||
|
extractView(location),
|
||||||
|
themeEngine.currentTheme].join(' ')}>
|
||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path='/'>
|
<Route path='/'>
|
||||||
<HomeView {...{
|
<HomeView {...{
|
||||||
|
|
@ -37,6 +45,7 @@ function App () {
|
||||||
404
|
404
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.app {
|
.app {
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -66,14 +66,14 @@ ul {
|
||||||
|
|
||||||
/* Home */
|
/* Home */
|
||||||
|
|
||||||
.app > main.home {
|
.app > .view.home {
|
||||||
padding: var(--inner-padding);
|
padding: var(--inner-padding);
|
||||||
max-height: unset;
|
max-height: unset;
|
||||||
height: 200%;
|
height: 200%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home input,
|
.view.home input,
|
||||||
.home select {
|
.view.view.home select {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
color: var(--main-color);
|
color: var(--main-color);
|
||||||
background-color: var(--bg-color);
|
background-color: var(--bg-color);
|
||||||
|
|
@ -82,20 +82,20 @@ ul {
|
||||||
font: inherit;
|
font: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home summary {
|
.view.home summary {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home .play label {
|
.view.home .play label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home .play input {
|
.view.home .play input {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,8 @@ export const useHashLocation = () => {
|
||||||
|
|
||||||
export const buildPlayLinkHref = (url, theme) =>
|
export const buildPlayLinkHref = (url, theme) =>
|
||||||
`/#/play/${theme}/${encodeURIComponent(url)}`
|
`/#/play/${theme}/${encodeURIComponent(url)}`
|
||||||
|
|
||||||
|
export const extractView = location => {
|
||||||
|
const currentView = location.split('/').filter(Boolean)[0]
|
||||||
|
return currentView || ''
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ export default function ({ themeEngine }) {
|
||||||
that runs right in your browser.
|
that runs right in your browser.
|
||||||
<br />
|
<br />
|
||||||
Source code can be found in this <a
|
Source code can be found in this <a
|
||||||
target="_blank"
|
target='_blank'
|
||||||
href="https://github.com/He4eT/ifplayer">
|
href='https://github.com/He4eT/ifplayer'>
|
||||||
repository
|
repository
|
||||||
</a>.
|
</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export default function ({ setTheme, theme, encodedUrl }) {
|
||||||
}, [encodedUrl])
|
}, [encodedUrl])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className='view playerView'>
|
<main>
|
||||||
<UrlPlayer url={targetUrl} />
|
<UrlPlayer url={targetUrl} />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue