only show delete when only one range selected
This commit is contained in:
parent
6e65825c79
commit
a6e5bb82f8
2 changed files with 22 additions and 14 deletions
|
|
@ -218,6 +218,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
? "Editing such a large range may be slow"
|
||||
: undefined
|
||||
}
|
||||
onlyShowDelete={highlightedCodeSections.length <= 1}
|
||||
editing={section.editing}
|
||||
pinned={section.pinned}
|
||||
index={idx}
|
||||
|
|
@ -334,6 +335,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
})}
|
||||
showAbove={showAbove()}
|
||||
ulHeightPixels={ulRef.current?.getBoundingClientRect().height || 0}
|
||||
hidden={!downshiftProps.isOpen || items.length === 0}
|
||||
>
|
||||
{downshiftProps.isOpen &&
|
||||
items.map((item, index) => (
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ const GridDiv = styled.div`
|
|||
height: 100%;
|
||||
display: grid;
|
||||
grid-gap: 0;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
align-items: center;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
|
||||
|
|
@ -69,6 +68,7 @@ interface PillButtonProps {
|
|||
editing: boolean;
|
||||
pinned: boolean;
|
||||
warning?: string;
|
||||
onlyShowDelete?: boolean;
|
||||
}
|
||||
|
||||
const PillButton = (props: PillButtonProps) => {
|
||||
|
|
@ -105,19 +105,25 @@ const PillButton = (props: PillButtonProps) => {
|
|||
}}
|
||||
>
|
||||
{isHovered && (
|
||||
<GridDiv>
|
||||
<ButtonDiv
|
||||
data-tooltip-id={`edit-${props.index}`}
|
||||
backgroundColor={"#8800aa55"}
|
||||
onClick={() => {
|
||||
client?.setEditingAtIndices([props.index]);
|
||||
}}
|
||||
>
|
||||
<PaintBrush
|
||||
style={{ margin: "auto" }}
|
||||
width="1.6em"
|
||||
></PaintBrush>
|
||||
</ButtonDiv>
|
||||
<GridDiv
|
||||
style={{
|
||||
gridTemplateColumns: props.onlyShowDelete ? "1fr" : "1fr 1fr",
|
||||
}}
|
||||
>
|
||||
{props.onlyShowDelete || (
|
||||
<ButtonDiv
|
||||
data-tooltip-id={`edit-${props.index}`}
|
||||
backgroundColor={"#8800aa55"}
|
||||
onClick={() => {
|
||||
client?.setEditingAtIndices([props.index]);
|
||||
}}
|
||||
>
|
||||
<PaintBrush
|
||||
style={{ margin: "auto" }}
|
||||
width="1.6em"
|
||||
></PaintBrush>
|
||||
</ButtonDiv>
|
||||
)}
|
||||
|
||||
{/* <ButtonDiv
|
||||
data-tooltip-id={`pin-${props.index}`}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue