diff --git a/src/App.tsx b/src/App.tsx index 0b07059..719c271 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,7 +4,7 @@ /* eslint-disable no-plusplus */ import React, { useEffect, useState } from 'react'; import { csv } from 'd3-fetch'; -import { Radio } from 'antd'; +import { Segmented } from 'antd'; import styled from 'styled-components'; import { ChoroplethMap } from './Components/Graphs/Maps/ChoroplethMap'; import World from './Components/Graphs/Maps/MapData/worldMap.json'; @@ -33,6 +33,25 @@ const StyledSpan = styled.span` } `; +const StyledSegmented = styled(Segmented)` + background-color: var(--gray-200) !important; // Change track background color + + .ant-segmented-item { + &:hover { + background-color: var( + --gray-300 + ) !important; // Change hover background color + } + + &.ant-segmented-item-selected { + background-color: var( + --blue-600 + ) !important; // Change selected item background color + color: white; // Change text color for selected item + } + } +`; + interface ProgrammeDetail { column: string; note: string; @@ -66,9 +85,11 @@ interface ColumnDescription { }; } +type SegmentedValue = string | number; + function App() { const [data, setData] = useState([]); - const [selectedColumn, setSelectedColumn] = useState( + const [selectedColumn, setSelectedColumn] = useState( 'public_finance_budget', ); const [counts, setCounts] = useState(initialState); @@ -151,14 +172,26 @@ function App() { setCounts(newCounts); }) .catch((err: any) => { + // eslint-disable-next-line no-console console.error('Error loading the CSV file:', err); }); }, [selectedColumn]); - const handleSelectColumn = (column: string) => { - setSelectedColumn(column); + const handleSelectColumn = (value: any) => { + setSelectedColumn(value); }; + const options = [ + { label: 'Budgeting', value: 'public_finance_budget' }, + { label: 'Taxation', value: 'public_finance_tax' }, + { label: 'Debt', value: 'public_finance_debt' }, + { + label: 'Insurance and risk', + value: 'insurance_and_risk_finance', + }, + { label: 'Private Capital', value: 'private_capital' }, + ]; + const tooltip = (d: any) => { return (
@@ -176,7 +209,8 @@ function App() {
-
+ +
+
-
- DASHBOARD -
-

- Sustainable Finance Programmes -

- -

- Programme areas -

- { - // eslint-disable-next-line no-console - handleSelectColumn(e.target.value); - }} - > - Budgeting - Taxation - Debt - - Insurance and risk finance - - Private Capital - +
+

+ Sustainable Finance Hub Dashboard{' '} +

+
+

+ Countries with programmes related to +

+ +
+
-
-
+ +
+
({ ...d, x: d[selectedColumn], }))} - backgroundColor - centerPoint={[470, 370]} - scale={270} + backgroundColor='var(--gray-300)' + centerPoint={[430, 360]} + scale={240} + height={600} // domain={[0, 1, 2, 3, 4]} tooltip={tooltip} />
@@ -340,13 +354,12 @@ function App() { > countries with sustainable
- finance programming in total + finance programming in total

@@ -372,7 +385,6 @@ function App() {
diff --git a/src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx b/src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx index 5e58037..a5c3b9f 100644 --- a/src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx +++ b/src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx @@ -107,10 +107,10 @@ export function Graph(props: Props) { key={j} d={masterPath} style={{ - stroke: 'var(--gray-500)', + stroke: 'var(--gray-300)', }} - strokeWidth={0.25} - fill={UNDPColorModule.graphNoData} + strokeWidth={0.5} + fill='var(--gray-400)' /> ); }) @@ -130,10 +130,10 @@ export function Graph(props: Props) { key={j} d={path} style={{ - stroke: 'var(--gray-500)', + stroke: 'var(--gray-300)', }} - strokeWidth={0.25} - fill={UNDPColorModule.graphNoData} + strokeWidth={0.4} + fill='var(--gray-400)' /> ); })} @@ -149,8 +149,8 @@ export function Graph(props: Props) { d.x !== undefined ? d.x === '1' ? UNDPColorModule.categoricalColors.colors[0] - : UNDPColorModule.graphNoData - : UNDPColorModule.graphNoData; + : 'var(--gray-400)' + : 'var(--gray-400)'; return ( ); @@ -226,9 +226,9 @@ export function Graph(props: Props) { key={j} d={path} style={{ - stroke: 'var(--gray-500)', + stroke: 'var(--gray-300)', }} - strokeWidth={0.25} + strokeWidth={0.5} fill={color} /> ); @@ -267,7 +267,7 @@ export function Graph(props: Props) { key={j} d={masterPath} style={{ - stroke: 'var(--gray-700)', + stroke: 'var(--gray-300)', fill: 'none', fillOpacity: 0, strokeWidth: '0.5', @@ -291,7 +291,7 @@ export function Graph(props: Props) { key={j} d={path} style={{ - stroke: 'var(--gray-700)', + stroke: 'var(--gray-300)', fill: 'none', fillOpacity: 0, strokeWidth: '0.5', diff --git a/src/Components/Graphs/Maps/ChoroplethMap/index.tsx b/src/Components/Graphs/Maps/ChoroplethMap/index.tsx index bb860a4..9cfa3fd 100644 --- a/src/Components/Graphs/Maps/ChoroplethMap/index.tsx +++ b/src/Components/Graphs/Maps/ChoroplethMap/index.tsx @@ -22,7 +22,6 @@ interface Props { scale?: number; centerPoint?: [number, number]; backgroundColor?: string | boolean; - padding?: string; tooltip?: (_d: any) => JSX.Element | any; onSeriesMouseOver?: (_d: any) => void; } @@ -43,7 +42,6 @@ export function ChoroplethMap(props: Props) { // categorical, scale, centerPoint, - padding, backgroundColor, tooltip, onSeriesMouseOver, @@ -65,9 +63,7 @@ export function ChoroplethMap(props: Props) { style={{ display: 'flex', width: '100%', - padding: backgroundColor - ? padding || 'var(--spacing-05)' - : padding || 0, + padding: 0, backgroundColor: !backgroundColor ? 'transparent' : backgroundColor === true diff --git a/src/Components/Graphs/Table.tsx b/src/Components/Graphs/Table.tsx index 2d0324a..d2cc478 100644 --- a/src/Components/Graphs/Table.tsx +++ b/src/Components/Graphs/Table.tsx @@ -19,6 +19,7 @@ function Table(props: Props) { ); return ( +
} onChange={e => setSearchTerm(e.target.value)} - style={{ marginBottom: '10px', width: '100%' }} + style={{ width: '100%' }} />
- {' '}
-
Country Name
-
- {FIELDS.map(field => ( + {' '}
-
- {field.label} -
-
- ))} -
- {filteredData.map((rowData, index) => ( -
-
-
- {rowData.countryName} -
+
Country Name
{FIELDS.map(field => (
-
- {rowData[field.key] === '1' ? ( - - ) : null} +
+ {field.label}
))}
- ))} + {filteredData.map((rowData, index) => ( +
+
+
+ {rowData.countryName} +
+
+ {FIELDS.map(field => ( +
+
+ {rowData[field.key] === '1' ? ( + + ) : null} +
+
+ ))} +
+ ))} +
); }