diff --git a/packages/components/assets/icons/contact.svg b/packages/components/assets/icons/contact.svg new file mode 100644 index 0000000000..3f22e48aaa --- /dev/null +++ b/packages/components/assets/icons/contact.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/components/src/ButtonIcon/ButtonIcon.stories.tsx b/packages/components/src/ButtonIcon/ButtonIcon.stories.tsx new file mode 100644 index 0000000000..6e3a61d1ae --- /dev/null +++ b/packages/components/src/ButtonIcon/ButtonIcon.stories.tsx @@ -0,0 +1,12 @@ +import { ButtonIcon } from './ButtonIcon' + +import type { Meta, StoryFn } from '@storybook/react' + +export default { + title: 'Map/ButtonIcon', + component: ButtonIcon, +} as Meta + +export const WithClose: StoryFn = () => ( + +) diff --git a/packages/components/src/ButtonIcon/ButtonIcon.tsx b/packages/components/src/ButtonIcon/ButtonIcon.tsx new file mode 100644 index 0000000000..1a16f5b074 --- /dev/null +++ b/packages/components/src/ButtonIcon/ButtonIcon.tsx @@ -0,0 +1,22 @@ +import { Button } from 'theme-ui' + +import { Icon } from '../Icon/Icon' + +import type { ThemeUIStyleObject } from 'theme-ui' +import type { IGlyphs } from '../Icon/types' + +export interface IProps extends React.ButtonHTMLAttributes { + icon: keyof IGlyphs + sx?: ThemeUIStyleObject | undefined +} + +export const ButtonIcon = (props: IProps) => { + return ( + + ) +} diff --git a/packages/components/src/CardList/CardList.stories.tsx b/packages/components/src/CardList/CardList.stories.tsx index cca6c07228..f04d3ee589 100644 --- a/packages/components/src/CardList/CardList.stories.tsx +++ b/packages/components/src/CardList/CardList.stories.tsx @@ -4,7 +4,7 @@ import type { Meta, StoryFn } from '@storybook/react' import type { ProfileTypeName } from 'oa-shared' export default { - title: 'Layout/CardList', + title: 'Map/CardList', component: CardList, } as Meta diff --git a/packages/components/src/CardList/CardList.tsx b/packages/components/src/CardList/CardList.tsx index 0b1bb24b72..9de5e9ef70 100644 --- a/packages/components/src/CardList/CardList.tsx +++ b/packages/components/src/CardList/CardList.tsx @@ -5,13 +5,13 @@ import { CardListItem } from '../CardListItem/CardListItem' import { Icon } from '../Icon/Icon' import { Loader } from '../Loader/Loader' -import type { ListItem } from '../CardListItem/types' +import type { MapListItem } from '../types/common' export interface IProps { columnsCountBreakPoints?: { [key: number]: number } dataCy: string - filteredList: ListItem[] | null - list: ListItem[] + filteredList: MapListItem[] | null + list: MapListItem[] } export const EMPTY_LIST = 'Oh nos! Nothing to show!' diff --git a/packages/components/src/CardListItem/CardListItem.stories.tsx b/packages/components/src/CardListItem/CardListItem.stories.tsx index 2349c8ae9a..f1413a02db 100644 --- a/packages/components/src/CardListItem/CardListItem.stories.tsx +++ b/packages/components/src/CardListItem/CardListItem.stories.tsx @@ -6,7 +6,7 @@ import type { Meta, StoryFn } from '@storybook/react' import type { ProfileTypeName } from 'oa-shared' export default { - title: 'Components/CardListItem', + title: 'Map/CardListItem', component: CardListItem, } as Meta diff --git a/packages/components/src/CardListItem/CardListItem.tsx b/packages/components/src/CardListItem/CardListItem.tsx index d469551839..b70b264485 100644 --- a/packages/components/src/CardListItem/CardListItem.tsx +++ b/packages/components/src/CardListItem/CardListItem.tsx @@ -1,22 +1,14 @@ -import { Flex } from 'theme-ui' - import { CardButton } from '../CardButton/CardButton' +import { CardProfile } from '../CardProfile/CardProfile' import { InternalLink } from '../InternalLink/InternalLink' -import { CardDetailsFallback } from './CardDetailsFallback' -import { CardDetailsMemberProfile } from './CardDetailsMemberProfile' -import { CardDetailsSpaceProfile } from './CardDetailsSpaceProfile' -import type { ListItem } from './types' +import type { MapListItem } from '../types/common' export interface IProps { - item: ListItem + item: MapListItem } export const CardListItem = ({ item }: IProps) => { - const { creator } = item - - const isMember = creator?.profileType === 'member' - return ( { }} > - - {isMember && } - - {!isMember && creator && ( - - )} - - {!creator && } - + ) diff --git a/packages/components/src/CardListItem/types.ts b/packages/components/src/CardListItem/types.ts deleted file mode 100644 index df5cc0470a..0000000000 --- a/packages/components/src/CardListItem/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { IProfileCreator, ProfileTypeName } from 'oa-shared' - -export interface ListItem { - _id: string - type: ProfileTypeName - isVerified?: boolean - isSupporter?: boolean - subType?: string - creator?: IProfileCreator -} diff --git a/packages/components/src/CardListItem/CardDetailsFallback.tsx b/packages/components/src/CardProfile/CardDetailsFallback.tsx similarity index 94% rename from packages/components/src/CardListItem/CardDetailsFallback.tsx rename to packages/components/src/CardProfile/CardDetailsFallback.tsx index 13fbd0e5fc..be256dd874 100644 --- a/packages/components/src/CardListItem/CardDetailsFallback.tsx +++ b/packages/components/src/CardProfile/CardDetailsFallback.tsx @@ -4,10 +4,10 @@ import { Category } from '../Category/Category' import { MemberBadge } from '../MemberBadge/MemberBadge' import { Username } from '../Username/Username' -import type { ListItem } from './types' +import type { MapListItem } from '../types/common' interface IProps { - item: ListItem + item: MapListItem } export const CardDetailsFallback = ({ item }: IProps) => { diff --git a/packages/components/src/CardListItem/CardDetailsMemberProfile.tsx b/packages/components/src/CardProfile/CardDetailsMemberProfile.tsx similarity index 99% rename from packages/components/src/CardListItem/CardDetailsMemberProfile.tsx rename to packages/components/src/CardProfile/CardDetailsMemberProfile.tsx index 71c865d9ec..d21c25dec0 100644 --- a/packages/components/src/CardListItem/CardDetailsMemberProfile.tsx +++ b/packages/components/src/CardProfile/CardDetailsMemberProfile.tsx @@ -12,6 +12,7 @@ interface IProps { export const CardDetailsMemberProfile = ({ creator }: IProps) => { const { _id, badges, countryCode, profileType, userImage } = creator + return ( { return ( {coverImage && ( - + <> { }} /> - - + > + + + )} @@ -67,7 +73,9 @@ export const CardDetailsSpaceProfile = ({ creator }: IProps) => { {subType && ( { + const { creator } = item + + const isMember = creator?.profileType === 'member' + + return ( + + {isMember && } + {!isMember && creator && } + {!creator && } + + ) +} diff --git a/packages/components/src/CardProfile/types.ts b/packages/components/src/CardProfile/types.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/components/src/FilterList/FilterList.stories.tsx b/packages/components/src/FilterList/FilterList.stories.tsx index 7385651904..cf9195c2fc 100644 --- a/packages/components/src/FilterList/FilterList.stories.tsx +++ b/packages/components/src/FilterList/FilterList.stories.tsx @@ -6,7 +6,7 @@ import type { Meta, StoryFn } from '@storybook/react' import type { ProfileTypeName } from 'oa-shared' export default { - title: 'Components/FilterList', + title: 'Map/FilterList', component: FilterList, } as Meta diff --git a/packages/components/src/FilterList/FilterList.tsx b/packages/components/src/FilterList/FilterList.tsx index 871b83773b..38ef63ccb3 100644 --- a/packages/components/src/FilterList/FilterList.tsx +++ b/packages/components/src/FilterList/FilterList.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react' import { Flex, Text } from 'theme-ui' -import { Button } from '../Button/Button' +import { ButtonIcon } from '../ButtonIcon/ButtonIcon' import { CardButton } from '../CardButton/CardButton' import { MemberBadge } from '../MemberBadge/MemberBadge' @@ -130,25 +130,22 @@ export const FilterList = (props: IProps) => { zIndex: 2, paddingX: 2, position: 'relative', - top: '-65px', + top: '-62px', height: 0, }} > - + + + )} + + ) +} diff --git a/packages/components/src/Username/Username.tsx b/packages/components/src/Username/Username.tsx index 11ebd69d4d..fd8d658196 100644 --- a/packages/components/src/Username/Username.tsx +++ b/packages/components/src/Username/Username.tsx @@ -24,6 +24,7 @@ export const Username = ({ user, sx, isLink = true }: IProps) => { const UserNameBody = ( { return ( { cy.step('New map pins can be clicked on') cy.get(`[data-cy=pin-${userId}]`).click() - cy.get('[data-cy=MapMemberCard]').within(() => { + cy.get('[data-cy=PinProfile]').within(() => { cy.get('[data-cy=Username]').contains(userId) + cy.contains('Wants to get started') }) cy.url().should('include', `#${userId}`) - cy.step('New map pins can be hidden') - cy.get('.markercluster-map').click(0, 0) - cy.get('[data-cy=MapMemberCard]').should('not.exist') + cy.step('New map pins can be hidden with the cross button') + cy.get('[data-cy=PinProfileCloseButton]').click() + cy.get('[data-cy=PinProfile]').should('not.exist') cy.url().should('not.include', `#${userId}`) - cy.step('Mobile list view can be shown/hidden') + cy.step('New map pins can be hidden by clicking the map') + cy.get(`[data-cy=pin-${userId}]`).click() + cy.get('[data-cy=PinProfile]').should('be.visible') + cy.get('.markercluster-map').click(0, 0) + cy.get('[data-cy=PinProfile]').should('not.exist') + + cy.step('Mobile list view can be shown') cy.viewport('samsung-note9') cy.get('[data-cy="CardList-desktop"]').should('not.be.visible') cy.get('[data-cy="CardList-mobile"]').should('not.be.visible') @@ -81,7 +88,10 @@ describe('[Map]', () => { .should('have.attr', 'href') .and('include', `/u/${userId}`) }) + cy.get('[data-cy=FilterList-ButtonRight]').last().click().click().click() + cy.get('[data-cy=MapListFilter]').last().click() + cy.step('Mobile list view can be hidden') cy.get('[data-cy="ShowMapButton"]').click() cy.get('[data-cy="CardList-mobile"]').should('not.be.visible') }) diff --git a/src/pages/Maps/Content/MapView/MapWithList.tsx b/src/pages/Maps/Content/MapView/MapWithList.tsx index 995b8a03c9..8bf11cbbba 100644 --- a/src/pages/Maps/Content/MapView/MapWithList.tsx +++ b/src/pages/Maps/Content/MapView/MapWithList.tsx @@ -218,7 +218,14 @@ export const MapWithList = (props: IProps) => { )} - {activePin && } + {activePin && ( + + )} ) diff --git a/src/pages/Maps/Content/MapView/Popup.tsx b/src/pages/Maps/Content/MapView/Popup.tsx index bc6654fc56..1fe8717387 100644 --- a/src/pages/Maps/Content/MapView/Popup.tsx +++ b/src/pages/Maps/Content/MapView/Popup.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef } from 'react' import { Popup as LeafletPopup } from 'react-leaflet' import L from 'leaflet' -import { MapMemberCard } from 'oa-components' +import { MapMemberCard, PinProfile } from 'oa-components' import { IModerationStatus } from 'oa-shared' import { MAP_GROUPINGS } from 'src/stores/Maps/maps.groupings' @@ -13,12 +13,14 @@ import './popup.css' interface IProps { activePin: IMapPin | IMapPinWithDetail mapRef: React.RefObject + newMap?: boolean + onClose?: () => void } export const Popup = (props: IProps) => { const leafletRef = useRef(null) const activePin = props.activePin as IMapPinWithDetail - const { mapRef } = props + const { mapRef, newMap, onClose } = props useEffect(() => { openPopup() @@ -52,23 +54,26 @@ export const Popup = (props: IProps) => { minWidth={230} maxWidth={230} > - + {newMap && onClose && } + {!newMap && ( + + )} ) )