rapidoc
Version:
RapiDoc - Open API spec viewer with built in console
67 lines (64 loc) • 2.72 kB
JavaScript
import { html } from 'lit';
import logoTemplate from '~/templates/logo-template';
/* eslint-disable indent */
export default function headerTemplate() {
return html`
<header class="row main-header regular-font" part="section-header" style="padding:8px 4px 8px 4px;min-height:48px;">
<div class="only-large-screen-flex" style="align-items: center;">
<slot name="logo" class="logo" part="section-logo">
${logoTemplate('height:36px;width:36px;margin-left:5px')}
<!-- m-logo style="height:36px;width:36px;margin-left:5px"></m-logo -->
</slot>
<div class="header-title" part="label-header-title">${this.headingText}</div>
</div>
<div style="margin: 0px 8px;display:flex;flex:1">
${(this.allowSpecUrlLoad === 'false')
? ''
: html`
<input id="spec-url"
type="text"
style="font-size:var(--font-size-small)"
class="header-input mono-font"
part="textbox textbox-spec-url"
placeholder="Spec URL"
value="${this.specUrl || ''}"
@change="${this.onSpecUrlChange}"
spellcheck="false"
>
<div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
`
}
${(this.allowSpecFileLoad === 'false')
? ''
: html`
<input id="spec-file"
part = "file-input"
type="file"
style="display:none"
value="${this.specFile || ''}"
@change="${this.onSpecFileChange}"
spellcheck="false"
>
<button class="m-btn primary only-large-screen" style="margin-left:10px;" part="btn btn-fill" @click="${this.onFileLoadClick}"> LOCAL JSON FILE </button>
`
}
<slot name="header"></slot>
${(this.allowSearch === 'false' || 'read focused'.includes(this.renderStyle))
? ''
: html`
<input id="search" class="header-input" type="text" part="textbox textbox-header-filter" placeholder="Filter" @change="${this.onSearchChange}" style="max-width:130px;margin-left:10px;" spellcheck="false" >
<div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
`
}
${(this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle))
? ''
: html`
<button class="m-btn primary only-large-screen" part="btn btn-fill btn-search" style="margin-left:10px;" @click="${this.onShowSearchModalClicked}">
Search
</button>
`
}
</div>
</header>`;
}
/* eslint-enable indent */