hide some activities on calendar depending on screen width - #46

This commit is contained in:
Sam 2020-01-28 19:34:10 +01:00
parent 5ad074bb1f
commit c8c1074604
2 changed files with 61 additions and 3 deletions

View File

@ -248,6 +248,13 @@ label {
.custom-fa-small { .custom-fa-small {
font-size: 0.8em; font-size: 0.8em;
margin-left: -0.8em;
}
@media only screen and (max-width: 992px) {
.custom-fa-small {
font-size: 0.6em;
}
} }
.custom-tooltip { .custom-tooltip {
@ -598,3 +605,47 @@ label {
.calendar .body .weekend { .calendar .body .weekend {
background: #f5f5f5; background: #f5f5f5;
} }
.calendar-activity,
.calendar-more {
display: none;
}
.calendar-more {
color: #405976;
font-size: .7em;
margin-left: 0.3em;
}
@media only screen and (max-width: 992px) {
.calendar-activity:nth-child(-n+2) {
display: inline-block;
}
.calendar-activity:nth-child(n+3) ~ .calendar-more {
display: inline-block;
}
}
@media only screen and (min-width: 992px) and (max-width: 1200px) {
.calendar-activity:nth-child(-n+4){
display: inline-block;
}
.calendar-activity:nth-child(n+5) ~ .calendar-more {
display: inline-block;
}
}
@media only screen and (min-width: 1200px) {
.calendar-activity:nth-child(-n+6) {
display: inline-block;
}
.calendar-activity:nth-child(n+7) ~ .calendar-more {
display: inline-block;
}
}

View File

@ -7,9 +7,13 @@ export default class CalendarActivities extends React.PureComponent {
render() { render() {
const { dayActivities, isDisabled, sports } = this.props const { dayActivities, isDisabled, sports } = this.props
return ( return (
<> <div>
{dayActivities.map(act => ( {dayActivities.map(act => (
<Link key={act.id} to={`/activities/${act.id}`}> <Link
className="calendar-activity"
key={act.id}
to={`/activities/${act.id}`}
>
<> <>
<img <img
alt="activity sport logo" alt="activity sport logo"
@ -36,7 +40,10 @@ export default class CalendarActivities extends React.PureComponent {
</> </>
</Link> </Link>
))} ))}
</> {dayActivities.length > 2 && (
<i className="fa fa-plus-circle calendar-more" aria-hidden="true" />
)}
</div>
) )
} }
} }