From 1723cb5d67dfcee442f8d21cc10841a4b7ee19d2 Mon Sep 17 00:00:00 2001 From: julian-kbjkjbdkfjb <171458577+julian-kbjkjbdkfjb@users.noreply.github.com> Date: Sat, 31 May 2025 19:35:21 -0400 Subject: [PATCH] Rework of fiscal sponsorship page (#1238) Co-authored-by: Sam Poder --- components/directoryModal.js | 333 +++++++++++++++ .../fiscal-sponsorship/directory/card.js | 2 +- pages/fiscal-sponsorship/directory/index.js | 380 +----------------- 3 files changed, 339 insertions(+), 376 deletions(-) create mode 100644 components/directoryModal.js diff --git a/components/directoryModal.js b/components/directoryModal.js new file mode 100644 index 00000000..999816e0 --- /dev/null +++ b/components/directoryModal.js @@ -0,0 +1,333 @@ +/** @jsxImportSource theme-ui */ + +export const badges = [ + { + label: 'Transparent', + id: 'Transparent', + tooltip: 'Transparent', + color: 'purple', + icon: 'explore', + match: org => org.isTransparent + } +] + +badges.__proto__.forOrg = function (org) { + return this.filter(badge => badge.match?.(org)) +} + + +import { + Badge as ThemeBadge, + Box, + Container, + Flex, + Grid, + Heading, + Input +} from 'theme-ui' +import { Text, Button, Card } from 'theme-ui' +import Icon from '@hackclub/icons' +import OrganizationCard, { + Badge +} from './fiscal-sponsorship/directory/card' +import Tooltip from './fiscal-sponsorship/tooltip' + +export function OrganizationModal({ organization, onClose }) { + return ( + + { + e.stopPropagation() + }} + > + + + + + + + {organization.branding.logo && ( + {`${organization.name}'s + )} + + + {organization.name} + + + {organization.location.country} + + + + + + {/* Badges */} + + {/* hardcoded "nonprofit" badge */} + + Nonprofit + + + {organization.raw.transparent && ( + + Transparent + + )} + + + + {/* info & buttons */} + + {organization.branding.description && ( + + {organization.branding.description} + + )} + + + {organization.links.website && ( + + + + Website + + + + )} + {organization.links.financials && ( + + + + Transparent Finances + + + + )} + + + + + + + All donations are tax-deductible. + + + + + + + + ) +} \ No newline at end of file diff --git a/components/fiscal-sponsorship/directory/card.js b/components/fiscal-sponsorship/directory/card.js index 10941b81..1fe4f8c4 100644 --- a/components/fiscal-sponsorship/directory/card.js +++ b/components/fiscal-sponsorship/directory/card.js @@ -125,7 +125,7 @@ export const OrganizationCard = ({ alt={`${organization.name} logo`} loading="lazy" sx={{ - minWidth: 64, + // minWidth: 64, height: 64, objectFit: 'contain', objectPosition: 'left', diff --git a/pages/fiscal-sponsorship/directory/index.js b/pages/fiscal-sponsorship/directory/index.js index 15c0b320..8ee5c614 100644 --- a/pages/fiscal-sponsorship/directory/index.js +++ b/pages/fiscal-sponsorship/directory/index.js @@ -26,6 +26,7 @@ import theme from '@hackclub/theme' import Tooltip from '../../../components/fiscal-sponsorship/tooltip' const GeoPattern = require('geopattern') import { useRouter } from 'next/router' +import { OrganizationModal, badges } from "../../../components/directoryModal.js" const styles = ` html { @@ -33,17 +34,6 @@ const styles = ` } ` -export const badges = [ - { - label: 'Transparent', - id: 'Transparent', - tooltip: 'Transparent', - color: 'purple', - icon: 'explore', - match: org => org.isTransparent - } -] - export const regions = [ { label: 'North America', @@ -91,18 +81,6 @@ export const regions = [ } ] -badges.__proto__.forOrg = function (org) { - return this.filter(badge => badge.match?.(org)) -} - -export const tags = [ - { - label: 'Nonprofit', - id: 'Nonprofit', - color: 'blue', - match: org => true - } -] export const categories = [ { @@ -131,13 +109,12 @@ export const categories = [ description: `Hackers are using HCB to run hackathons that'll blow your mind away.`, match: org => org.category == 'hackathon', icon: 'event-code' + }, + { + label: "" } ] -tags.__proto__.forOrg = function (org) { - return this.filter(tag => tag.match?.(org)) -} - const FilterPanel = ({ filter, mobile, clearOffset }) => { const [regionsHiddenOnMobile, setRegionsHiddenOnMobile] = useState(mobile) const [categoriesHiddenOnMobile, setCategoriesHiddenOnMobile] = @@ -415,354 +392,7 @@ export default function Directory({ rawOrganizations, pageRegion, category }) { /> {modalOrganization && ( - - { - e.stopPropagation() - }} - > - - - - - - - {modalOrganization.branding.logo && ( - {`${modalOrganization.name}'s - )} - - {modalOrganization.name} - - - - - {/* Badges */} - - {tags.forOrg(modalOrganization).map((tag, i) => ( - - {tag.label} - - ))} - - {badges.forOrg(modalOrganization).map((badge, i) => { - return ( - - - - - - ) - })} - - - - {/* info & buttons */} - - - {modalOrganization.branding.description} - - - {/* mobile stats */} - - - {modalOrganization.location.country} - - - {modalOrganization.location.continent} - - - - - {modalOrganization.links.website && ( - - - - Website - - - - )} - {modalOrganization.links.financials && ( - - - - Transparent Finances - - - - )} - - - {/* desktop stats */} - - - - {modalOrganization.location.country} - - - Country - - - - - {modalOrganization.location.continent} - - - Continent - - - - - - - - - All donations are tax-deductible. - - - - - + )} {!modalOrganization &&