Skip to content

Commit

Permalink
fix: add red border on url with empty string
Browse files Browse the repository at this point in the history
Signed-off-by: Md Asif Raza <itsmdasifraza@gmail.com>
  • Loading branch information
itsmdasifraza committed Jun 5, 2024
1 parent d922086 commit d162b7a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* unique id used to focus codemirror input
*/
export let codeId = "";
let componentClass = "";
export { componentClass as class };
const environmentHelper = new EnvironmentHeper();
let trackParanthesis: unknown[] = [];
Expand Down Expand Up @@ -108,6 +110,7 @@
{placeholder}
{disabled}
{id}
{componentClass}
/>

{#if trackParanthesis.length === 2 && filterData.length > 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* environment dialog box unique id
*/
export let id;
export let componentClass;
let inputWrapper: HTMLElement;
let localEnvKey = "";
Expand Down Expand Up @@ -349,7 +350,7 @@
</script>

<div class="w-100 basic-code-mirror-input" bind:this={inputWrapper}>
<div class="" bind:this={codeMirrorEditorDiv} />
<div class={componentClass} bind:this={codeMirrorEditorDiv} />
</div>
<svelte:window on:keydown={handleKeyPress} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
{onUpdateEnvironment}
{environmentVariables}
codeId={"url"}
class={"input-url"}
/>

<!-- Send button -->
Expand All @@ -139,7 +140,16 @@
type="default"
disable={isSendRequestInProgress ? true : false}
onClick={() => {
onSendButtonClicked(environmentVariables);
if (requestUrl === "") {
const codeMirrorElement = document.querySelector(
".input-url .cm-editor",
);
if (codeMirrorElement) {
codeMirrorElement.classList.add("url-red-border");
}
} else {
onSendButtonClicked(environmentVariables);
}
}}
/>

Expand Down Expand Up @@ -185,4 +195,7 @@
padding: 7px;
background-color: var(--bg-secondary-400);
}
:global(.url-red-border) {
border: 1px solid var(--border-danger-200) !important;
}
</style>

0 comments on commit d162b7a

Please sign in to comment.