diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 470e4b0295..c11a458218 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -68,3 +68,7 @@ jobs: skip: dependabot/** # Only run when the frontend directory has changes untraced: '!(frontend)/**' + # temp debug options + # debug: true + diagnosticsFile: true + # logFile: true diff --git a/frontend/src/components/Input/Input.tsx b/frontend/src/components/Input/Input.tsx index 281c777019..ad5e570e88 100644 --- a/frontend/src/components/Input/Input.tsx +++ b/frontend/src/components/Input/Input.tsx @@ -33,6 +33,10 @@ export interface InputProps extends ChakraInputProps { * Whether to prevent default on user pressing the 'Enter' key. */ preventDefaultOnEnter?: boolean + /** + * Whether there's an input right element. Used to provide additional padding + */ + hasInputRightElement?: boolean } export const Input = forwardRef((props, ref) => { @@ -45,6 +49,7 @@ export const Input = forwardRef((props, ref) => { 'isPrefilled', 'isPrefillLocked', 'preventDefaultOnEnter', + 'hasInputRightElement', ]) const preventDefault = useMemo( @@ -102,7 +107,11 @@ export const Input = forwardRef((props, ref) => { ref={ref} {...preventDefault} {...inputProps} - sx={props.sx ?? inputStyles.field} + sx={merge( + props.hasInputRightElement ? { pr: '2.75rem' } : {}, + inputStyles.field, + props.sx, + )} /> ) } diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditShortText/EditShortText.tsx b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditShortText/EditShortText.tsx index 88d1172c2b..fceda2a14c 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditShortText/EditShortText.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditShortText/EditShortText.tsx @@ -248,6 +248,7 @@ export const EditShortText = ({ field }: EditShortTextProps): JSX.Element => { field._id ?? 'Field ID will be generated after this field is saved' } + hasInputRightElement={Boolean(field._id)} /> {field._id ? ( diff --git a/frontend/src/features/admin-form/share/ShareFormModal.tsx b/frontend/src/features/admin-form/share/ShareFormModal.tsx index 3611e5e05e..112754f65b 100644 --- a/frontend/src/features/admin-form/share/ShareFormModal.tsx +++ b/frontend/src/features/admin-form/share/ShareFormModal.tsx @@ -279,6 +279,7 @@ export const ShareFormModal = ({ data-chromatic="ignore" isReadOnly value={shareLink} + hasInputRightElement={Boolean(formId)} /> {formId ? ( @@ -314,6 +315,7 @@ export const ShareFormModal = ({ isReadOnly isDisabled={isFormPrivate} value={`${templateLink}`} + hasInputRightElement={Boolean(formId)} /> {formId ? ( @@ -412,6 +414,7 @@ export const ShareFormModal = ({ setGoLinkHelperText(undefined) }} isReadOnly={goLinkSaved} + hasInputRightElement={goLinkSaved} /> {goLinkSaved ? (