Add alpha, beta to header in sidepanel

pull/1/head
Grandschtroumpf 6 years ago
parent e16c1061ea
commit 7b26e6e971
  1. 27
      src/app/components/side-panel.js

@ -8,6 +8,7 @@ const css = csjs`
overflow-y: hidden; overflow-y: hidden;
} }
.swapitTitle { .swapitTitle {
margin: 0;
text-transform: uppercase; text-transform: uppercase;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -21,12 +22,7 @@ const css = csjs`
height: 35px; height: 35px;
padding: 0 20px; padding: 0 20px;
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
justify-content: flex-start;
}
.swapitHeader h6 {
margin: 0;
} }
.icons i { .icons i {
height: 80%; height: 80%;
@ -39,6 +35,14 @@ const css = csjs`
.titleInfo { .titleInfo {
padding-left: 10px; padding-left: 10px;
} }
.versionWarning {
background-color: var(--light);
padding: 0 7px;
font-weight: bolder;
margin-left: 5px;
text-transform: lowercase;
cursor: default;
}
` `
const options = { const options = {
@ -66,17 +70,26 @@ export class SidePanel extends AbstractPanel {
renderHeader () { renderHeader () {
let name = ' - ' let name = ' - '
let docLink = '' let docLink = ''
let versionWarning
if (this.active) { if (this.active) {
const { profile } = this.store.getOne(this.active) const { profile } = this.store.getOne(this.active)
name = profile.displayName ? profile.displayName : profile.name name = profile.displayName ? profile.displayName : profile.name
const docsRoot = 'https://remix.readthedocs.io/en/latest/' const docsRoot = 'https://remix.readthedocs.io/en/latest/'
docLink = profile.documentation ? yo`<a href="${docsRoot}${profile.documentation}" class="${css.titleInfo}" title="link to documentation" target="_blank"><i aria-hidden="true" class="fas fa-book"></i></a>` : '' docLink = profile.documentation ? yo`<a href="${docsRoot}${profile.documentation}" class="${css.titleInfo}" title="link to documentation" target="_blank"><i aria-hidden="true" class="fas fa-book"></i></a>` : ''
if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) {
versionWarning = yo`<small title="Version Alpha" class="${css.versionWarning}">alpha</small>`
}
// Beta
if (profile.version && profile.version.match(/\b(\w*beta\w*)\b/g)) {
versionWarning = yo`<small title="Version Beta" class="${css.versionWarning}">beta</small>`
}
} }
return yo` return yo`
<header class="${css.swapitHeader}"> <header class="${css.swapitHeader}">
<h6 class="${css.swapitTitle}">${name}</h6> <h6 class="${css.swapitTitle}">${name}</h6>
${docLink} ${docLink}
${versionWarning}
</header> </header>
` `
} }

Loading…
Cancel
Save