Skip to content

Commit

Permalink
chore: popover's code style optimization (#6409)
Browse files Browse the repository at this point in the history
  • Loading branch information
1587315093 authored Oct 24, 2023
1 parent e9eab30 commit c75f300
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/popover/popover-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const PopoverMenu = forwardRef<PopoverRef, PopoverMenuProps>(
className={classNames(
`${classPrefix}-item`,
'adm-plain-anchor',
action.disabled && `${classPrefix}-item-disabled`
{ [`${classPrefix}-item-disabled`]: action.disabled }
)}
onClick={() => {
if (action.disabled) return
Expand Down
10 changes: 4 additions & 6 deletions src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const defaultProps = {
defaultVisible: false,
stopPropagation: ['click'],
getContainer: () => document.body,
mode: 'light',
}

export const Popover = forwardRef<PopoverRef, PopoverProps>((p, ref) => {
const props = mergeProps(defaultProps, p)
const { mode = 'light' } = props
const placement = normalizePlacement(props.placement)

const [visible, setVisible] = usePropsValue<boolean>({
Expand Down Expand Up @@ -95,11 +95,9 @@ export const Popover = forwardRef<PopoverRef, PopoverProps>((p, ref) => {
withNativeProps(
props,
<div
className={classNames(
classPrefix,
`${classPrefix}-${mode}`,
!visible && `${classPrefix}-hidden`
)}
className={classNames(classPrefix, `${classPrefix}-${props.mode}`, {
[`${classPrefix}-hidden`]: !visible,
})}
ref={floatingRef}
>
<div className={`${classPrefix}-arrow`} ref={arrowRef}>
Expand Down

0 comments on commit c75f300

Please sign in to comment.