Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/resizing of country page #3328

Merged
merged 5 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { PureComponent } from 'react';
import Proptypes from 'prop-types';
import Sticky from 'react-stickynode';

import Button from 'components/button';
import Icon from 'components/icon';
Expand All @@ -10,23 +11,32 @@ import './map-controls-styles.scss';

class MapControls extends PureComponent {
render() {
const { handleZoomIn, handleZoomOut } = this.props;
const {
handleZoomIn,
handleZoomOut,
className,
stickyOptions
} = this.props;
return (
<div className="c-map-controls">
<Button theme="theme-button-map-control" onClick={handleZoomIn}>
<Icon icon={plusIcon} className="plus-icon" />
</Button>
<Button theme="theme-button-map-control" onClick={handleZoomOut}>
<Icon icon={minusIcon} className="minus-icon" />
</Button>
<div className={`c-map-controls ${className || ''}`}>
<Sticky enabled={false} {...stickyOptions}>
<Button theme="theme-button-map-control" onClick={handleZoomIn}>
<Icon icon={plusIcon} className="plus-icon" />
</Button>
<Button theme="theme-button-map-control" onClick={handleZoomOut}>
<Icon icon={minusIcon} className="minus-icon" />
</Button>
</Sticky>
</div>
);
}
}

MapControls.propTypes = {
className: Proptypes.string,
handleZoomIn: Proptypes.func,
handleZoomOut: Proptypes.func
handleZoomOut: Proptypes.func,
stickyOptions: Proptypes.object
};

export default MapControls;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import '~styles/settings.scss';

.c-map-controls {
display: none;
position: absolute;
top: rem(15px);
right: rem(15px);
box-shadow: 0 1px 2px rgba($black, 0.25);
width: rem(38px);

button {
box-shadow: 0 1px 2px rgba($black, 0.25);
}

button:first-child {
border-bottom: solid 1px rgba($medium-grey, 0.2);
Expand All @@ -20,8 +20,4 @@
width: rem(13px);
height: rem(3px);
}

@media screen and (min-width: $screen-m) {
display: block;
}
}
12 changes: 2 additions & 10 deletions app/javascript/components/map/map-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import Proptypes from 'prop-types';

import Loader from 'components/loader';
import NoContent from 'components/no-content';
import MapControls from 'components/map/components/map-controls';
import MiniLegend from 'components/map/components/mini-legend';

import './map-styles.scss';

class Map extends PureComponent {
render() {
const { loading, error, layers, setMapZoom } = this.props;
const { loading, error, layers } = this.props;
return (
<div className="c-map">
{loading && (
Expand All @@ -21,12 +20,6 @@ class Map extends PureComponent {
<NoContent message="An error occured. Please try again later." />
)}
<div id="map" className="c-map" />
{!loading && (
<MapControls
handleZoomIn={() => setMapZoom({ value: 1, sum: true })}
handleZoomOut={() => setMapZoom({ value: -1, sum: true })}
/>
)}
{!loading && layers && layers.length && <MiniLegend layers={layers} />}
</div>
);
Expand All @@ -36,8 +29,7 @@ class Map extends PureComponent {
Map.propTypes = {
loading: Proptypes.bool.isRequired,
error: Proptypes.bool.isRequired,
layers: Proptypes.array,
setMapZoom: Proptypes.func
layers: Proptypes.array
};

export default Map;
6 changes: 4 additions & 2 deletions app/javascript/components/no-content/no-content-component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import './no-content-styles.scss';

const NoContent = ({ className, message, icon }) => (
<div className={`c-no-content ${className}`}>
<p className="message">{message}</p>
{icon && <img className="message-icon" src={tree} alt="tree" />}
<p className="message">
{message}
{icon && <img className="message-icon" src={tree} alt="tree" />}
</p>
</div>
);

Expand Down
53 changes: 0 additions & 53 deletions app/javascript/components/sticky/sticky-component.jsx

This file was deleted.

11 changes: 0 additions & 11 deletions app/javascript/components/sticky/sticky-styles.scss

This file was deleted.

103 changes: 0 additions & 103 deletions app/javascript/components/sticky/sticky.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $subnav-height: rem(60px);
.c-subnav-menu {
background-color: $grey-light;
height: $subnav-height;
width: 100%;

.buttons {
display: flex;
Expand Down
4 changes: 1 addition & 3 deletions app/javascript/packs/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ import ReactDOM from 'react-dom';
import About from 'pages/about';

document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(<About />,
document.getElementById('about-page')
);
ReactDOM.render(<About />, document.getElementById('about-page'));
});
6 changes: 1 addition & 5 deletions app/javascript/pages/country/header/header-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
padding: rem(50px) 0 rem(30px);

@media screen and(min-width: $screen-l) {
padding: rem(70px) rem(50px) rem(80px) 0;
}

@media screen and (min-width: $screen-xl) {
padding-left: calc(100% - (#{$max-width} * 0.7));
padding: rem(70px) rem(30px) rem(80px) 0;
}

.share-buttons {
Expand Down
Loading