mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 06:58:12 +08:00
Break out anno plus button (#1473)
* break out plus button * remove menu item * padding, remove icon * icon padding
This commit is contained in:
@@ -6,9 +6,13 @@ import {
|
|||||||
MenuItem,
|
MenuItem,
|
||||||
Popover,
|
Popover,
|
||||||
Position,
|
Position,
|
||||||
|
Tooltip,
|
||||||
|
Icon,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
} from "@blueprintjs/core";
|
} from "@blueprintjs/core";
|
||||||
|
|
||||||
|
import * as globals from "../../../globals";
|
||||||
|
|
||||||
@connect((state) => ({
|
@connect((state) => ({
|
||||||
annotations: state.annotations,
|
annotations: state.annotations,
|
||||||
}))
|
}))
|
||||||
@@ -56,46 +60,57 @@ class AnnoMenuCategory extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isUserAnno ? (
|
{isUserAnno ? (
|
||||||
<Popover
|
<>
|
||||||
interactionKind={PopoverInteractionKind.HOVER}
|
<Tooltip
|
||||||
boundary="window"
|
content={createText}
|
||||||
position={Position.RIGHT_TOP}
|
position="bottom"
|
||||||
content={
|
hoverOpenDelay={globals.tooltipHoverOpenDelay}
|
||||||
<Menu>
|
>
|
||||||
<MenuItem
|
<Button
|
||||||
icon="tag"
|
style={{ marginLeft: 0, marginRight: 2 }}
|
||||||
data-testclass="handleAddNewLabelToCategory"
|
data-testclass="handleAddNewLabelToCategory"
|
||||||
data-testid={`${metadataField}:add-new-label-to-category`}
|
data-testid={`${metadataField}:add-new-label-to-category`}
|
||||||
onClick={this.activateAddNewLabelMode}
|
icon={<Icon icon="plus" iconSize={10} />}
|
||||||
text={createText}
|
onClick={this.activateAddNewLabelMode}
|
||||||
/>
|
small
|
||||||
<MenuItem
|
minimal
|
||||||
icon="edit"
|
/>
|
||||||
disabled={annotations.isEditingCategoryName}
|
</Tooltip>
|
||||||
data-testclass="activateEditCategoryMode"
|
<Popover
|
||||||
data-testid={`${metadataField}:edit-category-mode`}
|
interactionKind={PopoverInteractionKind.HOVER}
|
||||||
onClick={this.activateEditCategoryMode}
|
boundary="window"
|
||||||
text={editText}
|
position={Position.RIGHT_TOP}
|
||||||
/>
|
content={
|
||||||
<MenuItem
|
<Menu>
|
||||||
icon="delete"
|
<MenuItem
|
||||||
intent="danger"
|
icon="edit"
|
||||||
data-testclass="handleDeleteCategory"
|
disabled={annotations.isEditingCategoryName}
|
||||||
data-testid={`${metadataField}:delete-category`}
|
data-testclass="activateEditCategoryMode"
|
||||||
onClick={this.handleDeleteCategory}
|
data-testid={`${metadataField}:edit-category-mode`}
|
||||||
text={deleteText}
|
onClick={this.activateEditCategoryMode}
|
||||||
/>
|
text={editText}
|
||||||
</Menu>
|
/>
|
||||||
}
|
<MenuItem
|
||||||
>
|
icon="delete"
|
||||||
<Button
|
intent="danger"
|
||||||
style={{ marginLeft: 0 }}
|
data-testclass="handleDeleteCategory"
|
||||||
data-testclass="seeActions"
|
data-testid={`${metadataField}:delete-category`}
|
||||||
data-testid={`${metadataField}:see-actions`}
|
onClick={this.handleDeleteCategory}
|
||||||
icon="more"
|
text={deleteText}
|
||||||
minimal
|
/>
|
||||||
/>
|
</Menu>
|
||||||
</Popover>
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
style={{ marginLeft: 0, marginRight: 5 }}
|
||||||
|
data-testclass="seeActions"
|
||||||
|
data-testid={`${metadataField}:see-actions`}
|
||||||
|
icon={<Icon icon="more" iconSize={10} />}
|
||||||
|
small
|
||||||
|
minimal
|
||||||
|
/>
|
||||||
|
</Popover>
|
||||||
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -278,9 +278,6 @@ class Category extends React.Component {
|
|||||||
}}
|
}}
|
||||||
onClick={this.handleCategoryClick}
|
onClick={this.handleCategoryClick}
|
||||||
>
|
>
|
||||||
{isUserAnno ? (
|
|
||||||
<Icon style={{ marginRight: 5 }} icon="tag" iconSize={16} />
|
|
||||||
) : null}
|
|
||||||
{truncatedString || metadataField}
|
{truncatedString || metadataField}
|
||||||
{isExpanded ? (
|
{isExpanded ? (
|
||||||
<FaChevronDown
|
<FaChevronDown
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
MenuItem,
|
MenuItem,
|
||||||
Popover,
|
Popover,
|
||||||
Position,
|
Position,
|
||||||
|
Icon,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "@blueprintjs/core";
|
} from "@blueprintjs/core";
|
||||||
@@ -343,7 +344,7 @@ class CategoryValue extends React.Component {
|
|||||||
}
|
}
|
||||||
data-testclass="categorical-row"
|
data-testclass="categorical-row"
|
||||||
style={{
|
style={{
|
||||||
padding: "4px 7px",
|
padding: "4px 0px 4px 7px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "baseline",
|
alignItems: "baseline",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
@@ -561,14 +562,14 @@ class CategoryValue extends React.Component {
|
|||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 0,
|
marginLeft: 2,
|
||||||
position: "relative",
|
position: "relative",
|
||||||
top: -1,
|
top: -1,
|
||||||
minHeight: 16,
|
minHeight: 16,
|
||||||
}}
|
}}
|
||||||
data-testclass="seeActions"
|
data-testclass="seeActions"
|
||||||
data-testid={`${metadataField}:${displayString}:see-actions`}
|
data-testid={`${metadataField}:${displayString}:see-actions`}
|
||||||
icon="more"
|
icon={<Icon icon="more" iconSize={10} />}
|
||||||
small
|
small
|
||||||
minimal
|
minimal
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user