Skip to content

Commit

Permalink
fix(google-maps-input): hide edit/delete buttons when readOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Jun 7, 2021
1 parent 257f91b commit 9bdc7ef
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions packages/@sanity/google-maps-input/src/input/GeopointInput.tsx
Expand Up @@ -187,24 +187,26 @@ class GeopointInput extends React.PureComponent<InputProps, InputState> {
</ChangeIndicatorCompareValueProvider>
)}

<div className={styles.functions}>
<ButtonGrid>
<Button
inverted
onClick={this.handleToggleModal}
icon={value && EditIcon}
ref={this.setEditButton}
>
{value ? 'Edit' : 'Set location'}
</Button>

{value && (
<Button color="danger" icon={TrashIcon} inverted onClick={this.handleClear}>
Remove
{!readOnly && (
<div className={styles.functions}>
<ButtonGrid>
<Button
inverted
onClick={this.handleToggleModal}
icon={value && EditIcon}
ref={this.setEditButton}
>
{value ? 'Edit' : 'Set location'}
</Button>
)}
</ButtonGrid>
</div>

{value && (
<Button color="danger" icon={TrashIcon} inverted onClick={this.handleClear}>
Remove
</Button>
)}
</ButtonGrid>
</div>
)}

{modalOpen && (
<DefaultDialog
Expand Down

0 comments on commit 9bdc7ef

Please sign in to comment.