Skip to content

Commit

Permalink
fix: FRM-1819 add custom detection element addon flag
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed Sep 18, 2024
1 parent f8514e4 commit c4803dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion frontend/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputProps, 'input'>((props, ref) => {
Expand All @@ -45,6 +49,7 @@ export const Input = forwardRef<InputProps, 'input'>((props, ref) => {
'isPrefilled',
'isPrefillLocked',
'preventDefaultOnEnter',
'hasInputRightElement',
])

const preventDefault = useMemo(
Expand Down Expand Up @@ -102,7 +107,11 @@ export const Input = forwardRef<InputProps, 'input'>((props, ref) => {
ref={ref}
{...preventDefault}
{...inputProps}
sx={props.sx ?? inputStyles.field}
sx={merge(
props.hasInputRightElement ? { pr: '2.75rem' } : {},
inputStyles.field,
props.sx,
)}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<InputRightElement>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/features/admin-form/share/ShareFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const ShareFormModal = ({
data-chromatic="ignore"
isReadOnly
value={shareLink}
hasInputRightElement={Boolean(formId)}
/>
{formId ? (
<InputRightElement>
Expand Down Expand Up @@ -314,6 +315,7 @@ export const ShareFormModal = ({
isReadOnly
isDisabled={isFormPrivate}
value={`${templateLink}`}
hasInputRightElement={Boolean(formId)}
/>
{formId ? (
<InputRightElement>
Expand Down Expand Up @@ -412,6 +414,7 @@ export const ShareFormModal = ({
setGoLinkHelperText(undefined)
}}
isReadOnly={goLinkSaved}
hasInputRightElement={goLinkSaved}
/>
{goLinkSaved ? (
<InputRightElement>
Expand Down

0 comments on commit c4803dd

Please sign in to comment.