-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update ui of map badges on list view
- Loading branch information
Showing
16 changed files
with
341 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 0 additions & 161 deletions
161
packages/components/src/MapFilterProfileTypeCardList/MapFilterProfileTypeCardList.tsx
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/components/src/MemberTypeVerticalList/MemberTypeVerticalList.client.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Text } from 'theme-ui' | ||
|
||
import { CardButton } from '../CardButton/CardButton' | ||
import { MemberBadge } from '../MemberBadge/MemberBadge' | ||
import { VerticalList } from '../VerticalList/VerticalList' | ||
|
||
import type { | ||
MapFilterOption, | ||
MapFilterOptionsList, | ||
ProfileTypeName, | ||
} from 'oa-shared' | ||
|
||
export interface IProps { | ||
activeFilters: MapFilterOptionsList | ||
availableFilters: MapFilterOptionsList | ||
onFilterChange: (filter: MapFilterOption) => void | ||
} | ||
|
||
export const MemberTypeVerticalList = (props: IProps) => { | ||
const { activeFilters, availableFilters, onFilterChange } = props | ||
|
||
const items = availableFilters?.filter( | ||
({ filterType }) => filterType === 'profileType', | ||
) | ||
|
||
if (!items || !items.length || items.length < 2) { | ||
return null | ||
} | ||
|
||
return ( | ||
<VerticalList dataCy="MemberTypeVerticalList"> | ||
{items.map((item, index) => { | ||
const active = activeFilters.find( | ||
(filter) => item.label === filter.label, | ||
) | ||
return ( | ||
<CardButton | ||
data-cy={`MemberTypeVerticalList-Item${active ? '-active' : ''}`} | ||
data-testid="MemberTypeVerticalList-Item" | ||
title={item._id} | ||
key={index} | ||
onClick={() => onFilterChange(item)} | ||
extrastyles={{ | ||
background: 'none', | ||
textAlign: 'center', | ||
width: '130px', | ||
minWidth: '130px', | ||
marginX: 1, | ||
height: '75px', | ||
flexDirection: 'column', | ||
...(active | ||
? { | ||
borderColor: 'green', | ||
':hover': { borderColor: 'green' }, | ||
} | ||
: { | ||
borderColor: 'background', | ||
':hover': { borderColor: 'background' }, | ||
}), | ||
}} | ||
> | ||
<MemberBadge size={40} profileType={item._id as ProfileTypeName} /> | ||
<br /> | ||
<Text variant="quiet" sx={{ fontSize: 1 }}> | ||
{item.label} | ||
</Text> | ||
</CardButton> | ||
) | ||
})} | ||
</VerticalList> | ||
) | ||
} |
Oops, something went wrong.