From e58bc02f067e338a2c954f59fbe91b2744da6e49 Mon Sep 17 00:00:00 2001 From: Yoda Date: Sat, 12 Aug 2023 01:06:10 -0700 Subject: [PATCH] Changes --- components/bank/directory/card.js | 2 +- pages/bank/climate/index.js | 125 +++++++++++++++++++++++------- 2 files changed, 97 insertions(+), 30 deletions(-) diff --git a/components/bank/directory/card.js b/components/bank/directory/card.js index 6c6d9c42..4bbb4a69 100644 --- a/components/bank/directory/card.js +++ b/components/bank/directory/card.js @@ -3,7 +3,7 @@ import { Organization } from '../../../pages/bank/climate' import Tilt from '../../../components/tilt' import Icon from '@hackclub/icons' -const Badge = ({ badge }) => badge.image ? ( +export const Badge = ({ badge }) => badge.image ? ( org.isTransparent @@ -33,6 +36,7 @@ export const badges = [ { label: 'Funded', id: '128CollectiveFunded', + tooltip: 'This organization has been funded by 128 Collective', match: org => org.is128Funded, image: 'https://d33wubrfki0l68.cloudfront.net/5fc90935f8126233f42919a6c68601a5d735d798/fa4b2/images/logo.svg' @@ -40,6 +44,7 @@ export const badges = [ { label: 'Recommended', id: '128CollectiveRecommended', + tooltip: 'This organization is recommended by 128 Collective', match: org => org.is128Recommended, image: 'https://d33wubrfki0l68.cloudfront.net/5fc90935f8126233f42919a6c68601a5d735d798/fa4b2/images/logo.svg' @@ -50,6 +55,25 @@ badges.__proto__.forOrg = function (org) { return this.filter(badge => badge.match?.(org)) } +export const tags = [ + { + label: 'Climate', + id: 'Climate', + color: '#1eb36d', + match: org => true + }, + { + label: 'Nonprofit', + id: 'Nonprofit', + color: 'blue', + match: org => true + } +] + +tags.__proto__.forOrg = function (org) { + return this.filter(tag => tag.match?.(org)) +} + export const regions = [ { label: 'North America', @@ -102,7 +126,7 @@ const FilterPanel = ({ filter, mobile }) => { cursor: mobile ? 'pointer' : 'default', ':hover': mobile ? { - color: 'primary' + color: 'blue' } : {} }} @@ -144,7 +168,7 @@ const FilterPanel = ({ filter, mobile }) => { textDecoration: 'none', transition: 'color 0.2s', ':hover': { - color: 'primary' + color: 'blue' }, width: 'fit-content' }} @@ -168,7 +192,10 @@ const FilterPanel = ({ filter, mobile }) => { color: currentSelections.length !== baseData.length ? 'black' - : 'primary' + : 'primary', + ':hover': { + color: 'blue' + }, }} > All @@ -196,7 +223,7 @@ const FilterPanel = ({ filter, mobile }) => { : 'primary', transition: 'color 0.2s', ':hover': { - color: 'primary' + color: 'blue' }, width: 'fit-content' }} @@ -257,7 +284,7 @@ const FilterPanel = ({ filter, mobile }) => { ) } -const RegionPanel = ({ mobile }) => { +const RegionPanel = ({ currentRegion, mobile }) => { const [hiddenOnMobile, setHiddenOnMobile] = useState(mobile) return ( <> @@ -271,7 +298,7 @@ const RegionPanel = ({ mobile }) => { cursor: mobile ? 'pointer' : 'default', ':hover': mobile ? { - color: 'primary' + color: 'blue' } : {} }} @@ -314,7 +341,7 @@ const RegionPanel = ({ mobile }) => { textDecoration: 'none', transition: 'color 0.2s', ':hover': { - color: 'primary' + color: '#B72A3D' }, width: 'fit-content' }} @@ -335,9 +362,9 @@ const RegionPanel = ({ mobile }) => { sx={{ color: 'inherit', fontSize: 3, - color: 'black', + color: !currentRegion ? 'red' : 'black', ':hover': { - color: 'primary' + color: 'blue' }, }} > @@ -360,10 +387,10 @@ const RegionPanel = ({ mobile }) => { borderRadius: '4px', background: mobile ? 'snow' : 'none', textDecoration: 'none', - color: 'black', + color: currentRegion?.label == item.label ? 'red' : 'black', transition: 'color 0.2s', ':hover': { - color: 'primary' + color: 'blue' }, width: 'fit-content' }} @@ -410,24 +437,26 @@ const RegionPanel = ({ mobile }) => { ) } -const Filtering = ({ mobile, ...props }) => { +const Filtering = ({ mobile, region, ...props }) => { + console.log({region}); return ( <> {Object.values(props).map((filter, i) => ( ))} - + ) } export default function ({ rawOrganizations, pageRegion }) { const [searchValue, setSearchValue] = useState('') - const [region, setRegion] = useState(pageRegion); + // const [region, setRegion] = useState(pageRegion); + const region = pageRegion; - useEffect(() => { - // history.pushState(null, null, `/bank/climate/organizations-in-${region.toLowerCase().split(' ').join('-')}`); - }, [region]); + // useEffect(() => { + // // history.pushState(null, null, `/bank/climate/organizations-in-${region.toLowerCase().split(' ').join('-')}`); + // }, [region]); const [modalOrganization, setModalOrganization] = useState(null) let organizations = rawOrganizations @@ -491,24 +520,59 @@ export default function ({ rawOrganizations, pageRegion }) { > - - + + {modalOrganization.name} + {/* Badges */} + + + {tags.forOrg(modalOrganization).map((tag, i) => ( + + + {tag.label} + + ))} + + {badges.map((badge, i) => ( + + ))} + + {/* info & buttons */} @@ -587,7 +651,7 @@ export default function ({ rawOrganizations, pageRegion }) { Make a Donation - All donations are tax-deductible. + All donations are tax-deductible. @@ -725,7 +789,7 @@ export default function ({ rawOrganizations, pageRegion }) { @@ -762,7 +828,7 @@ export default function ({ rawOrganizations, pageRegion }) { onChange={e => setSearchValue(e.target.value)} value={searchValue} sx={{ - border: '1px dashed black', + border: '2px solid ' + theme.colors.muted, textAlign: ['left', 'left', 'left'], width: '100%', height: '100%', @@ -786,6 +852,7 @@ export default function ({ rawOrganizations, pageRegion }) { > @@ -808,7 +875,7 @@ export default function ({ rawOrganizations, pageRegion }) { showTags={true} /> ) - )} + )}