Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / calendar / src / app / components / eventModal / rows / RowLocation.tsx
blobb77ded1197c5d8b4df93c1032ed7b6d21139c49d
1 import { c } from 'ttag';
3 import { Input } from '@proton/atoms';
4 import { IconRow } from '@proton/components';
5 import { LOCATION_INPUT_ID, MAX_CHARS_API } from '@proton/shared/lib/calendar/constants';
6 import type { EventModel } from '@proton/shared/lib/interfaces/calendar';
8 import createHandlers from '../eventForm/createPropFactory';
10 interface Props {
11     canEditSharedEventData: boolean;
12     model: EventModel;
13     setModel: (value: EventModel) => void;
16 export const RowLocation = ({ canEditSharedEventData, model, setModel }: Props) => {
17     if (!canEditSharedEventData) {
18         return null;
19     }
21     return (
22         <IconRow icon="map-pin" title={c('Label').t`Location`} id={LOCATION_INPUT_ID}>
23             <Input
24                 id={LOCATION_INPUT_ID}
25                 placeholder={c('Placeholder').t`Add location`}
26                 maxLength={MAX_CHARS_API.LOCATION}
27                 title={c('Title').t`Add event location`}
28                 {...createHandlers({ model, setModel, field: 'location' }).native}
29             />
30         </IconRow>
31     );