Skip to content

Commit 8bc50a4

Browse files
authored
Add improvements to connect form connect message (#160)
1 parent dca640f commit 8bc50a4

File tree

2 files changed

+16
-34
lines changed

2 files changed

+16
-34
lines changed

src/views/webview-app/components/connect-form/form-actions.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,14 @@ class FormActions extends React.Component<props> {
6262
renderConnect = (): React.ReactNode => {
6363
const syntaxError = this.hasSyntaxError() ? 'disabled' : '';
6464

65-
const { isConnecting } = this.props;
66-
67-
let connectingText = 'Connect';
68-
if (isConnecting) {
69-
connectingText = 'Connecting...';
70-
}
71-
7265
return (
7366
<button
7467
type="submit"
7568
name="connect"
7669
className={classnames(styles.btn, syntaxError)}
7770
onClick={this.onConnectClicked}
7871
>
79-
{connectingText}
72+
Connect
8073
</button>
8174
);
8275
};
@@ -91,12 +84,15 @@ class FormActions extends React.Component<props> {
9184
let colorStyle = styles['connection-message-container-success'];
9285
let hasMessage = false;
9386

94-
if (this.hasError()) {
87+
if (this.props.isConnected) {
88+
hasMessage = true;
89+
} else if (this.props.isConnecting) {
90+
hasMessage = true;
91+
message = 'Connecting...';
92+
} else if (this.hasError()) {
9593
hasMessage = true;
9694
message = this.props.errorMessage;
9795
colorStyle = styles['connection-message-container-error'];
98-
} else if (this.props.isConnected) {
99-
hasMessage = true;
10096
}
10197

10298
if (hasMessage === true) {

src/views/webview-app/connect.module.less

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@pw: #21313c;
22
@alertRed: #cf4a22;
33
@warningText: #ffdd49;
4-
@green: #13aa52;
4+
@green: rgb(19, 170, 82);
55
@gray: #5d6c74;
66

77
.page {
@@ -35,7 +35,7 @@ label {
3535

3636
.connect {
3737
&-is-connected {
38-
border: 2px solid green;
38+
border: 2px solid @green;
3939
}
4040

4141
::-webkit-scrollbar {
@@ -93,6 +93,7 @@ label {
9393
}
9494

9595
&-success {
96+
color: white;
9697
background: @green;
9798
padding: 4px 10px;
9899
border-radius: 3px;
@@ -117,24 +118,6 @@ label {
117118
}
118119
}
119120

120-
.success {
121-
background-color: #90ee90;
122-
border-bottom: 3px solid #008000;
123-
position: absolute;
124-
top: 0;
125-
left: 0;
126-
height: 72px;
127-
width: 100%;
128-
129-
p {
130-
margin: 26px auto;
131-
width: 70%;
132-
color: #008000;
133-
text-align: center;
134-
font-weight: bold;
135-
}
136-
}
137-
138121
.connect-form {
139122
margin: 10px;
140123
width: 320px;
@@ -156,8 +139,10 @@ label {
156139

157140
div {
158141
border: none;
159-
background-color: var(--vscode-searchEditor-textInputBorder,
160-
rgba(161, 161, 161, 0.5));
142+
background-color: var(
143+
--vscode-searchEditor-textInputBorder,
144+
rgba(161, 161, 161, 0.5)
145+
);
161146
}
162147
}
163148

@@ -201,7 +186,8 @@ label {
201186
&-file-button {
202187
width: 100%;
203188
background: var(--vscode-input-background, transparent);
204-
border: 1px solid var(--vscode-searchEditor-textInputBorder, rgba(161, 161, 161, 0.5));
189+
border: 1px solid
190+
var(--vscode-searchEditor-textInputBorder, rgba(161, 161, 161, 0.5));
205191
border-radius: 3px;
206192
color: var(--vscode-editor-foreground);
207193
padding: 8px 4px 9px;

0 commit comments

Comments
 (0)