Skip to content

Commit

Permalink
refactor isLast to compressed
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Oct 1, 2020
1 parent f69442a commit 8cfa36e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { EuiButtonIcon } from '@elastic/eui';
export interface Props {
isVisible: boolean;
isDisabled: boolean;
isLast?: boolean;
/**
* Useful for buttons at the very top or bottom of lists to avoid any overflow.
*/
compressed?: boolean;
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
'data-test-subj'?: string;
}
Expand All @@ -30,7 +33,7 @@ const cannotMoveHereLabel = i18n.translate(
);

export const DropZoneButton: FunctionComponent<Props> = (props) => {
const { onClick, isDisabled, isVisible, isLast } = props;
const { onClick, isDisabled, isVisible, compressed } = props;
const isUnavailable = isVisible && isDisabled;
const containerClasses = classNames({
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -42,7 +45,7 @@ export const DropZoneButton: FunctionComponent<Props> = (props) => {
// eslint-disable-next-line @typescript-eslint/naming-convention
'pipelineProcessorsEditor__tree__dropZoneButton--visible': isVisible,
// eslint-disable-next-line @typescript-eslint/naming-convention
'pipelineProcessorsEditor__tree__dropZoneButton--last': isLast,
'pipelineProcessorsEditor__tree__dropZoneButton--compressed': compressed,
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const PrivateTree: FunctionComponent<PrivateProps> = ({
movingProcessor={movingProcessor}
/>
<DropZoneButton
isLast={level === 1 && idx + 1 === processors.length}
compressed={level === 1 && idx + 1 === processors.length}
data-test-subj={`dropButtonBelow-${stringifiedSelector}`}
isVisible={Boolean(movingProcessor)}
isDisabled={!movingProcessor || isDropZoneBelowDisabled(info, movingProcessor)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}
}

&--last {
&--compressed {
height: $dropZoneButtonOffsetY;
}
}
Expand Down

0 comments on commit 8cfa36e

Please sign in to comment.