Refactor CustomIconButtons

This commit is contained in:
Thomas Nordquist
2019-04-15 15:52:27 +02:00
parent 48e65947f7
commit 91a9ba7757
5 changed files with 29 additions and 36 deletions

View File

@@ -70,12 +70,8 @@ class Sidebar extends React.Component<Props, State> {
}
return (
<CustomIconButton onClick={() => this.deleteTopic(this.props.node)}>
<Tooltip title="Clear this topic">
<span>
<Delete />
</span>
</Tooltip>
<CustomIconButton onClick={() => this.deleteTopic(this.props.node)} tooltip="Clear this topic">
<Delete />
</CustomIconButton>
)
}
@@ -88,17 +84,15 @@ class Sidebar extends React.Component<Props, State> {
}
return (
<CustomIconButton onClick={() => this.deleteTopic(this.props.node, true, deleteLimit)}>
<Tooltip title={`Deletes up to ${deleteLimit} sub-topics with a single click`}>
<Badge
classes={{ badge: this.props.classes.badge }}
badgeContent={<span style={{ whiteSpace: 'nowrap' }}>{topicCount >= deleteLimit ? '50+' : topicCount}</span>}
color="secondary"
>
<Delete color="action" />
</Badge>
</Tooltip>
</CustomIconButton>
<Badge
classes={{ badge: this.props.classes.badge }}
badgeContent={<span style={{ whiteSpace: 'nowrap' }}>{topicCount >= deleteLimit ? '50+' : topicCount}</span>}
color="secondary"
>
<CustomIconButton onClick={() => this.deleteTopic(this.props.node, true, deleteLimit)} tooltip={`Deletes up to ${deleteLimit} sub-topics with a single click`}>
<Delete color="action" />
</CustomIconButton>
</Badge>
)
}