Skip to content

Commit

Permalink
Connect data, Add filters
Browse files Browse the repository at this point in the history
  • Loading branch information
balagurova committed Jul 9, 2024
1 parent 97456a9 commit 6ced6c2
Show file tree
Hide file tree
Showing 9 changed files with 410 additions and 707 deletions.
642 changes: 98 additions & 544 deletions src/App.tsx

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions src/Components/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Checkbox, CheckboxOptionType } from 'antd';

interface CheckboxGroupProps {
options: CheckboxOptionType[];
value: string[];
onChange: (checkedValues: string[]) => void;
}

function CheckboxGroup(props: CheckboxGroupProps): JSX.Element {
const { options, value, onChange } = props;

return (
<div
className='padding-04'
style={{ border: '0.06rem solid var(--gray-400)' }}
>
<p className='undp-typography label'>Filter by subprogrammes</p>
<Checkbox.Group
options={options}
value={value}
className='undp-checkbox'
onChange={checkedValues => onChange(checkedValues as string[])}
/>
</div>
);
}

export default CheckboxGroup;
63 changes: 63 additions & 0 deletions src/Components/Constants.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Leaf, School, BriefcaseBusiness, Flag, Shell } from 'lucide-react';

// constants.ts
export interface Programme {
label: string;
value: string;
color: string;
icon: any;
subcategories?: Subcategory[];
}

export interface Subcategory {
label: string;
value: string;
}

export const PROGRAMMES: Programme[] = [
{
label: 'All Sustainable Financial Programmes',
value: 'all_programmes',
color: '#006EB5',
icon: Leaf,
},
{
label: 'Public finance for the SDGs',
value: 'public',
color: '#5DD4F0',
icon: School,
subcategories: [
{ label: 'Sub Programme 1.1', value: 'subProgramme1.1' },
{ label: 'Sub Programme 1.2', value: 'subProgramme1.2' },
],
},
{
label: 'Unlocking private capital and aligning for the SDGs',
value: 'private',
color: '#02A38A',
icon: BriefcaseBusiness,
subcategories: [
{ label: 'Sub Programme 2.1', value: 'subProgramme2.1' },
{ label: 'Sub Programme 2.2', value: 'subProgramme2.2' },
],
},
{
label: 'Integrated National Financing Frameworks',
value: 'frameworks',
color: '#E78625',
icon: Flag,
},
{
label: 'Biofin',
value: 'biofin',
color: '#E0529E',
icon: Shell,
},
];

export const GROUPS = [
{ label: 'All Countries', value: 'allCountries' },
{ label: 'Fragile and Affected', value: 'fragile_affected' },
{ label: 'LDC', value: 'ldc' },
{ label: 'SIDS', value: 'sids' },
];
34 changes: 34 additions & 0 deletions src/Components/Filter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Radio } from 'antd';
import styled from 'styled-components';
import { GROUPS } from './Constants';

const StyledRadioGroup = styled(Radio.Group)`
display: flex;
flex-direction: column; // Display items in one column
`;

interface CountryGroupProps {
onRadioChange: (value: string) => void; // Callback function prop for Radio Group
selectedRadio: string; // Selected radio value
}

function FilterCountryGroup(props: CountryGroupProps): JSX.Element {
const { onRadioChange, selectedRadio } = props;

return (
<div
className='padding-04'
style={{ border: '0.06rem solid var(--gray-400)' }}
>
<p className='undp-typography label'>Filter by country group</p>
<StyledRadioGroup
options={GROUPS}
value={selectedRadio}
onChange={(e: any) => onRadioChange(e.target.value)}
className='undp-radio'
/>
</div>
);
}

export default FilterCountryGroup;
Loading

0 comments on commit 6ced6c2

Please sign in to comment.