Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Thématiques] Ajouter une possibilité de recherche dans le menu des filtres "thématique réglementaire" #1384

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function MyAMPLayerGroup({
{groupName}
</LayerSelector.GroupName>
<LayerSelector.IconGroup>
<LayerSelector.NumberOfZones>{`${layers?.length} / ${totalNumberOfZones}`}</LayerSelector.NumberOfZones>
<LayerSelector.NumberOfZones>{`${layers?.length}/${totalNumberOfZones}`}</LayerSelector.NumberOfZones>
<IconButton
accent={Accent.TERTIARY}
color={ampZonesAreShowed ? THEME.color.charcoal : THEME.color.lightGray}
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/features/layersSelector/search/LayerFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Option, Accent, CheckPicker, SingleTag } from '@mtes-mct/monitor-ui'
import { type Option, Accent, CheckPicker, CustomSearch, SingleTag } from '@mtes-mct/monitor-ui'
import { useMemo } from 'react'
import styled from 'styled-components'

type LayerFiltersProps = {
Expand Down Expand Up @@ -35,9 +36,17 @@ export function LayerFilters({
setFilteredRegulatoryThemes(filteredRegulatoryThemes.filter(theme => theme !== v))
}

const regulatoryThemesCustomSearch = useMemo(
() => new CustomSearch(regulatoryThemes as Array<Option>, ['label']),
[regulatoryThemes]
)

const AMPCustomSearch = useMemo(() => new CustomSearch(ampTypes as Array<Option>, ['label']), [ampTypes])

return (
<FiltersWrapper>
<CheckPicker
customSearch={regulatoryThemesCustomSearch}
isLabelHidden
label="Thématique réglementaire"
name="regulatoryThemes"
Expand Down Expand Up @@ -66,6 +75,7 @@ export function LayerFilters({
</TagWrapper>

<CheckPicker
customSearch={AMPCustomSearch}
isLabelHidden
label="Type d'AMP"
name="ampTypes"
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/features/layersSelector/search/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,4 @@ const NumberOfFilters = styled(Tag)`
right: -5px;
z-index: 100;
font-size: 12px;
line-height: 13px;
padding: 0px 5px 1px;
`
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const NoLayerSelected = styled.div`
const NumberOfZones = styled.span`
color: ${p => p.theme.color.slateGray};
font-weight: 400;
padding-right: 3px;
`

const Wrapper = styled.div<{ $hasPinnedLayers?: boolean; $isExpanded: boolean }>`
Expand Down
Loading