Skip to content

Commit 4850e69

Browse files
committed
feat: add prop for showPopup
1 parent d00c19f commit 4850e69

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/Shared/Components/ButtonWithSelector/ButtonWithSelector.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,32 @@ const ButtonWithSelector = ({
2424
children,
2525
className = '',
2626
popUpBodyClassName = '',
27+
showPopUp = true,
2728
}: ButtonWithSelectorProps) => {
2829
const [isMenuOpen, setIsMenuOpen] = useState<boolean>(false)
2930

3031
return (
3132
<div className="flexbox">
3233
<button
33-
className={`cta flex h-28 dc__no-right-radius dc__no-border-imp fs-12 fw-6 lh-20-imp ${className}`}
34+
className={`cta flex h-28 ${showPopUp ? 'dc__no-right-radius' : ''} dc__no-border-imp fs-12 fw-6 lh-20-imp ${className}`}
3435
type="button"
3536
onClick={onClick}
3637
>
3738
{content}
3839
</button>
39-
<PopupMenu autoClose autoPosition onToggleCallback={setIsMenuOpen}>
40-
<PopupMenu.Button rootClassName="flex dc__transparent p-8 w-28 bcb-5 dc__right-radius-4 dc__no-left-radius dc__no-top-border dc__no-bottom-border dc__no-right-border button-with-selector">
41-
<ICDropdown
42-
className="icon-dim-12 fcn-0 dc__no-shrink rotate"
43-
style={{ ['--rotateBy' as any]: isMenuOpen ? '180deg' : '0deg' }}
44-
/>
45-
</PopupMenu.Button>
46-
<PopupMenu.Body rootClassName={`pt-4 pb-4 dc__border dc__overflow-hidden ${popUpBodyClassName}`}>
47-
{children}
48-
</PopupMenu.Body>
49-
</PopupMenu>
40+
{showPopUp && (
41+
<PopupMenu autoClose autoPosition onToggleCallback={setIsMenuOpen}>
42+
<PopupMenu.Button rootClassName="flex dc__transparent p-8 w-28 bcb-5 dc__right-radius-4 dc__no-left-radius dc__no-top-border dc__no-bottom-border dc__no-right-border button-with-selector">
43+
<ICDropdown
44+
className="icon-dim-12 fcn-0 dc__no-shrink rotate"
45+
style={{ ['--rotateBy' as any]: isMenuOpen ? '180deg' : '0deg' }}
46+
/>
47+
</PopupMenu.Button>
48+
<PopupMenu.Body rootClassName={`pt-4 pb-4 dc__border dc__overflow-hidden ${popUpBodyClassName}`}>
49+
{children}
50+
</PopupMenu.Body>
51+
</PopupMenu>
52+
)}
5053
</div>
5154
)
5255
}

src/Shared/Components/ButtonWithSelector/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ export interface ButtonWithSelectorProps {
66
children: ReactNode
77
className?: string
88
popUpBodyClassName?: string
9+
showPopUp?: boolean
910
}

0 commit comments

Comments
 (0)