Skip to content

Commit

Permalink
Fix content overflowing responsive issue in MapSwipe Stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
royallsilwallz committed Oct 21, 2024
1 parent bc4d753 commit f10eae6
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/partnerMapswipeStats/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const Overview = () => {
{data?.nameInsideProvider}
</h3>
<div
className="flex justify-between items-stretch flex-wrap flex-nowrap-ns"
className="flex justify-between items-stretch flex-wrap flex-nowrap-l"
style={{ gap: '1.6rem' }}
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ProjectTypeAreaStats = ({

return (
<div
className="flex justify-between items-center flex-wrap flex-nowrap-ns"
className="flex justify-between items-center flex-wrap flex-nowrap-l"
style={{ gap: '1.6rem' }}
>
<div className="pa4 flex items-center bg-white shadow-6 w-100" style={{ gap: '1.75rem' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ export const SwipesByOrganization = ({ contributionsByOrganization = [] }) => {
}, []);

return (
<div style={{ width: '48.5%' }}>
<div className="mapswipe-stats-piechart">
<h3 className="f2 fw6 ttu barlow-condensed blue-dark mt0 pt2 mb4">
<FormattedMessage {...messages.swipesByOrganization} />
</h3>

<div className="bg-white pa4 shadow-6 relative" style={{ height: '450px' }}>
<canvas ref={chartRef}></canvas>
{contributionsByOrganization.length === 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const SwipesByProjectType = ({ contributionsByProjectType = [] }) => {
}, []);

return (
<div style={{ width: '48.5%' }}>
<div className="mapswipe-stats-piechart">
<h3 className="f2 fw6 ttu barlow-condensed blue-dark mt0 pt2 mb4">
<FormattedMessage {...messages.swipesByProjectType} />
</h3>
Expand Down
17 changes: 0 additions & 17 deletions frontend/src/views/partnersMapswipeStats.css

This file was deleted.

10 changes: 5 additions & 5 deletions frontend/src/views/partnersMapswipeStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { SwipesByProjectType } from '../components/partnerMapswipeStats/swipesBy
import { SwipesByOrganization } from '../components/partnerMapswipeStats/swipesByOrganization';
import messages from './messages';
import { fetchLocalJSONAPI } from '../network/genericJSONRequest';
import './partnersMapswipeStats.css';
import './partnersMapswipeStats.scss';

const PagePlaceholder = () => (
<div className="bg-tan flex flex-column" style={{ gap: '1.25rem' }}>
Expand Down Expand Up @@ -141,24 +141,24 @@ export const PartnersMapswipeStats = () => {
</div>

<div
className="mt4 flex items-center justify-between f1 barlow-condensed"
className="mt4 mapswipe-stats-swipes-container f1 barlow-condensed"
style={{ gap: '1.6rem' }}
>
<div className="pa4 shadow-6 bg-white" style={{ flexBasis: '32.5%' }}>
<div className="pa4 shadow-6 bg-white" style={{ flex: '0 0 32.5%' }}>
<span className="red fw6">{getSwipes()}</span>
<span className="silver fw2 ml3">
<FormattedMessage {...messages.swipes} />
</span>
</div>
<div className="pa4 shadow-6 bg-white" style={{ flexBasis: '66.5%' }}>
<div className="pa4 shadow-6 bg-white" style={{ flexBasis: '100%' }}>
<span className="red fw6">{getTimeSpentContributing()}</span>
<span className="silver fw2 ml3">
<FormattedMessage {...messages.timeSpentContributing} />
</span>
</div>
</div>

<div className="mt3 flex items-center justify-between">
<div className="mt3 items-center justify-between mapswipe-stats-piechart-container">
<SwipesByProjectType contributionsByProjectType={data?.contributionsByProjectType} />
<SwipesByOrganization
contributionsByOrganization={data?.contributionsByorganizationName}
Expand Down
42 changes: 42 additions & 0 deletions frontend/src/views/partnersMapswipeStats.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.mapswipe-stats-info-banner {
background-color: #d9d7d7;
width: fit-content;
margin-left: 20px;
border-radius: 3px;
&::before {
content: '';
position: absolute;
left: -20px;
top: 0;
bottom: 0;
width: 20px;
/* background-color: #d9d7d7; */
clip-path: polygon(100% 0, 0 50%, 100% 100%);
}
}

$medium: 960px;

.mapswipe-stats-piechart-container {
display: flex;
flex-direction: row;
@media screen and (max-width: $medium) {
flex-direction: column;
gap: 2rem;
}
}

.mapswipe-stats-piechart {
width: 48.5%;
@media screen and (max-width: $medium) {
width: 100%;
}
}

.mapswipe-stats-swipes-container {
display: flex;
flex-direction: row;
@media screen and (max-width: $medium) {
flex-direction: column;
}
}

0 comments on commit f10eae6

Please sign in to comment.