Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine conprof #1102

Merged
merged 17 commits into from
Dec 29, 2021
Prev Previous commit
Next Next commit
hide action button if disable
  • Loading branch information
baurine committed Dec 24, 2021
commit f6842cbf301d2ed8ab4601cdd0863b9dbdb6ea8d
16 changes: 6 additions & 10 deletions ui/lib/components/ActionsButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export default function ActionsButton({
throw new Error('actions should at least have one action')
}

if (disabled) {
return null
}

// actions.length > 0
const mainAction = actions[0]
if (actions.length === 1) {
return (
<Button
disabled={disabled}
onClick={() => onClick(mainAction.key)}
style={{ width: 150 }}
>
<Button onClick={() => onClick(mainAction.key)} style={{ width: 150 }}>
{mainAction.text}
</Button>
)
Expand All @@ -47,11 +47,7 @@ export default function ActionsButton({
</Menu>
)
return (
<Dropdown.Button
disabled={disabled}
overlay={menu}
onClick={() => onClick(mainAction.key)}
>
<Dropdown.Button overlay={menu} onClick={() => onClick(mainAction.key)}>
{mainAction.text}
</Dropdown.Button>
)
Expand Down