Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- use the fancy new syntax for optional chaining in JoinButton.js
- media-query comment and simplification
  • Loading branch information
mrkvon committed Jan 3, 2020
1 parent 3e0e3be commit 8f13a62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions modules/tribes/client/components/JoinButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export default function JoinButton({ tribe, user, onUpdated, ...rest }) {

const [isUpdating, setIsUpdating] = useState(false);

// This should always be true or false, even when user is null.
// Therefore we convert the output to boolean.
const isMemberInitial = Boolean(user && user.memberIds && user.memberIds.indexOf(tribe._id) > -1);
const isMemberInitial = (user?.memberIds || []).includes(tribe._id);
const [isMember, setIsMember] = useState(isMemberInitial);

/**
Expand Down
7 changes: 4 additions & 3 deletions modules/tribes/client/components/TribesList.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ const Item = styled.li`
display: inline-block;
vertical-align: bottom;

@media (min-width: 0) {
width: 100%;
}
// 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%;
}
`;
Expand Down

0 comments on commit 8f13a62

Please sign in to comment.