Skip to content

Commit d19184f

Browse files
authored
Merge pull request #3328 from Vizzuality/fix/resizing-of-country-page
Fix/resizing of country page
2 parents 2e82c0c + cda5bd5 commit d19184f

File tree

18 files changed

+149
-364
lines changed

18 files changed

+149
-364
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { PureComponent } from 'react';
22
import Proptypes from 'prop-types';
3+
import Sticky from 'react-stickynode';
34

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

1112
class MapControls extends PureComponent {
1213
render() {
13-
const { handleZoomIn, handleZoomOut } = this.props;
14+
const {
15+
handleZoomIn,
16+
handleZoomOut,
17+
className,
18+
stickyOptions
19+
} = this.props;
1420
return (
15-
<div className="c-map-controls">
16-
<Button theme="theme-button-map-control" onClick={handleZoomIn}>
17-
<Icon icon={plusIcon} className="plus-icon" />
18-
</Button>
19-
<Button theme="theme-button-map-control" onClick={handleZoomOut}>
20-
<Icon icon={minusIcon} className="minus-icon" />
21-
</Button>
21+
<div className={`c-map-controls ${className || ''}`}>
22+
<Sticky enabled={false} {...stickyOptions}>
23+
<Button theme="theme-button-map-control" onClick={handleZoomIn}>
24+
<Icon icon={plusIcon} className="plus-icon" />
25+
</Button>
26+
<Button theme="theme-button-map-control" onClick={handleZoomOut}>
27+
<Icon icon={minusIcon} className="minus-icon" />
28+
</Button>
29+
</Sticky>
2230
</div>
2331
);
2432
}
2533
}
2634

2735
MapControls.propTypes = {
36+
className: Proptypes.string,
2837
handleZoomIn: Proptypes.func,
29-
handleZoomOut: Proptypes.func
38+
handleZoomOut: Proptypes.func,
39+
stickyOptions: Proptypes.object
3040
};
3141

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

33
.c-map-controls {
4-
display: none;
5-
position: absolute;
6-
top: rem(15px);
7-
right: rem(15px);
8-
box-shadow: 0 1px 2px rgba($black, 0.25);
4+
width: rem(38px);
5+
6+
button {
7+
box-shadow: 0 1px 2px rgba($black, 0.25);
8+
}
99

1010
button:first-child {
1111
border-bottom: solid 1px rgba($medium-grey, 0.2);
@@ -20,8 +20,4 @@
2020
width: rem(13px);
2121
height: rem(3px);
2222
}
23-
24-
@media screen and (min-width: $screen-m) {
25-
display: block;
26-
}
2723
}

app/javascript/components/map/map-component.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import Proptypes from 'prop-types';
33

44
import Loader from 'components/loader';
55
import NoContent from 'components/no-content';
6-
import MapControls from 'components/map/components/map-controls';
76
import MiniLegend from 'components/map/components/mini-legend';
87

98
import './map-styles.scss';
109

1110
class Map extends PureComponent {
1211
render() {
13-
const { loading, error, layers, setMapZoom } = this.props;
12+
const { loading, error, layers } = this.props;
1413
return (
1514
<div className="c-map">
1615
{loading && (
@@ -21,12 +20,6 @@ class Map extends PureComponent {
2120
<NoContent message="An error occured. Please try again later." />
2221
)}
2322
<div id="map" className="c-map" />
24-
{!loading && (
25-
<MapControls
26-
handleZoomIn={() => setMapZoom({ value: 1, sum: true })}
27-
handleZoomOut={() => setMapZoom({ value: -1, sum: true })}
28-
/>
29-
)}
3023
{!loading && layers && layers.length && <MiniLegend layers={layers} />}
3124
</div>
3225
);
@@ -36,8 +29,7 @@ class Map extends PureComponent {
3629
Map.propTypes = {
3730
loading: Proptypes.bool.isRequired,
3831
error: Proptypes.bool.isRequired,
39-
layers: Proptypes.array,
40-
setMapZoom: Proptypes.func
32+
layers: Proptypes.array
4133
};
4234

4335
export default Map;

app/javascript/components/no-content/no-content-component.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import './no-content-styles.scss';
66

77
const NoContent = ({ className, message, icon }) => (
88
<div className={`c-no-content ${className}`}>
9-
<p className="message">{message}</p>
10-
{icon && <img className="message-icon" src={tree} alt="tree" />}
9+
<p className="message">
10+
{message}
11+
{icon && <img className="message-icon" src={tree} alt="tree" />}
12+
</p>
1113
</div>
1214
);
1315

app/javascript/components/sticky/sticky-component.jsx

-53
This file was deleted.

app/javascript/components/sticky/sticky-styles.scss

-11
This file was deleted.

app/javascript/components/sticky/sticky.js

-103
This file was deleted.

app/javascript/components/subnav-menu/subnav-menu-styles.scss

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $subnav-height: rem(60px);
44
.c-subnav-menu {
55
background-color: $grey-light;
66
height: $subnav-height;
7+
width: 100%;
78

89
.buttons {
910
display: flex;

app/javascript/packs/about.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ import ReactDOM from 'react-dom';
1111
import About from 'pages/about';
1212

1313
document.addEventListener('DOMContentLoaded', () => {
14-
ReactDOM.render(<About />,
15-
document.getElementById('about-page')
16-
);
14+
ReactDOM.render(<About />, document.getElementById('about-page'));
1715
});

app/javascript/pages/country/header/header-styles.scss

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
padding: rem(50px) 0 rem(30px);
88

99
@media screen and(min-width: $screen-l) {
10-
padding: rem(70px) rem(50px) rem(80px) 0;
11-
}
12-
13-
@media screen and (min-width: $screen-xl) {
14-
padding-left: calc(100% - (#{$max-width} * 0.7));
10+
padding: rem(70px) rem(30px) rem(80px) 0;
1511
}
1612

1713
.share-buttons {

0 commit comments

Comments
 (0)