Skip to content

Commit

Permalink
chore: mvp beta
Browse files Browse the repository at this point in the history
  • Loading branch information
esteban committed Jun 20, 2021
1 parent ee3b4f7 commit e4121eb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
18 changes: 15 additions & 3 deletions src/DetailsComponent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import react from "react"
import styled, { css } from "styled-components";

const InnerContainer = styled.div`
line-height: 32px;
font-size: xx-large;
text-align: center
`

const ShowDetails = props => {
const { username, plays, friends, tracks, uri } = props
return <div>
{console.log(props)}
</div >
return (
<InnerContainer>
<h2>Username {username}</h2>
<p>Plays: {plays}</p>
<p>Friends: {friends}</p>
<p>uri: {uri}</p>
<p>tracks: {tracks.length}</p>
</InnerContainer>
)
}

export default ShowDetails
2 changes: 1 addition & 1 deletion src/InputComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const ValueWrapper = styled.input`
height: 60px;
box-sizing: border-box;
border-radius: 20px;
border: 1px solid #b6c1ce;
border: 3px solid #b6c1ce;
line-height: 32px;
font-size: xx-large;
text-align: center;
Expand Down
4 changes: 3 additions & 1 deletion src/MainContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const reducer = (state, action) => {
case actionTypes.SEARCH_TERM: return Object.assign({}, state, { searchTerm: action.payload })
case actionTypes.GET_SUGGESTIONS: return Object.assign({}, state, { getSuggetions: action.payload })
case actionTypes.UPDATE_USER_DETAILS: return Object.assign({}, state, { userDetail: action.payload, searchTerm: "" })
// escape hatch for async data fetching
case actionTypes.ENTER_KEY_PRESSED: {
axios.get(`/api/users/${state.searchTerm}`)
.then(result => action.dispatch({ type: actionTypes.UPDATE_USER_DETAILS, payload: result.data }))
Expand All @@ -40,6 +41,8 @@ const isEmpty = obj => Object.keys(obj).length === 0
export const InnerContainer = styled.div`
height: 70vh;
width: 100%;
line-height: 32px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -69,7 +72,6 @@ export default function MainContent() {
type={"text"}
onKeyPress={handleEnter(dispatch)}
/>
<p>ray_benigno</p>
{isEmpty(userDetail) ? console.log("nothing") : ShowDetails(userDetail)}
</InnerContainer>
</>
Expand Down

0 comments on commit e4121eb

Please sign in to comment.