Merge pull request #21 from Thoscellen/fix-responsive-team-list

(#19) Fix responsive team list
This commit is contained in:
pikiou
2022-08-15 11:45:40 +02:00
committed by GitHub
6 changed files with 88 additions and 611 deletions

10
.gitignore vendored
View File

@@ -1,6 +1,11 @@
# Dependencies # Dependencies
node_modules node_modules
# Sass compiled files
*.module.css
*.css.map
*.css
# Testing # Testing
coverage coverage
@@ -19,3 +24,8 @@ access/*
*.log *.log
.idea .idea
announces/* announces/*
/styles.module.css
# VS Code stuff
.vscode/settings.json
.vscode/launch.json

View File

@@ -1,3 +0,0 @@
{
"eslint.lintTask.enable": true
}

View File

@@ -190,7 +190,6 @@
"jest": "^27.0.6", "jest": "^27.0.6",
"lint-staged": "^11.0.0", "lint-staged": "^11.0.0",
"mini-css-extract-plugin": "^2.1.0", "mini-css-extract-plugin": "^2.1.0",
"node-sass": "^6.0.1",
"nodemon": "^2.0.9", "nodemon": "^2.0.9",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss": "^8.3.5", "postcss": "^8.3.5",
@@ -199,6 +198,7 @@
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",
"react-test-renderer": "^17.0.2", "react-test-renderer": "^17.0.2",
"redux-mock-store": "^1.5.4", "redux-mock-store": "^1.5.4",
"sass": "^1.52.3",
"sass-loader": "^12.1.0", "sass-loader": "^12.1.0",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.19",
"stylelint": "^13.13.1", "stylelint": "^13.13.1",

View File

@@ -33,7 +33,7 @@ type VolunteerEmailProps = {
} }
const VolunteerEmail: FC<VolunteerEmailProps> = withUserRole(ROLES.TEAMLEAD, ({ email }) => ( const VolunteerEmail: FC<VolunteerEmailProps> = withUserRole(ROLES.TEAMLEAD, ({ email }) => (
<div className={styles.volunteerEmail}>{email}</div> <td> {email}</td>
)) ))
type DaysAvailabilityProps = { type DaysAvailabilityProps = {
@@ -44,19 +44,15 @@ const DaysAvailability: FC<DaysAvailabilityProps> = ({ volunteer }): JSX.Element
if (volunteer.dayWishes.length === 0) { if (volunteer.dayWishes.length === 0) {
return ( return (
<> <>
<div className={classnames(styles.day, styles.unknown)}>S</div> <td className={classnames(styles.day, styles.unknown)}>S</td>
<div className={classnames(styles.day, styles.unknown)}>D</div> <td className={classnames(styles.day, styles.unknown)}>D</td>
</> </>
) )
} }
return ( return (
<> <>
<div className={classnames(styles.day, hasDay("S")(volunteer) && styles.available)}> <td className={classnames(styles.day, hasDay("S")(volunteer) && styles.available)} />
S <td className={classnames(styles.day, hasDay("D")(volunteer) && styles.available)} />
</div>
<div className={classnames(styles.day, hasDay("D")(volunteer) && styles.available)}>
D
</div>
</> </>
) )
} }
@@ -73,22 +69,23 @@ const TeamMembers: FC<Props> = ({ teamId }): JSX.Element => {
if (volunteers.length === 0) return <div /> if (volunteers.length === 0) return <div />
return ( return (
<ul className={styles.volunteers}> <table>
<li> <tr>
<div className={styles.volunteerName} /> <th>Volontaires</th>
<div className={styles.dayTitle}>S ({volunteers.filter(hasDay("S")).length})</div> <th className={styles.dayTitle}>S ({volunteers.filter(hasDay("S")).length})</th>
<div className={styles.dayTitle}>D ({volunteers.filter(hasDay("D")).length})</div> <th className={styles.dayTitle}>D ({volunteers.filter(hasDay("D")).length})</th>
</li> <th>@</th>
</tr>
{volunteers.map((volunteer) => ( {volunteers.map((volunteer) => (
<li key={volunteer.id} className={styles.volunteer}> <tr key={volunteer.id}>
<div className={styles.volunteerName}> <td>
{volunteer.firstname} {volunteer.lastname} {volunteer.firstname} {volunteer.lastname}
</div> </td>
<DaysAvailability volunteer={volunteer} /> <DaysAvailability volunteer={volunteer} />
<VolunteerEmail email={volunteer.email} /> <VolunteerEmail email={volunteer.email} />
</li> </tr>
))} ))}
</ul> </table>
) )
} }

View File

@@ -1,54 +1,10 @@
@import "../../theme/variables"; @import "../../theme/variables";
@import "../../theme/mixins"; @import "../../theme/mixins";
.volunteers {
padding: 0;
list-style: none;
}
$height: 24px;
.volunteer {
height: $height;
line-height: $height;
margin-bottom: 3px;
}
.volunteerName {
display: inline-block;
height: $height;
width: 230px;
padding-right: 4px;
text-align: right;
}
.volunteerEmail {
display: inline-block;
height: $height;
padding-left: 4px;
}
.dayTitle {
display: inline-block;
width: 50px;
height: $height;
margin: 0 2px;
text-align: center;
}
.day { .day {
display: inline-block;
width: 50px;
height: $height;
margin: 0 2px;
text-align: center;
background-color: $color-red; background-color: $color-red;
color: transparent;
&.unknown { &.unknown {
background-color: $color-grey-medium; background-color: $color-grey-medium;
} }
&.available { &.available {
background-color: $color-green; background-color: $color-green;
} }

603
yarn.lock

File diff suppressed because it is too large Load Diff