mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-28 12:49:34 +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
|
||||
*/
|
||||
const DEFAULT_TOOLTIP_GAP_PX = 8
|
||||
|
||||
const StyledTooltip = styled(RACTooltip, {
|
||||
base: {
|
||||
boxShadow: '0 8px 20px rgba(0 0 0 / 0.1)',
|
||||
@@ -72,11 +74,11 @@ const StyledTooltip = styled(RACTooltip, {
|
||||
fontSize: 14,
|
||||
transform: 'translate3d(0, 0, 0)',
|
||||
'&[data-placement=top]': {
|
||||
marginBottom: '2px',
|
||||
marginBottom: `${DEFAULT_TOOLTIP_GAP_PX}px`,
|
||||
'--origin': 'translateY(4px)',
|
||||
},
|
||||
'&[data-placement=bottom]': {
|
||||
marginTop: '2px',
|
||||
marginTop: `${DEFAULT_TOOLTIP_GAP_PX}px`,
|
||||
'--origin': 'translateY(-4px)',
|
||||
},
|
||||
'&[data-placement=right]': {
|
||||
@@ -126,10 +128,16 @@ const TooltipArrow = () => {
|
||||
|
||||
const Tooltip = ({
|
||||
children,
|
||||
arrowBoundaryOffset,
|
||||
...props
|
||||
}: Omit<TooltipProps, 'children'> & { children: ReactNode }) => {
|
||||
}: {
|
||||
children: ReactNode
|
||||
} & Partial<Omit<TooltipProps, 'children'>>) => {
|
||||
return (
|
||||
<StyledTooltip {...props}>
|
||||
<StyledTooltip
|
||||
arrowBoundaryOffset={arrowBoundaryOffset ?? 0}
|
||||
{...props}
|
||||
>
|
||||
<TooltipArrow />
|
||||
{children}
|
||||
</StyledTooltip>
|
||||
|
||||
@@ -16,6 +16,8 @@ export type VisualOnlyTooltipProps = {
|
||||
tooltipPosition?: 'top' | 'bottom'
|
||||
}
|
||||
|
||||
const TOOLTIP_VERTICAL_OFFSET_PX = 8
|
||||
|
||||
/**
|
||||
* Wrapper component that displays a tooltip visually only (not announced by screen readers).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user