diff --git a/app/web/src/components/KeyValue/KeyValue.tsx b/app/web/src/components/KeyValue/KeyValue.tsx index f05aeea..5d93378 100644 --- a/app/web/src/components/KeyValue/KeyValue.tsx +++ b/app/web/src/components/KeyValue/KeyValue.tsx @@ -1,27 +1,47 @@ import Svg from 'src/components/Svg/Svg' +interface EditToggleType { + hasPermissionToEdit: boolean + onEdit?: React.MouseEventHandler + isEditing?: boolean +} + +const EditToggle = ({ + onEdit = () => { console.error('Field declared editable without edit action.') }, + isEditing = false, +} : EditToggleType) => ( + (isEditing ? ( + + ) : ( + + )) +) + interface KeyValueType { keyName: string children: React.ReactNode - hide?: boolean - canEdit?: boolean - onEdit?: () => void - isEditable?: boolean bottom?: boolean className?: string + edit?: EditToggleType } const KeyValue = ({ keyName, children, - hide = false, - canEdit = false, - onEdit, - isEditable = false, bottom = false, className = '', + edit = { hasPermissionToEdit: false }, }: KeyValueType) => { - if (!children || hide) return null + if (!children) return null return (