mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-30 12:09:08 +00:00
💄(style) adjust tooltip positioning and fix ts error
raise tooltip offset and set arrowBoundaryOffset
This commit is contained in:
@@ -58,6 +58,8 @@ export const TooltipWrapper = ({
|
|||||||
*
|
*
|
||||||
* Style taken from example at https://react-spectrum.adobe.com/react-aria/Tooltip.html
|
* Style taken from example at https://react-spectrum.adobe.com/react-aria/Tooltip.html
|
||||||
*/
|
*/
|
||||||
|
const DEFAULT_TOOLTIP_GAP_PX = 8
|
||||||
|
|
||||||
const StyledTooltip = styled(RACTooltip, {
|
const StyledTooltip = styled(RACTooltip, {
|
||||||
base: {
|
base: {
|
||||||
boxShadow: '0 8px 20px rgba(0 0 0 / 0.1)',
|
boxShadow: '0 8px 20px rgba(0 0 0 / 0.1)',
|
||||||
@@ -72,11 +74,11 @@ const StyledTooltip = styled(RACTooltip, {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)',
|
||||||
'&[data-placement=top]': {
|
'&[data-placement=top]': {
|
||||||
marginBottom: '2px',
|
marginBottom: `${DEFAULT_TOOLTIP_GAP_PX}px`,
|
||||||
'--origin': 'translateY(4px)',
|
'--origin': 'translateY(4px)',
|
||||||
},
|
},
|
||||||
'&[data-placement=bottom]': {
|
'&[data-placement=bottom]': {
|
||||||
marginTop: '2px',
|
marginTop: `${DEFAULT_TOOLTIP_GAP_PX}px`,
|
||||||
'--origin': 'translateY(-4px)',
|
'--origin': 'translateY(-4px)',
|
||||||
},
|
},
|
||||||
'&[data-placement=right]': {
|
'&[data-placement=right]': {
|
||||||
@@ -126,10 +128,16 @@ const TooltipArrow = () => {
|
|||||||
|
|
||||||
const Tooltip = ({
|
const Tooltip = ({
|
||||||
children,
|
children,
|
||||||
|
arrowBoundaryOffset,
|
||||||
...props
|
...props
|
||||||
}: Omit<TooltipProps, 'children'> & { children: ReactNode }) => {
|
}: {
|
||||||
|
children: ReactNode
|
||||||
|
} & Partial<Omit<TooltipProps, 'children'>>) => {
|
||||||
return (
|
return (
|
||||||
<StyledTooltip {...props}>
|
<StyledTooltip
|
||||||
|
arrowBoundaryOffset={arrowBoundaryOffset ?? 0}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
<TooltipArrow />
|
<TooltipArrow />
|
||||||
{children}
|
{children}
|
||||||
</StyledTooltip>
|
</StyledTooltip>
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export type VisualOnlyTooltipProps = {
|
|||||||
tooltipPosition?: 'top' | 'bottom'
|
tooltipPosition?: 'top' | 'bottom'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TOOLTIP_VERTICAL_OFFSET_PX = 8
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper component that displays a tooltip visually only (not announced by screen readers).
|
* Wrapper component that displays a tooltip visually only (not announced by screen readers).
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user