Skip to content

Commit 50e4c2b

Browse files
fix: remove dead feature prop and store dependency from Button (#6867)
1 parent 65a3f12 commit 50e4c2b

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

frontend/web/components/base/forms/Button.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import cn from 'classnames'
33
import { ButtonHTMLAttributes, HTMLAttributeAnchorTarget } from 'react'
44
import Icon, { IconName } from 'components/Icon'
55
import Constants from 'common/constants'
6-
import Utils, { PaidFeature } from 'common/utils/utils'
7-
import PlanBasedBanner from 'components/PlanBasedAccess'
86

97
export const themeClassNames = {
108
danger: 'btn btn-danger',
@@ -32,7 +30,6 @@ export type ButtonType = ButtonHTMLAttributes<HTMLButtonElement> & {
3230
iconLeftColour?: keyof typeof Constants.colours
3331
iconLeft?: IconName
3432
href?: string
35-
feature?: PaidFeature
3633
target?: HTMLAttributeAnchorTarget
3734
theme?: keyof typeof themeClassNames
3835
size?: keyof typeof sizeClassNames
@@ -47,7 +44,6 @@ export const Button = React.forwardRef<
4744
{
4845
children,
4946
className,
50-
feature,
5147
href,
5248
iconLeft,
5349
iconLeftColour,
@@ -63,20 +59,17 @@ export const Button = React.forwardRef<
6359
},
6460
ref,
6561
) => {
66-
const hasPlan = feature ? Utils.getPlansPermission(feature) : true
67-
return href || !hasPlan ? (
62+
return href ? (
6863
<a
69-
onClick={
70-
hasPlan ? (rest.onClick as React.MouseEventHandler) : undefined
71-
}
64+
onClick={rest.onClick as React.MouseEventHandler}
7265
className={cn(className, themeClassNames[theme], sizeClassNames[size])}
73-
target={hasPlan ? target : '_blank'}
74-
href={hasPlan ? href : Constants.getUpgradeUrl()}
66+
target={target}
67+
href={href}
7568
rel='noreferrer'
7669
ref={ref as React.RefObject<HTMLAnchorElement>}
7770
>
7871
<div className='d-flex h-100 align-items-center justify-content-center gap-2'>
79-
{!!iconLeft && !!hasPlan && (
72+
{!!iconLeft && (
8073
<Icon
8174
fill={
8275
iconLeftColour ? Constants.colours[iconLeftColour] : undefined
@@ -86,9 +79,6 @@ export const Button = React.forwardRef<
8679
/>
8780
)}
8881
{children}
89-
{!hasPlan && feature && (
90-
<PlanBasedBanner feature={feature} theme={'badge'} />
91-
)}
9282
</div>
9383
{!!iconRight && (
9484
<Icon

0 commit comments

Comments
 (0)