diff --git a/apps/studio/src/features/editing-experience/components/PageCreateModal.tsx b/apps/studio/src/features/editing-experience/components/PageCreateModal.tsx index 0e8d6680b1..cc8cfd12be 100644 --- a/apps/studio/src/features/editing-experience/components/PageCreateModal.tsx +++ b/apps/studio/src/features/editing-experience/components/PageCreateModal.tsx @@ -71,120 +71,126 @@ export const PageCreateModal = ({ const onSubmit: SubmitHandler = (data) => console.log(data) - return ( - + const [submitted, setSubmitted] = useState(false) + + let content = ( + <> + + Tell us about your new page + - - - - Tell us about your new page - - -
- - - - You can change these later. - - {/* Section 1: Page Title */} - - - Page title - - Title should be descriptive - - + + + + + You can change these later. + + {/* Section 1: Page Title */} + + + Page title + + Title should be descriptive + + + + + value.trim().length !== 0 || ERROR_MESSAGES.TITLE.REQUIRED, + minLength: { + value: 1, + message: ERROR_MESSAGES.MIN_LENGTH, + }, + maxLength: { + value: MAX_TITLE_LENGTH, + message: ERROR_MESSAGES.MAX_LENGTH(MAX_TITLE_LENGTH), + }, + })} + isInvalid={!!errors.title} + /> + {errors.title && errors.title.message ? ( + {errors.title.message} + ) : ( + + {MAX_TITLE_LENGTH - titleLen} characters left + + )} + + {/* Section 2: Page URL */} + + + Page URL + URL should be short and simple + + + + your-site.gov.sg/ + - value.trim().length !== 0 || - ERROR_MESSAGES.TITLE.REQUIRED, + type="tel" + defaultValue={'hello-world'} + color="base.content.default" + {...register('url', { + required: ERROR_MESSAGES.URL.REQUIRED, minLength: { value: 1, message: ERROR_MESSAGES.MIN_LENGTH, }, maxLength: { - value: MAX_TITLE_LENGTH, - message: ERROR_MESSAGES.MAX_LENGTH(MAX_TITLE_LENGTH), + value: MAX_PAGE_URL_LENGTH, + message: ERROR_MESSAGES.MAX_LENGTH(MAX_PAGE_URL_LENGTH), }, })} - isInvalid={!!errors.title} + isInvalid={!!errors.url} /> - {errors.title && errors.title.message ? ( - {errors.title.message} - ) : ( - - {MAX_TITLE_LENGTH - titleLen} characters left - - )} - + - {/* Section 2: Page URL */} - - - Page URL - - URL should be short and simple - - - - - your-site.gov.sg/ - - - + {errors.url && errors.url.message ? ( + {errors.url.message} + ) : ( + + {MAX_PAGE_URL_LENGTH - pageUrlLen} characters left + + )} + + + - {errors.url && errors.url.message ? ( - {errors.url.message} - ) : ( - - {MAX_PAGE_URL_LENGTH - pageUrlLen} characters left - - )} - - - + + + + +
+ + ) - - - - - -
+ if (submitted) { + // TODO: set content to layout selector + } + return ( + + + + {content} ) }