diff --git a/src/assets/contributors-map.geojson b/src/assets/contributors-map.json similarity index 100% rename from src/assets/contributors-map.geojson rename to src/assets/contributors-map.json diff --git a/src/components/about/ContributorMap.tsx b/src/components/about/ContributorMap.tsx new file mode 100644 index 000000000..9b6b38a34 --- /dev/null +++ b/src/components/about/ContributorMap.tsx @@ -0,0 +1,122 @@ +import BaseMap from '../maps/BaseMap' +import { Marker } from 'react-map-gl' +import contributorsData from '../../assets/contributors-map.json' +import useAutoSizing from '../../js/hooks/finder/useMapAutoSizing' +import { MobileDialog, DialogContent, DialogTrigger } from '../ui/MobileDialog' +import { MapPinIcon, UsersIcon } from '@heroicons/react/24/outline' +import { XViewStateType } from '../../js/types' +import { useEffect } from 'react' + +export interface ContributorType{ + firstName?: string + githubId?: string + favoriteCrag?: string +} +interface ContributorDataType{ + properties: ContributorType + type: string + geometry: GeometryType +} + +interface MapProps{contributor: ContributorType} + +const ContributorCardTrigger: React.FC = ({ contributor }) => { + return ( + + +
+ +
+
+ + + +
+ ) +} + +const ContributorCard: React.FC = ({ contributor }) => { + const { firstName, githubId, favoriteCrag } = contributor + return ( + +
+ +
+ +
+
+ +

{firstName}

+ + {githubId != null && + GitHub + } + + {favoriteCrag != null &&

Favorite crag: {favoriteCrag}

} +
+
+ ) +} + +interface GeometryType{ + type: string + coordinates: number[] +} + +export function ContributorMap (): JSX.Element { + const mapElementId = 'contributors-map' + + const contributors: ContributorDataType[] = contributorsData.features + + const initialViewState: XViewStateType = { + width: 300, + height: 1024, + padding: { top: 20, bottom: 20, left: 20, right: 20 }, + bearing: 0, + zoom: 1, + pitch: 0, + latitude: 36.079693291728546, + longitude: -115.5, + bbox: [0, 0, 0, 0] + } + const [viewState, height, setViewState] = useAutoSizing({ geojson: null, elementId: mapElementId }) + + useEffect(() => { + setViewState(initialViewState) + }, []) + + return ( + <> +
+ + {contributors.map((feature, index) => { + return ( + + + + ) + })} + +
+ + + ) +} diff --git a/src/components/ui/MobileDialog.tsx b/src/components/ui/MobileDialog.tsx index c4b40f5a6..1a6bab6c2 100644 --- a/src/components/ui/MobileDialog.tsx +++ b/src/components/ui/MobileDialog.tsx @@ -5,6 +5,7 @@ import clx from 'classnames' interface Props { title?: string | ReactNode fullScreen?: boolean + small?: boolean children: ReactNode | ReactNode[] onInteractOutside?: (event: any) => void } @@ -14,12 +15,12 @@ interface Props { * @param fullScreen Optional flag to expand the dialog to max screen width & height */ export const DialogContent = React.forwardRef( - ({ title, children, fullScreen = false, ...props }, forwardedRef) => + ({ title, children, small = false, fullScreen = false, ...props }, forwardedRef) => ( {title} diff --git a/src/pages/about.tsx b/src/pages/about.tsx index e7655190f..7ed9fbbdf 100644 --- a/src/pages/about.tsx +++ b/src/pages/about.tsx @@ -5,6 +5,7 @@ import Cairn from '../assets/icons/stones.png' import Seed from '../assets/icons/seed.png' import Watering from '../assets/icons/watering-can.png' import SeoTags from '../components/SeoTags' +import { ContributorMap } from '../components/about/ContributorMap' const About = (): JSX.Element => { return ( @@ -52,6 +53,9 @@ const About = (): JSX.Element => {

OpenBeta is a 501(c)(3) nonprofit collective. Donations are tax-deductible to the extent allowed by law.

+ + +

Learn more

Why is an open license important?

diff --git a/src/styles/defaults.css b/src/styles/defaults.css index 63f637613..2fdda04d5 100644 --- a/src/styles/defaults.css +++ b/src/styles/defaults.css @@ -132,6 +132,10 @@ a:active, a:focus { @apply top-0 left-0 h-screen md:dialog-center fixed z-50 w-screen max-w-screen-md bg-base-100 lg:drop-shadow-lg overflow-y-auto h-fit max-h-screen lg:max-h-[95vh]; } + .dialog-small { + @apply top-0 left-0 md:dialog-center fixed z-50 w-full md:h-auto max-w-screen-sm bg-base-100 lg:drop-shadow-lg overflow-y-auto; + } + .dialog-wide { @apply top-0 left-0 fixed z-50 w-full h-full w-screen h-screen bg-base-100 overflow-y-auto overscroll-contain; }