Skip to content

Commit 320bfd6

Browse files
authored
Merge pull request #84 from nemozak1/request-body-json-editor
Improve styling for the json editor and response body
2 parents 76f9b75 + 44bc0b4 commit 320bfd6

File tree

1 file changed

+58
-14
lines changed

1 file changed

+58
-14
lines changed

src/components/Preview.vue

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,8 @@ const onError = (error) => {
284284
placeholder="Request Header (Header1:Value1::Header2:Value2)"
285285
/>
286286
</div>
287-
<p v-show="exampleRequestBody" class="header-container">{{ exampleBodyTitle }}:</p>
288-
<div class="flex-preview-panel" v-show="exampleRequestBody">
289-
<!-- <textarea v-model="exampleRequestBody" rows="8" cols="40"></textarea> -->
290-
<!-- <input type="text" v-model="exampleRequestBody" /> -->
291-
<!-- <pre>{{ JSON.stringify(exampleRequestBody, null, 2) }}</pre> -->
287+
<div class="json-editor-container" v-show="exampleRequestBody">
288+
<p v-show="exampleRequestBody" class="header-container request-body-header">{{ exampleBodyTitle }}:</p>
292289
<div class="json-editor jse-theme-dark">
293290
<JsonEditorVue
294291
v-model="exampleRequestBody"
@@ -300,10 +297,14 @@ const onError = (error) => {
300297
</div>
301298

302299
</div>
303-
<div v-show="successResponseBody">
304-
<p class="header-container">{{ responseHeaderTitle }}:</p>
305-
<pre><button @click="copyToClipboard" class="copy-button icon-md-heavy" title="Copy to Clipboard"><i class="material-icons">content_copy</i></button>
306-
<code><div id="code" v-html="successResponseBody"></div></code></pre>
300+
<div v-show="successResponseBody" class="success-response-container">
301+
<div class="success-response-header-container">
302+
<p class="header-container success-response-header">{{ responseHeaderTitle }}:</p>
303+
<button @click="copyToClipboard" class="copy-button icon-md-heavy" title="Copy to Clipboard"><i class="material-icons">content_copy</i></button>
304+
</div>
305+
<pre>
306+
<code><div id="code" v-html="successResponseBody"></div></code>
307+
</pre>
307308
</div>
308309
<el-form ref="roleFormRef" :model="roleForm">
309310
<div v-show="showRequiredRoles">
@@ -396,12 +397,11 @@ span {
396397
font-size: 28px;
397398
}
398399
pre {
399-
margin-left: -25px;
400-
margin-right: -25px;
401-
padding: 30px 30px 10px 30px;
400+
padding: 0px 30px 0px 30px;
402401
max-height: 340px;
403402
background-color: #253047;
404403
font-size: 14px;
404+
margin: 0;
405405
font-family: 'Roboto';
406406
font-weight: normal;
407407
}
@@ -441,11 +441,39 @@ li {
441441
background-color: var(--el-border-color-light);
442442
z-index: var(--el-index-normal);
443443
}
444+
.request-body-header {
445+
background-color: #010B20;
446+
margin-right: auto;
447+
margin-top: 0;
448+
}
449+
.json-editor-container {
450+
display: flex;
451+
flex-direction: column;
452+
margin-left: -25px;
453+
margin-right: -25px;
454+
background-color: #010B20;
455+
padding: 25px 25px 25px 25px;
456+
}
444457
.json-editor {
445458
/* the list of default vars to change can be found here: https://github.com/josdejong/svelte-jsoneditor/blob/main/src/lib/themes/defaults.scss */
446-
--jse-theme-color: #253047;
447-
--jse-theme-color-highlight: #4a5c84;
459+
width: 100%;
460+
margin-left: -5px;
461+
margin-right: -5px;
462+
--jse-theme-color: #010B20;
463+
--jse-key-color: #ffffff;
464+
--jse-value-color: #6a8759;
465+
--jse-value-color-string: #6a8759;
466+
--jse-background-color: #010B20;
467+
--jse-context-menu-background: #010B20;
468+
--jse-theme-color-highlight: #010B20;
469+
--jse-context-menu-pointer-hover-background: #253047;
470+
--jse-context-menu-background-highlight: #253047;
471+
--jse-context-menu-pointer-background: #253047;
472+
--jse-context-menu-tip-background: #253047;
473+
--jse-modal-background: #010B20;
474+
--jse-panel-background: #010B20;
448475
--jse-font-family-mono: 'Roboto', 'Courier New', monospace;
476+
--jse-main-border: none;
449477
}
450478
.flex-preview-panel {
451479
display: flex;
@@ -498,6 +526,22 @@ li {
498526
#conector-method-link {
499527
color: white !important;
500528
}
529+
.success-response-header-container {
530+
margin-left: 25px;
531+
margin-right: 25px;
532+
display: flex;
533+
flex-direction: row;
534+
justify-content: space-between;
535+
background-color: #253047;
536+
}
537+
.success-response-header {
538+
margin-top: 25px;
539+
}
540+
.success-response-container{
541+
background-color: #253047;
542+
margin-right: -25px;
543+
margin-left: -25px;
544+
}
501545
.copy-button {
502546
background: none;
503547
border: none;

0 commit comments

Comments
 (0)