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

[TextBasedEditor] Use resizable button from EUI #165935

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 0 additions & 87 deletions packages/kbn-text-based-editor/src/resizable_button.scss

This file was deleted.

22 changes: 13 additions & 9 deletions packages/kbn-text-based-editor/src/resizable_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,32 @@
*/

import React from 'react';

import './resizable_button.scss';
import { EuiResizableButton } from '@elastic/eui';
import { css } from '@emotion/react';

export function ResizableButton({
onMouseDownResizeHandler,
onKeyDownResizeHandler,
}: {
onMouseDownResizeHandler: (
mouseDownEvent: React.MouseEvent<HTMLButtonElement, MouseEvent>
mouseDownEvent: React.MouseEvent<HTMLButtonElement, MouseEvent> | React.TouchEvent
) => void;
onKeyDownResizeHandler: (keyDownEvernt: React.KeyboardEvent) => void;
}) {
const setFocus = (e: React.MouseEvent<HTMLButtonElement>) => e.currentTarget.focus();

return (
<div className="TextBasedLangEditor--resizableButtonContainer">
<button
<div
css={css`
position: absolute;
bottom: 0;
left: 0;
right: 0;
`}
>
<EuiResizableButton
data-test-subj="TextBasedLangEditor-resize"
className="TextBasedLangEditor--resizableButton"
onMouseDown={onMouseDownResizeHandler}
onKeyDown={onKeyDownResizeHandler}
onClick={setFocus}
onTouchStart={onMouseDownResizeHandler}
/>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this wrapping div element necessary? Or can the CSS positioning be applied directly to the EuiResizableButton component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me test it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, I removed it! 4e7a0bc

);
Expand Down