cosmetic changes
This commit is contained in:
1 parent
4e620850ed
commit
16f3c27d99
18 files changed
+21744
-88
No files matched your search
Generated
+21566
-21
File diff suppressed because it is too large.
Load diff
@@ -3,8 +3,6 @@
|
||||
padding-bottom: 2.5em;
|
||||
margin-bottom: 1em;
|
||||
font-family: 'Poppins';
|
||||
width: min(100%, 800px);
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.history > span {
|
||||
|
||||
@@ -6,12 +6,12 @@ function History(props) {
|
||||
return (
|
||||
<div className="wrapper history">
|
||||
<span>Następny:</span>
|
||||
<Track {...props.next} />
|
||||
<Track {...props.next} timestamp=">" />
|
||||
<span>Gra teraz:</span>
|
||||
<Track {...props.playing} />
|
||||
<Track {...props.playing} timestamp="~" />
|
||||
<span>Poprzednie:</span>
|
||||
{props.tracks.map((track) => {
|
||||
return <Track key={track.id} {...track} />
|
||||
return <Track key={track.id} {...track} timestamp="14:33" />
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
.info {
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.info-image {
|
||||
@@ -34,7 +31,7 @@
|
||||
.info-balance {
|
||||
width: 100%;
|
||||
font-size: 0.75em;
|
||||
background-color: #f3d9da;
|
||||
background-color: var(--light);
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
@@ -43,7 +40,7 @@
|
||||
}
|
||||
|
||||
.info-balance > .up {
|
||||
background-color: #57191d;
|
||||
background-color: var(--main);
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ function Info() {
|
||||
|
||||
let percent = (track.votes.up / (track.votes.up + track.votes.down)) * 100
|
||||
|
||||
document.title = `${track.title} | radio-rolnik`
|
||||
|
||||
return (
|
||||
<div className="wrapper info">
|
||||
<img src={track.album.art} className="info-image" alt="album cover" />
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
.main {
|
||||
height: 100vh;
|
||||
justify-content: flex-end;
|
||||
background-color: hsl(356deg 50% 92%);
|
||||
background-color: var(--light);
|
||||
font-family: 'Quicksand';
|
||||
overflow: hidden auto;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
+49
-33
@@ -8,48 +8,64 @@ import {
|
||||
import Nav from '../Nav/Nav'
|
||||
import History from '../History/History'
|
||||
import Status from '../Status/Status'
|
||||
import Info from '../Info/Info'
|
||||
import Top from '../Top/Top'
|
||||
import Search from '../Search/Search'
|
||||
|
||||
import { get } from '../../Cache'
|
||||
|
||||
import PlayingContext from '../../contexts/Playing'
|
||||
|
||||
import './Main.css'
|
||||
import Info from '../Info/Info'
|
||||
|
||||
var playing = get('2340q8ghedsnawg1')
|
||||
|
||||
document.setTitle = (prefix, suffix) => {
|
||||
document.title = `${prefix} | ${suffix ?? 'radio-rolnik'}`
|
||||
}
|
||||
|
||||
function Main() {
|
||||
return (
|
||||
<div className="main">
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route exact path="/">
|
||||
<History
|
||||
next={get('8034thrgnu0380')}
|
||||
playing={playing}
|
||||
tracks={[get('2340q8ghedsnawg1'), get('8034thrgnu0380')]}
|
||||
/>
|
||||
</Route>
|
||||
<Route path="/utwor/:id">
|
||||
<Info playing={playing} />
|
||||
</Route>
|
||||
<Route render={() => <Redirect to="/" />} />
|
||||
</Switch>
|
||||
<Nav
|
||||
buttons={[
|
||||
{ label: 'Historia', to: '/', icon: 'align-left' },
|
||||
{ label: 'Wyszukaj', to: '/wyszukaj', icon: 'search' },
|
||||
{ label: 'Top', to: '/top', icon: 'list-numbered' },
|
||||
{
|
||||
label: 'Utwór',
|
||||
path: '/utwor',
|
||||
to: `/utwor/${playing.id}`,
|
||||
icon: 'info',
|
||||
},
|
||||
{ label: 'Ustawienia', to: '/ustawienia', icon: 'cog-alt' },
|
||||
]}
|
||||
/>
|
||||
<Status track={playing} progress=".75" />
|
||||
</Router>
|
||||
</div>
|
||||
<PlayingContext.Provider value={playing}>
|
||||
<div className="main">
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route exact path="/">
|
||||
<History
|
||||
next={get('8034thrgnu0380')}
|
||||
playing={playing}
|
||||
tracks={[get('2340q8ghedsnawg1'), get('8034thrgnu0380')]}
|
||||
/>
|
||||
</Route>
|
||||
<Route path="/utwor/:id">
|
||||
<Info playing={playing} />
|
||||
</Route>
|
||||
<Route path="/top">
|
||||
<Top tracks={[get('2340q8ghedsnawg1'), get('8034thrgnu0380')]} />
|
||||
</Route>
|
||||
<Route path="/wyszukaj/:query?">
|
||||
<Search />
|
||||
</Route>
|
||||
<Route render={() => <Redirect to="/" />} />
|
||||
</Switch>
|
||||
<Nav
|
||||
buttons={[
|
||||
{ label: 'Historia', to: '/', icon: 'align-left' },
|
||||
{ label: 'Wyszukaj', to: '/wyszukaj', icon: 'search' },
|
||||
{ label: 'Top', to: '/top', icon: 'list-numbered' },
|
||||
{
|
||||
label: 'Utwór',
|
||||
path: '/utwor',
|
||||
to: `/utwor/${playing.id}`,
|
||||
icon: 'info',
|
||||
},
|
||||
{ label: 'Ustawienia', to: '/ustawienia', icon: 'cog-alt' },
|
||||
]}
|
||||
/>
|
||||
<Status track={playing} progress=".75" />
|
||||
</Router>
|
||||
</div>
|
||||
</PlayingContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
nav {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
background-color: #fefefe;
|
||||
background-color: var(--white);
|
||||
border-radius: 1em 1em 0 0;
|
||||
padding: 0.5em;
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
box-shadow: 0 0 12px 1px #0000002b, 0 -10px 20px 20px #f5e0e2;
|
||||
box-shadow: 0 0 12px 1px #0000002b, 0 -10px 20px 20px var(--light);
|
||||
z-index: 5;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
@@ -28,7 +28,7 @@ nav {
|
||||
}
|
||||
|
||||
.nav-button.active {
|
||||
color: #ca3e47;
|
||||
color: var(--main);
|
||||
font-weight: bold;
|
||||
padding-top: 0;
|
||||
position: relative;
|
||||
@@ -40,7 +40,7 @@ nav {
|
||||
left: 10%;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
border-bottom: 4px solid #ca3e4730;
|
||||
border-bottom: 4px solid var(--light);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
|
||||
import './Nav.css'
|
||||
|
||||
function Button(props) {
|
||||
@@ -24,7 +25,7 @@ function Nav(props) {
|
||||
.reverse()
|
||||
.find((button) =>
|
||||
document.location.pathname.startsWith(button.path ?? button.to)
|
||||
).to
|
||||
).label
|
||||
}
|
||||
|
||||
let [current, setCurrent] = useState(getTab()),
|
||||
@@ -32,6 +33,21 @@ function Nav(props) {
|
||||
|
||||
useEffect(() => {
|
||||
setCurrent(getTab())
|
||||
let label = (function () {
|
||||
switch (current) {
|
||||
default:
|
||||
case 'History':
|
||||
case 'Top':
|
||||
case 'Ustawienia':
|
||||
return current
|
||||
case 'Wyszukaj':
|
||||
case 'Utwór':
|
||||
return false
|
||||
}
|
||||
})()
|
||||
|
||||
// don't update for custom titles
|
||||
label && (document.title = `${label} | radio-rolnik`)
|
||||
}, [location]) // eslint-disable-line
|
||||
|
||||
return (
|
||||
@@ -41,9 +57,9 @@ function Nav(props) {
|
||||
key={button.label}
|
||||
label={button.label}
|
||||
icon={button.icon}
|
||||
active={button.to === current}
|
||||
active={button.label === current}
|
||||
to={button.to}
|
||||
onClick={() => setCurrent(button.to)}
|
||||
onClick={() => setCurrent(button.label)}
|
||||
/>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
.search {
|
||||
text-align: center;
|
||||
padding: 0.75em;
|
||||
}
|
||||
|
||||
.search > input {
|
||||
font-size: 1em;
|
||||
border: none;
|
||||
background: none;
|
||||
border-bottom: 1px solid #fffc;
|
||||
padding: 0.5em 1em;
|
||||
width: 100%;
|
||||
margin-bottom: 1em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -1,9 +1,29 @@
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import Track from '../Track/Track'
|
||||
import { get } from '../../Cache'
|
||||
|
||||
import './Search.css'
|
||||
|
||||
function Search(props) {
|
||||
let { query } = useParams()
|
||||
|
||||
document.setTitle(`"${query}"`)
|
||||
|
||||
return (
|
||||
<div className="search">
|
||||
<input className="search-input" type="text" />
|
||||
<div className="wrapper search">
|
||||
<h2>Wyszukaj utwór</h2>
|
||||
<input
|
||||
className="search-input"
|
||||
placeholder="Wyszukaj utwór"
|
||||
type="text"
|
||||
defaultValue={query}
|
||||
/>
|
||||
<div className="search-results">
|
||||
{[get('2340q8ghedsnawg1'), get('8034thrgnu0380')].map((track) => {
|
||||
return <Track key={track.id} {...track} />
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
bottom: 3.5rem;
|
||||
left: 2.5%;
|
||||
width: 95%;
|
||||
background: hsl(356deg 55% 22%);
|
||||
color: #fefefe;
|
||||
background: var(--dark);
|
||||
color: var(--white);
|
||||
padding: 0.5em;
|
||||
border-radius: 1em;
|
||||
box-sizing: border-box;
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,15 @@
|
||||
import Track from '../Track/Track'
|
||||
|
||||
import './Top.css'
|
||||
|
||||
function Top(props) {
|
||||
return (
|
||||
<div className="wrapper top">
|
||||
{props.tracks.map((track) => {
|
||||
return <Track key={track.id} rank={track.votes.rank} {...track} />
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Top
|
||||
@@ -2,7 +2,7 @@
|
||||
height: 2em;
|
||||
margin: 0.3em 0.4em;
|
||||
padding: 0.4em;
|
||||
background-color: #fefefe;
|
||||
background-color: var(--white);
|
||||
display: flex;
|
||||
align-content: center;
|
||||
line-height: 1.9em;
|
||||
@@ -14,7 +14,19 @@
|
||||
.track-section-a {
|
||||
width: 5em;
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
justify-content: flex-end;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.track-section-a.empty {
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.track-section-a > span {
|
||||
color: #666;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.track-section-b {
|
||||
@@ -24,22 +36,18 @@
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* justify-content: space-around; */
|
||||
}
|
||||
|
||||
.track-timestamp {
|
||||
color: #666;
|
||||
margin: 0 0.5em 0 0.2em;
|
||||
font-size: 0.75em;
|
||||
float: left;
|
||||
width: 2.5em;
|
||||
text-align: center;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.track-rank:before {
|
||||
content: '#';
|
||||
}
|
||||
|
||||
.track-image {
|
||||
height: 100%;
|
||||
margin-right: 0.5em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,15 @@ function Track(props) {
|
||||
|
||||
return (
|
||||
<div className={['track', open ? 'open' : ''].join(' ')}>
|
||||
<div className="track-section-a">
|
||||
<div
|
||||
className={
|
||||
'track-section-a ' + (props.timestamp || props.rank ? '' : 'empty')
|
||||
}
|
||||
>
|
||||
{props.timestamp && (
|
||||
<span className="track-timestamp">{props.timestamp}</span>
|
||||
)}
|
||||
{props.rank && <span className="track-rank">{props.rank}</span>}
|
||||
<img
|
||||
className="track-image"
|
||||
src={props.album.art ?? '/media/default.png'}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
const PlayingContext = createContext('playing')
|
||||
|
||||
export default PlayingContext
|
||||
+9
-1
@@ -5,4 +5,12 @@ body {
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
}
|
||||
|
||||
:root {
|
||||
--deg: 170deg;
|
||||
--white: hsl(0, 0%, 100%);
|
||||
--light: hsl(var(--deg) 50% 92%);
|
||||
--main: hsl(var(--deg), 57%, 52%);
|
||||
--dark: hsl(var(--deg) 55% 22%);
|
||||
}
|
||||
Reference in new issue
Block a user