Skip to content

Commit

Permalink
feat: terminal split screen operation supports single deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxiaojuan committed Sep 5, 2023
1 parent 1333888 commit 0e22038
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/terminal-next/src/browser/component/resize.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@
justify-content: flex-end;

.resizeItem {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
padding: 8px 2px 0 10px;
padding: 8px 20px 0 10px;
:global {
.kticon-close {
position: absolute;
right: 5px;
top: 10px;
cursor: pointer;
&:hover {
background-color: var(--kt-icon-hoverBackground);
transform: scale(1.1);
}
}
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions packages/terminal-next/src/browser/component/resize.view.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { observer } from 'mobx-react-lite';
import React from 'react';

import { useInjectable, getIcon } from '@opensumi/ide-core-browser';

import { ITerminalGroupViewService } from '../../common/controller';
import { IWidget, IWidgetGroup } from '../../common/resize';

import ResizeDelegate from './resize.delegate';
Expand All @@ -23,6 +26,7 @@ export default observer((props: IResizeViewProps) => {
const { group, shadow } = props;
const [event, setEvent] = React.useState(false);
const [wholeWidth, setWholeWidth] = React.useState(Infinity);
const view = useInjectable<ITerminalGroupViewService>(ITerminalGroupViewService);
const whole = React.createRef<HTMLDivElement>();

React.useEffect(() => {
Expand Down Expand Up @@ -77,6 +81,14 @@ export default observer((props: IResizeViewProps) => {
className={styles.resizeItem}
>
{props.draw(widget)}
{group.widgets.length > 1 && (
<div
className={getIcon('close')}
onClick={() => {
view.removeWidget(widget.id);
}}
/>
)}
</div>
))}
</div>
Expand Down

0 comments on commit 0e22038

Please sign in to comment.