Skip to content

Commit ea549e1

Browse files
committed
fix: use tooltip portals, remove cancel upload button tooltips until portal issues are fixed in ui
1 parent b7c6fd1 commit ea549e1

File tree

5 files changed

+28
-48
lines changed

5 files changed

+28
-48
lines changed

src/components/CardUpload/index.tsx

+12-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {hues} from '@sanity/color'
22
import {CloseIcon} from '@sanity/icons'
3-
import {Box, Button, Flex, Text, Tooltip} from '@sanity/ui'
3+
import {Box, Button, Flex, Text} from '@sanity/ui'
44
import filesize from 'filesize'
55
import React from 'react'
66
import {useDispatch} from 'react-redux'
@@ -102,10 +102,10 @@ const CardUpload = (props: Props) => {
102102
</div>
103103
)}
104104

105-
{/*
105+
{/*
106106
Cancel upload button.
107107
Assets will only have a `complete` status _after_ it has been created on your dataset.
108-
As such, we also hide the cancel button when `percentLoaded === 100`, as cancelling when the asset
108+
As such, we also hide the cancel button when `percentLoaded === 100`, as cancelling when the asset
109109
has been fully uploaded (even with a status of `progress`) won't stop the asset from being created.
110110
*/}
111111
{!isComplete && percentLoaded !== 100 && (
@@ -121,27 +121,15 @@ const CardUpload = (props: Props) => {
121121
width: '100%'
122122
}}
123123
>
124-
<Tooltip
125-
content={
126-
<Box padding={2}>
127-
<Text muted size={1}>
128-
Cancel
129-
</Text>
130-
</Box>
131-
}
132-
disabled={'ontouchstart' in window}
133-
placement="top"
134-
>
135-
<Button
136-
fontSize={4}
137-
icon={CloseIcon}
138-
mode="bleed"
139-
onClick={handleCancelUpload}
140-
padding={2}
141-
style={{background: 'none', boxShadow: 'none'}}
142-
tone="critical"
143-
/>
144-
</Tooltip>
124+
<Button
125+
fontSize={4}
126+
icon={CloseIcon}
127+
mode="bleed"
128+
onClick={handleCancelUpload}
129+
padding={2}
130+
style={{background: 'none', boxShadow: 'none'}}
131+
tone="critical"
132+
/>
145133
</Flex>
146134
)}
147135
</Box>

src/components/DebugControls/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const DebugControls = () => {
6060
}
6161
fallbackPlacements={['right', 'left']}
6262
placement="bottom"
63+
portal
6364
>
6465
<Switch
6566
checked={badConnection}

src/components/FormSubmitButton/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const FormSubmitButton = (props: Props) => {
4040
}
4141
disabled={'ontouchstart' in window}
4242
placement="top"
43+
portal
4344
>
4445
<Box>
4546
<Button

src/components/TableRowUpload/index.tsx

+12-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {hues} from '@sanity/color'
22
import {CloseIcon} from '@sanity/icons'
3-
import {Box, Button, Flex, Grid, Stack, Text, Tooltip, useMediaIndex} from '@sanity/ui'
3+
import {Box, Button, Flex, Grid, Stack, Text, useMediaIndex} from '@sanity/ui'
44
import filesize from 'filesize'
55
import React from 'react'
66
import {useDispatch} from 'react-redux'
@@ -100,10 +100,10 @@ const TableRowUpload = (props: Props) => {
100100
</div>
101101
)}
102102

103-
{/*
103+
{/*
104104
Cancel upload button.
105105
Assets will only have a `complete` status _after_ it has been created on your dataset.
106-
As such, we also hide the cancel button when `percentLoaded === 100`, as cancelling when the asset
106+
As such, we also hide the cancel button when `percentLoaded === 100`, as cancelling when the asset
107107
has been fully uploaded (even with a status of `progress`) won't stop the asset from being created.
108108
*/}
109109
{!isComplete && percentLoaded !== 100 && (
@@ -118,27 +118,15 @@ const TableRowUpload = (props: Props) => {
118118
width: '100%'
119119
}}
120120
>
121-
<Tooltip
122-
content={
123-
<Box padding={2}>
124-
<Text muted size={1}>
125-
Cancel
126-
</Text>
127-
</Box>
128-
}
129-
disabled={'ontouchstart' in window}
130-
placement="top"
131-
>
132-
<Button
133-
fontSize={3}
134-
icon={CloseIcon}
135-
mode="bleed"
136-
onClick={handleCancelUpload}
137-
padding={2}
138-
style={{background: 'none', boxShadow: 'none'}}
139-
tone="critical"
140-
/>
141-
</Tooltip>
121+
<Button
122+
fontSize={3}
123+
icon={CloseIcon}
124+
mode="bleed"
125+
onClick={handleCancelUpload}
126+
padding={2}
127+
style={{background: 'none', boxShadow: 'none'}}
128+
tone="critical"
129+
/>
142130
</Flex>
143131
)}
144132
</Box>

src/components/Tag/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type TagButtonProps = {
4444

4545
const TagButton = (props: TagButtonProps) => {
4646
const {disabled, icon, onClick, tone, tooltip} = props
47+
4748
return (
4849
<Tooltip
4950
content={
@@ -55,6 +56,7 @@ const TagButton = (props: TagButtonProps) => {
5556
}
5657
disabled={'ontouchstart' in window}
5758
placement="top"
59+
portal
5860
>
5961
<Button
6062
disabled={disabled}

0 commit comments

Comments
 (0)