Skip to content

Commit b985a8c

Browse files
Merge pull request #4683 from wri/feat/add-tree-cover-density-to-ttc-layer-FLAG-844
[FLAG-844] Add tree cover density to analysis
2 parents 92f87da + f78a89b commit b985a8c

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import cx from 'classnames';
34

4-
const AxisLabel = ({ label, direction }) => (
5+
const AxisLabel = ({ label, direction, isSimple = false }) => (
56
<>
67
<foreignObject
78
width="100%"
89
height="100%"
910
className={`${direction}-label-container`}
1011
>
1112
<div className={`${direction}-label`}>
12-
<span>{label}</span>
13+
<span
14+
className={cx({
15+
'simple-mode-label': isSimple,
16+
})}
17+
>
18+
{label}
19+
</span>
1320
</div>
1421
</foreignObject>
1522
</>
@@ -18,6 +25,7 @@ const AxisLabel = ({ label, direction }) => (
1825
AxisLabel.propTypes = {
1926
label: PropTypes.string,
2027
direction: PropTypes.string,
28+
isSimple: PropTypes.bool,
2129
};
2230

2331
export default AxisLabel;

components/charts/composed-chart/component.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class CustomComposedChart extends PureComponent {
177177
<div
178178
className={cx('c-composed-chart', className, {
179179
'overflow-x-visible': hasLabels,
180+
'no-padding': simple,
180181
})}
181182
style={{
182183
height: simple ? 110 : height || 250,
@@ -237,7 +238,13 @@ class CustomComposedChart extends PureComponent {
237238
interval="preserveStartEnd"
238239
{...xAxis}
239240
{...(config?.xAxis?.label && {
240-
label: <AxisLabel label={config?.xAxis?.label} direction="x" />,
241+
label: (
242+
<AxisLabel
243+
label={config?.xAxis?.label}
244+
direction="x"
245+
isSimple={simple}
246+
/>
247+
),
241248
})}
242249
/>
243250
{(!simple || simpleNeedsAxis) && (

components/charts/composed-chart/styles.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ $layout-breakpoint-3xl: 1536px;
4949
overflow-x: visible !important;
5050
}
5151

52+
.no-padding {
53+
padding: 0 !important;
54+
}
55+
5256
.x-label-container,
5357
.y-label-container {
5458
position: relative;
@@ -58,6 +62,10 @@ $layout-breakpoint-3xl: 1536px;
5862

5963
span {
6064
font-size: 0.8125rem;
65+
66+
&.simple-mode-label {
67+
font-size: 0.625rem !important;
68+
}
6169
}
6270
}
6371

components/widget/components/widget-footer/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
}
2424

2525
&.simple {
26+
margin-top: 1.25rem;
2627
font-size: rem(10px);
2728

2829
p {

components/widgets/land-cover/tree-cover-density/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
types: ['country', 'wdpa', 'aoi'],
2020
admins: ['adm0', 'adm1', 'adm2'],
2121
large: true,
22-
visible: ['dashboard'],
22+
visible: ['dashboard', 'analysis'],
2323
chartType: 'composedChart',
2424
colors: 'density',
2525
settingsConfig: [

0 commit comments

Comments
 (0)