-
+
+
+
{isExpanded && (
-
+ <>
-
+
-
+
-
+ >
)}
{!isExpanded && (
-
+
)}
diff --git a/packages/compass-shell/src/components/shell-header/shell-header.less b/packages/compass-shell/src/components/shell-header/shell-header.less
index 4cb409120d..a6be6e8440 100644
--- a/packages/compass-shell/src/components/shell-header/shell-header.less
+++ b/packages/compass-shell/src/components/shell-header/shell-header.less
@@ -6,28 +6,52 @@
display: flex;
color: @leafygreen__gray--light-1;
+ &-left {
+ flex-grow: 1;
+ }
+
&-right-actions {
- position: absolute;
- right: 4px;
- top: -2px;
- text-align: right;
+ display: flex;
}
&-toggle {
background: none;
border: none;
cursor: pointer;
- padding: 1px 8px;
+ padding: 0px 8px;
+ height: 100%;
+ display: flex;
+ vertical-align: middle;
+ flex-direction: row;
+ align-items: center;
+ margin: auto 0;
+ font-weight: bold;
+ font-size: 12px;
+ line-height: 24px;
transition: all 200ms;
user-select: none;
+ text-transform: uppercase;
+
&:hover {
color: @leafygreen__gray--light-3;
}
}
- &-info-btn {
- margin-right: 8px;
+ &-operation-in-progress {
+ color: @leafygreen__green--light-2;
+ }
+
+ &-loader-icon {
+ margin: auto;
+ margin-left: 16px;
+ margin-right: 6px;
+ }
+
+ &-btn {
+ margin-right: 4px;
+ width: 24px;
+ height: 24px;
}
}
diff --git a/packages/compass-shell/src/components/shell-header/shell-header.spec.js b/packages/compass-shell/src/components/shell-header/shell-header.spec.js
index 99477adac0..bf9e49555e 100644
--- a/packages/compass-shell/src/components/shell-header/shell-header.spec.js
+++ b/packages/compass-shell/src/components/shell-header/shell-header.spec.js
@@ -3,54 +3,74 @@ import { mount, shallow } from 'enzyme';
import Icon from '@leafygreen-ui/icon';
import IconButton from '@leafygreen-ui/icon-button';
+import { ShellLoader } from '@mongosh/browser-repl';
+
import { ShellHeader } from './shell-header';
import styles from './shell-header.less';
describe('ShellHeader', () => {
context('when isExpanded prop is true', () => {
- it('renders a close chevron button', () => {
- const wrapper = mount(
{
+ wrapper = mount( {}}
showInfoModal={() => {}}
/>);
+ });
+ it('renders a close chevron button', () => {
expect(wrapper.find(IconButton).exists()).to.equal(true);
expect(wrapper.find(Icon).at(1).prop('glyph')).to.equal('ChevronDown');
});
it('renders an info button', () => {
- const wrapper = mount( {}}
- showInfoModal={() => {}}
- />);
-
expect(wrapper.find(IconButton).exists()).to.equal(true);
expect(wrapper.find(Icon).at(0).prop('glyph')).to.equal('InfoWithCircle');
});
it('renders an actions area', () => {
- const wrapper = mount( {
+ expect(wrapper.find(ShellLoader).exists()).to.equal(false);
+ });
+ });
+
+ context('when isExpanded prop is false', () => {
+ let wrapper;
+ beforeEach(() => {
+ wrapper = mount( {}}
showInfoModal={() => {}}
/>);
+ });
- expect(wrapper.find(`.${styles['compass-shell-header-right-actions']}`).exists()).to.equal(true);
+ it('renders an open chevron button', () => {
+ expect(wrapper.find(IconButton).exists()).to.equal(true);
+ expect(wrapper.find(Icon).prop('glyph')).to.equal('ChevronUp');
+ });
+
+ it('does not render the loader', () => {
+ expect(wrapper.find(ShellLoader).exists()).to.equal(false);
});
});
- context('when isExpanded prop is false', () => {
- it('renders an open chevron button', () => {
+ context('when isExpanded is false and isOperationInProgress is true', () => {
+ it('renders the loader', () => {
const wrapper = mount( {}}
showInfoModal={() => {}}
/>);
- expect(wrapper.find(IconButton).exists()).to.equal(true);
- expect(wrapper.find(Icon).prop('glyph')).to.equal('ChevronUp');
+ expect(wrapper.find(ShellLoader).exists()).to.equal(true);
});
});
@@ -58,6 +78,7 @@ describe('ShellHeader', () => {
it('has a button to toggle the container', async() => {
const wrapper = shallow( {}}
showInfoModal={() => {}}
/>);