hensei-web/components/common/PopoverContent/index.tsx
Justin Edmund b50ea1fa31
(Hotfix) Popover and hovercard fixes (#379)
* Fix job accessory popover, so shields and manatura can be selected
again
* Don't show AX skill section in weapon hovercard if no AX skill is set
* Center uncap indicator under item image and fix hovercard header
layout
* Fix a bug that prevented all ring bonuses from displaying in hovercard
* Fix transcendence_step being set to 0 when updating a character's
masteries
* Fix weapon modal so you can set AX skills on weapons with rupee or exp
gain
* Ensure job accessory and transcendence popovers open/close properly
2023-09-01 16:13:39 -07:00

48 lines
1.2 KiB
TypeScript

import React, { PropsWithChildren } from 'react'
import classnames from 'classnames'
import * as PopoverPrimitive from '@radix-ui/react-popover'
import styles from './index.module.scss'
interface Props
extends React.DetailedHTMLProps<
React.DialogHTMLAttributes<HTMLDivElement>,
HTMLDivElement
>,
PopoverPrimitive.PopoverContentProps {}
export const Popover = PopoverPrimitive.Root
export const PopoverAnchor = PopoverPrimitive.Anchor
export const PopoverTrigger = PopoverPrimitive.Trigger
export const PopoverContent = React.forwardRef<HTMLDivElement, Props>(
function Popover(
{ children, ...props }: PropsWithChildren<Props>,
forwardedRef
) {
const classes = classnames(
{
[styles.popover]: true,
},
props.className?.split(' ').map((a) => styles[a])
)
return (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Content
{...props}
className={classes}
ref={forwardedRef}
>
{children}
<PopoverPrimitive.Arrow className={styles.arrow} />
</PopoverPrimitive.Content>
</PopoverPrimitive.Portal>
)
}
)
PopoverContent.defaultProps = {
sideOffset: 8,
}