-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate list of tribes to React (#1144)
+ introduce styled-components (https://www.styled-components.com/)
- Loading branch information
mrkvon
committed
Jan 20, 2020
1 parent
0cb6153
commit 8b1c8b6
Showing
7 changed files
with
312 additions
and
73 deletions.
There are no files selected for viewing
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
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styled from 'styled-components'; | ||
|
||
import Tribe from './Tribe'; | ||
import SuggestTribe from './SuggestTribe'; | ||
|
||
const List = styled.ul.attrs({ className: 'list-unstyled tribes-grid' })` | ||
margin: -5px -5px 15px -5px; | ||
`; | ||
|
||
const Item = styled.li` | ||
padding: 5px; | ||
display: inline-block; | ||
vertical-align: bottom; | ||
|
||
// on small screens there is just one column of tribes | ||
width: 100%; | ||
|
||
@media (min-width: 616px) { | ||
// two columns of tribes | ||
width: 50%; | ||
} | ||
|
||
@media (min-width: 992px) { | ||
// three columns of tribes | ||
width: 33.3333%; | ||
} | ||
`; | ||
|
||
export default function TribesList({ tribes, user, onMembershipUpdated }) { | ||
return ( | ||
<List> | ||
{tribes.map(tribe => ( | ||
<Item key={tribe._id}> | ||
<Tribe | ||
tribe={tribe} | ||
user={user} | ||
onMembershipUpdated={onMembershipUpdated} | ||
/> | ||
</Item> | ||
))} | ||
<Item> | ||
<SuggestTribe /> | ||
</Item> | ||
</List> | ||
); | ||
} | ||
|
||
TribesList.propTypes = { | ||
tribes: PropTypes.array.isRequired, | ||
user: PropTypes.object, | ||
onMembershipUpdated: PropTypes.func.isRequired, | ||
}; |
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
Oops, something went wrong.