Skip to content

Commit

Permalink
Added UI, completed songsList
Browse files Browse the repository at this point in the history
  • Loading branch information
lainshiHenry committed Oct 3, 2022
1 parent a92d512 commit 55e4bde
Show file tree
Hide file tree
Showing 7 changed files with 472 additions and 100 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

steps.txt
38 changes: 35 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
import { useEffect } from 'react';
import React, { useState } from 'react';
import MainScreen from './views/screens/MainScreen';
import MainScreenPortrait from './views/screens/MainScreenPortrait';

function _debounce(fn, ms) {
let timer;
return _ => {
clearTimeout(timer);
timer = setTimeout((_) => {
timer = null;
fn.apply(this, arguments)
}, ms);
}
}

function App() {
const [dimension, setDimensions] = useState({
height: window.innerHeight,
width: window.innerWidth,
});

useEffect(() => {
const debouncedHandleResize = _debounce(function handleRezise() {
setDimensions({
height: window.innerHeight,
width: window.innerWidth,
})
})
window.addEventListener('resize', debouncedHandleResize);

return (_) => {
window.removeEventListener('resize', debouncedHandleResize);
}
});

return (
<div className='App'>
<MainScreen />
<div className='App' id='App'>
{dimension.height > dimension.width ? <MainScreenPortrait /> : <MainScreen />}
</div>

);
}

Expand Down
5 changes: 5 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ body {

.mainScreenLayout {
display: flex;
flex-direction: row;
margin-top: 0;
}

.mainScreenLayoutPortrait {
flex-direction: column;
}

.playlistSection {
height: 400px;
width: 50%;
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(
<React.StrictMode>
<App />
Expand Down
Loading

0 comments on commit 55e4bde

Please sign in to comment.