-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
431 additions
and
537 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
59 changes: 59 additions & 0 deletions
59
components/signalement/signalement-form-existing-location.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,59 @@ | ||
import { Pane, Text } from "evergreen-ui"; | ||
import React from "react"; | ||
import { Numero, Toponyme, Voie } from "@/lib/openapi"; | ||
import AddressPreview from "../bal/address-preview"; | ||
import { CommuneType } from "@/types/commune"; | ||
|
||
interface SignalementFormExistingLocationProps { | ||
existingLocation: Voie | Toponyme | Numero; | ||
commune: CommuneType; | ||
} | ||
|
||
function SignalementFormExistingLocation({ | ||
existingLocation, | ||
commune, | ||
}: SignalementFormExistingLocationProps) { | ||
if ((existingLocation as Numero).numero) { | ||
const { | ||
numero: existingNumero, | ||
suffixe: existingSuffixe, | ||
toponyme: { nom: existingNomToponyme }, | ||
voie: { nom: existingNomVoie }, | ||
} = existingLocation as Numero; | ||
return ( | ||
<AddressPreview | ||
numero={existingNumero} | ||
suffixe={existingSuffixe} | ||
selectedNomToponyme={existingNomToponyme} | ||
voie={existingNomVoie} | ||
commune={commune} | ||
/> | ||
); | ||
} else if ((existingLocation as Toponyme | Voie).nom) { | ||
const { nom: existingNom } = existingLocation as Toponyme | Voie; | ||
const address = `${existingNom} - ${commune.nom} (${commune.code})`; | ||
return ( | ||
<Pane | ||
position="sticky" | ||
top={-12} | ||
marginLeft={-12} | ||
marginRight={-12} | ||
transition="left 0.3s" | ||
boxSizing="border-box" | ||
zIndex={3} | ||
background="blue300" | ||
paddingY={8} | ||
paddingX={12} | ||
marginTop={-24} | ||
> | ||
<Text fontSize={address.length > 110 ? "12px" : "13px"} color="white"> | ||
{address} | ||
</Text> | ||
</Pane> | ||
); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
export default SignalementFormExistingLocation; |
Oops, something went wrong.