Adjust overlap, clarify intent of consts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
|
|
||||||
|
export const BUBBLE_MAX_WIDTH = 240
|
||||||
export const ARROW_SIZE = 12
|
export const ARROW_SIZE = 12
|
||||||
export const ARROW_HALF_SIZE = ARROW_SIZE / 2
|
export const ARROW_HALF_SIZE = ARROW_SIZE / 2
|
||||||
export const ARROW_VISUAL_OFFSET = ARROW_SIZE / 3
|
|
||||||
export const MIN_EDGE_SPACE = a.px_lg.paddingLeft
|
export const MIN_EDGE_SPACE = a.px_lg.paddingLeft
|
||||||
|
|||||||
@@ -17,11 +17,17 @@ import {Portal} from '#/components/Portal'
|
|||||||
import {
|
import {
|
||||||
ARROW_HALF_SIZE,
|
ARROW_HALF_SIZE,
|
||||||
ARROW_SIZE,
|
ARROW_SIZE,
|
||||||
ARROW_VISUAL_OFFSET,
|
BUBBLE_MAX_WIDTH,
|
||||||
MIN_EDGE_SPACE,
|
MIN_EDGE_SPACE,
|
||||||
} from '#/components/Tooltip/const'
|
} from '#/components/Tooltip/const'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These are native specific values, not shared with web
|
||||||
|
*/
|
||||||
|
const ARROW_VISUAL_OFFSET = ARROW_SIZE / 1.25 // vibes-based, slightly off the target
|
||||||
|
const BUBBLE_SHADOW_OFFSET = ARROW_SIZE / 3 // vibes-based, provide more shadow beneath tip
|
||||||
|
|
||||||
type TooltipContextType = {
|
type TooltipContextType = {
|
||||||
position: 'top' | 'bottom'
|
position: 'top' | 'bottom'
|
||||||
ready: boolean
|
ready: boolean
|
||||||
@@ -313,7 +319,7 @@ function Bubble({
|
|||||||
a.absolute,
|
a.absolute,
|
||||||
a.align_start,
|
a.align_start,
|
||||||
{
|
{
|
||||||
width: 200,
|
width: BUBBLE_MAX_WIDTH,
|
||||||
opacity: bubbleMeasurements ? 1 : 0,
|
opacity: bubbleMeasurements ? 1 : 0,
|
||||||
top: coords.top,
|
top: coords.top,
|
||||||
left: coords.left,
|
left: coords.left,
|
||||||
@@ -359,9 +365,8 @@ function Bubble({
|
|||||||
shadowOpacity: 0.2,
|
shadowOpacity: 0.2,
|
||||||
shadowOffset: {
|
shadowOffset: {
|
||||||
width: 0,
|
width: 0,
|
||||||
// provide more shadow beneath tip
|
|
||||||
height:
|
height:
|
||||||
ARROW_VISUAL_OFFSET *
|
BUBBLE_SHADOW_OFFSET *
|
||||||
(coords.computedPosition === 'bottom' ? -1 : 1),
|
(coords.computedPosition === 'bottom' ? -1 : 1),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {atoms as a, flatten, select, useTheme} from '#/alf'
|
|||||||
import {transparentifyColor} from '#/alf/util/colorGeneration'
|
import {transparentifyColor} from '#/alf/util/colorGeneration'
|
||||||
import {
|
import {
|
||||||
ARROW_SIZE,
|
ARROW_SIZE,
|
||||||
ARROW_VISUAL_OFFSET,
|
BUBBLE_MAX_WIDTH,
|
||||||
MIN_EDGE_SPACE,
|
MIN_EDGE_SPACE,
|
||||||
} from '#/components/Tooltip/const'
|
} from '#/components/Tooltip/const'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -61,7 +61,7 @@ export function Content({
|
|||||||
className="radix-popover-content"
|
className="radix-popover-content"
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
side={position}
|
side={position}
|
||||||
sideOffset={(ARROW_SIZE / 3) * -1}
|
sideOffset={4}
|
||||||
collisionPadding={MIN_EDGE_SPACE}
|
collisionPadding={MIN_EDGE_SPACE}
|
||||||
style={flatten([
|
style={flatten([
|
||||||
a.rounded_sm,
|
a.rounded_sm,
|
||||||
@@ -73,18 +73,9 @@ export function Content({
|
|||||||
{
|
{
|
||||||
minWidth: 'max-content',
|
minWidth: 'max-content',
|
||||||
boxShadow: select(t.name, {
|
boxShadow: select(t.name, {
|
||||||
light: `0 ${ARROW_VISUAL_OFFSET}px 16px ${transparentifyColor(
|
light: `0 0 24px ${transparentifyColor(t.palette.black, 0.2)}`,
|
||||||
t.palette.black,
|
dark: `0 0 24px ${transparentifyColor(t.palette.black, 0.2)}`,
|
||||||
0.2,
|
dim: `0 0 24px ${transparentifyColor(t.palette.black, 0.2)}`,
|
||||||
)}`,
|
|
||||||
dark: `0 ${ARROW_VISUAL_OFFSET}px 16px ${transparentifyColor(
|
|
||||||
t.palette.black,
|
|
||||||
0.2,
|
|
||||||
)}`,
|
|
||||||
dim: `0 ${ARROW_VISUAL_OFFSET}px 16px ${transparentifyColor(
|
|
||||||
t.palette.black,
|
|
||||||
0.2,
|
|
||||||
)}`,
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
])}>
|
])}>
|
||||||
@@ -97,7 +88,9 @@ export function Content({
|
|||||||
dim: t.atoms.bg_contrast_100.backgroundColor,
|
dim: t.atoms.bg_contrast_100.backgroundColor,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<View style={[a.px_md, a.py_sm, {maxWidth: 200}]}>{children}</View>
|
<View style={[a.px_md, a.py_sm, {maxWidth: BUBBLE_MAX_WIDTH}]}>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
</Popover.Content>
|
</Popover.Content>
|
||||||
</Popover.Portal>
|
</Popover.Portal>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -213,16 +213,13 @@ let ProfileHeaderStandard = ({
|
|||||||
|
|
||||||
{hasSession && (
|
{hasSession && (
|
||||||
<>
|
<>
|
||||||
<Tooltip.Outer
|
<Tooltip.Outer visible={visible} onVisibleChange={setVisible}>
|
||||||
position="top"
|
|
||||||
visible={visible}
|
|
||||||
onVisibleChange={setVisible}>
|
|
||||||
<Tooltip.Target>
|
<Tooltip.Target>
|
||||||
<MessageProfileButton profile={profile} />
|
<MessageProfileButton profile={profile} />
|
||||||
</Tooltip.Target>
|
</Tooltip.Target>
|
||||||
<Tooltip.TextBubble>
|
<Tooltip.TextBubble>
|
||||||
<Text>
|
<Text>
|
||||||
<Trans>Boop</Trans>
|
<Trans>Get notified about new posts</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</Tooltip.TextBubble>
|
</Tooltip.TextBubble>
|
||||||
</Tooltip.Outer>
|
</Tooltip.Outer>
|
||||||
|
|||||||
Reference in New Issue
Block a user