ijunseong

Add: ./src/ directory for react-app

.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
import './App.css';
import Login from "./Login";
import Body from "./Body";
function App() {
let accessToken = null;
return (
<div className="app">
{!accessToken && <Login />}
{accessToken && <Body />}
</div>
);
}
export default App;
.body {
display: flex;
}
\ No newline at end of file
import React from "react";
import "./Body.css";
import {ChanelList} from "./Chanel.js"
function Body(){
return (
<div className="body">
<ChanelList />
</div>
);
}
export default Body;
\ No newline at end of file
.chanel {
display: flex;
align-items: center;
flex-direction: row;
padding-left: 10px;
height: 100px;
background-color: #0e0e10;
padding-left: 10px;
}
.chanel__url {
display: flex;
align-items: center;
flex-grow: 1;
text-decoration: none;
font-size: 14px;
color:white;
box-sizing: border-box;
padding-top: 20px;
padding-bottom: 20px;
}
.chanel__box {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.chanel__box > input {
margin-right: 10px;
}
.chanel__info {
width: 5vw;
margin-right: 20px;
}
.chanel__name {
align-content: center;
font-size: 16px;
}
.chanel__game {
font-size: 12px;
color: gray;
}
.chanel__view {
margin-left: 15px;
margin-right: 5px;
width: 4vw;
text-align: right;
}
.chanel__thumbnail {
height: 25px;
width: 25px;
border-radius: 70%;
overflow: hidden;
margin-right: 30px;
background-color: white;
}
.chanel__icon {
height: 25px;
width: 25px;
border-radius: 70%;
overflow: hidden;
margin-right: 30px;
}
.chanel__list {
display: flex;
flex-grow: 1;
flex-direction: column;
flex: 0.2;
padding-right: 10px;
min-width: 300px;
height: 100vh;
color: white;
background-color: #0e0e10;
}
.chanel__list > ul {
list-style: none;
overflow: auto;
padding-top: 50px;
}
.chanel__list > ul > li > hr {
border: 2px solid #282828;
}
.chanel__list > strong {
padding: 25px;
width: 17%;
background-color: #0e0e0e;
font-size: 20px;
position: fixed;
}
\ No newline at end of file
import React from "react";
import "./Chanel.css";
import "@material-ui/icons"
import PersonIcon from "@material-ui/icons/Person";
import PlayArrowIcon from '@material-ui/icons/PlayArrow';
import StopIcon from '@material-ui/icons/Stop';
import PauseIcon from '@material-ui/icons/Pause';
export function Chanel(props) {
const chanel = props.chanel;
return (
<div className="chanel">
<a href={chanel.url} className="chanel__url">
{chanel.thumbnail && <img className="chanel__thumbnail" src={chanel.thumbnail} alt=""></img>}
{!chanel.thumbnail && <PersonIcon className="chanel__icon"/>}
<div className="chanel__box">
<div className="chanel__info">
<div className="chanel__name">{chanel.name}</div>
<div className="chanel__game">{chanel.game}</div>
</div>
<div className="chanel__view">{chanel.view}</div>
<input type="radio" name="chanel"></input>
</div>
</a>
</div>
);
}
export class ChanelList extends React.Component {
render() {
// data for test
const test = [
{"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
{"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
{"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
{"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
{"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
{"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
{"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
{"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
{"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
{"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
]
const chanels = test;
return (
<div className="chanel__list">
<strong>CHANELS</strong>
<ul>
{chanels.map((chanel) => (
<li>
<Chanel chanel={chanel}/>
<hr />
</li>
))}
</ul>
</div>
);
}
}
\ No newline at end of file
.login {
display: grid;
background-color: #0e0e10;
height: 100vh;
place-items: center;
}
.login > img {
height: 300px;
}
.login > a {
color: white;
padding: 30px;
border-radius: 100px;
text-decoration: none;
font-size: 30px;
font-weight: bold;
background-color: #9147ff;
}
\ No newline at end of file
import React from "react";
import "./Login.css";
function Login(){
const OAuthUrl = ""; // oauth 인증용 url
return (
<div className="login">
<img
src="https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"
alt=""
/>
<a href={OAuthUrl}>Login to Twitch</a>
</div>
);
}
export default Login;
\ No newline at end of file
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();