Created
February 18, 2017 20:33
-
-
Save ianmstew/98815c5793e1a5784e47f3f5f2d870f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.user-list { | |
border: 1px solid grey; | |
padding: 20px; | |
} | |
.user-list__user { | |
align-content: space-around; | |
margin-top: 5px; | |
} | |
.user-list__user:first-child { | |
margin-top: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import User from '../user/user' | |
import './user-list.css'; | |
export default function UserList(props) { | |
const { users } = props; | |
return ( | |
<div className='user-list'> | |
{users.map(user => ( | |
<User className='user-list__user' user={user} /> | |
)} | |
</div> | |
); | |
} | |
UserList.defaultProps = { users: [] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.user { | |
display: flex; | |
align-content: space-between; | |
} | |
.user__avatar { | |
flex: 0 0 auto; | |
} | |
.user__name { | |
flex: 1 0 auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './user.css'; | |
export default function User(props) { | |
const { | |
className, | |
user: { firstName, lastName, avatar } | |
} = props; | |
return ( | |
<div className={`user ${className}`}> | |
<img className='user__avatar' src={avatar} /> | |
<div className='user__name'>{firstName} {lastName}</div> | |
</div> | |
); | |
} | |
User.defaultProps = { className: '', user: {} }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment