Skip to content

Commit

Permalink
Add buttons disabled on edit of other fields
Browse files Browse the repository at this point in the history
  • Loading branch information
7emansell committed Dec 16, 2024
1 parent 040aabf commit 0cc96cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/MyAccount/Settings/AddButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import { forwardRef } from "react"
type AddButtonProps = {
inputType?: string
label: string
isDisabled?: boolean
onClick: () => void
}

const AddButton = forwardRef<HTMLButtonElement, AddButtonProps>(
({ inputType, label, onClick }, ref) => {
({ inputType, label, isDisabled, onClick }, ref) => {
return (
<Button
ref={ref}
id={inputType ? `add-${inputType}-button` : "add-button"}
buttonType="text"
onClick={onClick}
size="large"
isDisabled={isDisabled}
sx={{
justifyContent: "flex-start",
width: { base: "100%", md: "300px" },
Expand Down
1 change: 1 addition & 0 deletions src/components/MyAccount/Settings/SettingsInputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ const SettingsInputForm = ({
// User has no phone or email.
<Box sx={{ marginTop: { base: "unset", lg: "-xs" } }}>
<AddButton
isDisabled={editingField !== ""}
inputType={inputType}
onClick={() => {
setIsEditing(true)
Expand Down

0 comments on commit 0cc96cb

Please sign in to comment.