Skip to content

Commit

Permalink
Merge pull request #607 from OneCommunityGlobal/rj_wrap_badges_user_p…
Browse files Browse the repository at this point in the history
…rofile

Bug fix for: Medium issue 7 : User Profile - Make profile badges fit so bottom scroll bar isn’t showing up.
  • Loading branch information
one-community authored Dec 20, 2022
2 parents 75f3e06 + 32ea063 commit c954777
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 59 deletions.
22 changes: 20 additions & 2 deletions src/components/UserProfile/Badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
background-color: #c9d6c6 !important;
border-color: #285739 !important;
color: #285739 !important;
/*Spacing between buttons*/
margin-right: 10px;
}

.badge_image_sm > img {
Expand Down Expand Up @@ -87,8 +89,11 @@

.badge_featured_container {
display: flex;
flex-wrap: nowrap;
/*Wrap on overflow*/
flex-wrap: wrap;
overflow-y: hidden;
/*center align content*/
justify-content: space-around;
}

.badge_md_image_container {
Expand Down Expand Up @@ -129,8 +134,21 @@
text-align: left;
}

/*Aligns the title and the buttons*/
.badge-header{
display:flex;
flex-wrap: wrap;
gap: 5px;
}

/*Title to occupy more width than buttons*/
.badge-header-title{
flex: 3;
}

/*To match width of iphone 12 Pro*/
#badgeCard {
min-width: 475px;
min-width: 390px;
}

@media screen and (max-width: 1199px) {
Expand Down
111 changes: 54 additions & 57 deletions src/components/UserProfile/Badges.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState, useEffect } from 'react';
import {
Card,
CardTitle,
CardText,
CardHeader,
CardFooter,
CardBody,
Button,
Modal,
Expand Down Expand Up @@ -37,68 +37,65 @@ const Badges = props => {
return (
<>
<Card id="badgeCard" style={{ backgroundColor: '#f6f6f3', marginTop: 20, marginBottom: 20 }}>
<CardHeader>
<div className='badge-header'>
<span className='badge-header-title'>
Featured Badges <i className="fa fa-info-circle" id="FeaturedBadgeInfo" />
</span>
<div>
<Button className="btn--dark-sea-green" onClick={toggle}>
Select Featured
</Button>
<Modal size="lg" isOpen={isOpen} toggle={toggle}>
<ModalHeader toggle={toggle}>Full View of Badge History</ModalHeader>
<ModalBody>
<BadgeReport
badges={props.userProfile.badgeCollection}
userId={props.userProfile._id}
role={props.role}
firstName={props.userProfile.firstName}
lastName={props.userProfile.lastName}
close={toggle}
setUserProfile={props.setUserProfile}
handleSubmit={props.handleSubmit}
permissionsUser={permissionsUser}
/>
</ModalBody>
</Modal>
{props.canEdit && (
<>
<Button className="btn--dark-sea-green mr-2" onClick={assignToggle}>
Assign Badges
</Button>
<Modal size="lg" isOpen={isAssignOpen} toggle={assignToggle}>
<ModalHeader toggle={assignToggle}>Assign Badges</ModalHeader>
<ModalBody>
<AssignBadgePopup
allBadgeData={props.allBadgeData}
userProfile={props.userProfile}
setUserProfile={props.setUserProfile}
close={assignToggle}
handleSubmit={props.handleSubmit}
/>
</ModalBody>
</Modal>
</>
)}
</div>
</div>
</CardHeader>
<CardBody>
<CardTitle
style={{
fontWeight: 'bold',
fontSize: 18,
color: '#285739',
marginBottom: 15,
minWidth: 446,
}}
>
Featured Badges <i className="fa fa-info-circle" id="FeaturedBadgeInfo" />
<Button className="btn--dark-sea-green float-right" onClick={toggle}>
Select Featured
</Button>
<Modal size="lg" isOpen={isOpen} toggle={toggle}>
<ModalHeader toggle={toggle}>Full View of Badge History</ModalHeader>
<ModalBody>
<BadgeReport
badges={props.userProfile.badgeCollection}
userId={props.userProfile._id}
role={props.role}
firstName={props.userProfile.firstName}
lastName={props.userProfile.lastName}
close={toggle}
setUserProfile={props.setUserProfile}
handleSubmit={props.handleSubmit}
permissionsUser={permissionsUser}
/>
</ModalBody>
</Modal>
{props.canEdit && (
<>
<Button className="btn--dark-sea-green float-right mr-2" onClick={assignToggle}>
Assign Badges
</Button>
<Modal size="lg" isOpen={isAssignOpen} toggle={assignToggle}>
<ModalHeader toggle={assignToggle}>Assign Badges</ModalHeader>
<ModalBody>
<AssignBadgePopup
allBadgeData={props.allBadgeData}
userProfile={props.userProfile}
setUserProfile={props.setUserProfile}
close={assignToggle}
handleSubmit={props.handleSubmit}
/>
</ModalBody>
</Modal>
</>
)}
</CardTitle>
<FeaturedBadges badges={props.userProfile.badgeCollection} />
<CardText
style={{
</CardBody>
<CardFooter style={{
fontWeight: 'bold',
fontSize: 18,
color: '#285739',
}}
>
Bravo! You've earned {props.userProfile.badgeCollection.length} badges!{' '}
<i className="fa fa-info-circle" id="CountInfo" />
</CardText>
</CardBody>
Bravo! You've earned {props.userProfile.badgeCollection.length} badges!{' '}
<i className="fa fa-info-circle" id="CountInfo" />
</CardFooter>
</Card>
<UncontrolledTooltip
placement="right"
Expand Down

0 comments on commit c954777

Please sign in to comment.