Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 9 additions & 92 deletions public/components/file-box/file-box.css
Original file line number Diff line number Diff line change
@@ -1,95 +1,12 @@
.box-file-info {
display: flex;
flex-direction: column;
padding: 10px;
border-top: 2px solid #351ea7;
border-left: 2px solid #351ea7;
background: linear-gradient(to bottom, rgb(12 15 94 / 27%) 0%, rgb(0 0 0 / 0%) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#450c0f5e', endColorstr='#00000000', GradientType=0);
border-radius: 4px;
box-shadow: 1px 1px 10px rgb(18 101 109 / 10%);
}

.box-file-info+.box-file-info {
margin-top: 10px;
}

.box-file-info>.box-header {
display: flex;
align-items: center;
height: 20px;
margin-bottom: 20px;
}

.box-file-info>.box-header>span {
width: 24px;
height: 24px;
border-radius: 4px;
box-sizing: border-box;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
font-family: mononoki;
font-weight: bold;
text-shadow: 2px 2px 10px #000;
}

.box-file-info>.box-header>span.Critical {
background: #d32f2f;
}

.box-file-info>.box-header>span.Warning {
background: #f08e26;
}

.box-file-info>.box-header>span.Information {
background: #0288d1ab;
}

.box-file-info>.box-header>.box-title {
font-size: 18px;
font-variant: small-caps;
font-family: mononoki;
color: #FFF;
font-weight: bold;
letter-spacing: 1px;
text-decoration: none;
}

.box-file-info>.box-header>a:hover {
text-decoration: underline;
cursor: pointer;
}

.box-file-info>.box-header>.box-file {
margin-left: auto;
color: #B3E5FC;
display: flex;
}

.box-file-info>.box-header>.box-file a {
color: inherit;
text-decoration: none;
}

.box-file-info>.box-header>.box-file a:hover {
text-decoration: underline;
}

.box-file-info>.box-header>.box-file i {
margin-right: 6px;
}

/**
* LICENSES
*/
.box-file-info>.box-container-licenses {
.box-container-licenses {
display: flex;
flex-wrap: wrap;
}

.box-file-info>.box-container-licenses>div {
.box-container-licenses>div {
flex-grow: 1;
flex-basis: 150px;
height: 26px;
Expand All @@ -104,30 +21,30 @@
/**
* WARNINGS
*/
.box-file-info>.box-container-warning {
.box-container-warning {
display: flex;
}

.box-file-info>.box-container-warning .info {
.box-container-warning .info {
flex-grow: 1;
display: flex;
flex-direction: column;
}

.box-file-info>.box-container-warning .info>p.title {
.box-container-warning .info>p.title {
font-size: 15px;
color: #ede3ff;
}

.box-file-info>.box-container-warning .info>p.value {
.box-container-warning .info>p.value {
font-size: 12px;
margin-top: 5px;
color: var(--secondary);
font-family: mononoki;
word-break: break-all;
}

.box-file-info>.box-container-warning .view-more {
.box-container-warning .view-more {
width: 40px;
height: 40px;
display: flex;
Expand All @@ -144,13 +61,13 @@
transition: all 0.4s ease;
}

.box-file-info>.box-container-warning .view-more:hover {
.box-container-warning .view-more:hover {
cursor: pointer;
border-color: var(--secondary);
color: var(--secondary);
}

.box-file-info>.box-source-code-position {
.box-source-code-position {
height: 18px;
margin-top: 10px;
font-size: 14px;
Expand Down
194 changes: 152 additions & 42 deletions public/components/file-box/file-box.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,154 @@
// Import Third-party Dependencies
import { LitElement, html, css, nothing } from "lit";
import { when } from "lit/directives/when.js";

// Import Internal Dependencies
import { createDOMElement } from "../../common/utils";

export function createFileBox(options = {}) {
const { title, fileName, childs = [], titleHref = "#", fileHref = null, severity = null } = options;

const defaultHrefProperties = { target: "_blank", rel: "noopener noreferrer" };
const fileDomElement = fileHref === null ?
createDOMElement("p", { text: fileName }) :
createDOMElement("a", { text: fileName, attributes: { href: fileHref, ...defaultHrefProperties } });

const boxHeader = createDOMElement("div", {
classList: ["box-header"],
childs: [
...(severity === null ? [] : [
createDOMElement("span", { classList: [severity], text: severity.charAt(0).toUpperCase() })
]),
titleHref === null ?
createDOMElement("p", { text: title, className: "box-title" }) :
createDOMElement("a", {
text: title,
className: "box-title",
attributes: {
href: titleHref, ...defaultHrefProperties
}
}),
createDOMElement("p", {
className: "box-file",
childs: [
createDOMElement("i", { classList: ["icon-docs"] }),
fileDomElement
]
})
]
});

return createDOMElement("div", {
classList: ["box-file-info"],
childs: [
boxHeader,
...childs.filter((element) => element !== null)
]
});
import "../icon/icon.js";

class FileBox extends LitElement {
static styles = css`
.box-file-info {
display: flex;
flex-direction: column;
padding: 10px;
border-top: 2px solid #351ea7;
border-left: 2px solid #351ea7;
background: linear-gradient(to bottom, rgb(12 15 94 / 27%) 0%, rgb(0 0 0 / 0%) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#450c0f5e', endColorstr='#00000000', GradientType=0);
border-radius: 4px;
box-shadow: 1px 1px 10px rgb(18 101 109 / 10%);
}

.box-file-info+.box-file-info {
margin-top: 10px;
}

.box-file-info>.box-header {
display: flex;
align-items: center;
height: 20px;
margin-bottom: 20px;
}

.box-file-info>.box-header>span {
width: 24px;
height: 24px;
border-radius: 4px;
box-sizing: border-box;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
font-family: mononoki;
font-weight: bold;
text-shadow: 2px 2px 10px #000;
}

.box-file-info>.box-header>span.Critical {
background: #d32f2f;
}

.box-file-info>.box-header>span.Warning {
background: #f08e26;
}

.box-file-info>.box-header>span.Information {
background: #0288d1ab;
}

.box-file-info>.box-header>.box-title {
font-size: 18px;
font-variant: small-caps;
font-family: mononoki;
color: #FFF;
font-weight: bold;
letter-spacing: 1px;
text-decoration: none;
}

.box-file-info>.box-header>a:hover {
text-decoration: underline;
cursor: pointer;
}

.box-file-info>.box-header>.box-file {
margin-left: auto;
color: #B3E5FC;
display: flex;
}

.box-file-info>.box-header>.box-file a {
color: inherit;
text-decoration: none;
}

.box-file-info>.box-header>.box-file a:hover {
text-decoration: underline;
}

.box-file-info>.box-header>.box-file i {
margin-right: 6px;
}
`;
static properties = {
title: { type: String },
fileName: { type: String },
childs: { type: Array },
titleHref: { type: String },
fileHref: { type: String },
severity: { type: String }
};

constructor() {
super();
this.title = "";
this.fileName = "";
this.titleHref = "#";
this.fileHref = null;
this.severity = null;
}

render() {
return html`
<div class="box-file-info">
<div class="box-header">
${when(
this.severity,
(severity) => html`
<span class=${severity}>
${severity.charAt(0).toUpperCase()}
</span>
`,
() => nothing
)}

${when(
this.titleHref,
(titleHref) => html`
<a class="box-title" href=${titleHref} target="_blank" rel="noopener noreferrer">
${this.title}
</a>
`,
() => html`<span class="box-title">${this.title}</span>`
)}

<div class="box-file">
<nsecure-icon style="margin-right:8px;" name="docs"></nsecure-icon>
${when(
this.fileHref,
(fileHref) => html`
<a href=${fileHref} target="_blank" rel="noopener noreferrer">
${this.fileName}
</a>
`,
() => html`<span>${this.fileName}</span>`
)}
</div>
</div>
<slot></slot>
</div>
`;
}
}

customElements.define("file-box", FileBox);
19 changes: 17 additions & 2 deletions public/components/icon/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,30 @@ const kIcons = {
0-64.512 26.624t-27.648 64.512v475.136q0 37.888 27.648 64.512t64.512 27.648h475.136q37.888
0 64.512-27.648t26.624-64.512zM804.864 237.568v475.136q0 68.608-48.128 116.736t-116.736
48.128h-475.136q-68.608 0-116.736-48.128t-48.128-116.736v-475.136q0-67.584 48.128-115.712t116.736-49.152h475.136q67.584
0 116.736 49.152t48.128 115.712z"/>
0 116.736 49.152t48.128 115.712z"/>,
</svg>
`,
docs: html`
<svg viewBox="0 0 804 1024" aria-hidden="true">
<path fill="currentColor"
d="M968.704 219.136q23.552 0 38.912 16.384t16.384 38.912v694.272q0 23.552-16.384
38.912t-38.912 16.384h-547.84q-23.552 0-38.912-16.384t-16.384-38.912v-163.84h-310.272
q-23.552 0-38.912-16.384t-16.384-38.912v-384q0-22.528 11.264-50.176t27.648-43.008
l233.472-233.472q15.36-16.384 43.008-27.648t50.176-11.264h237.568q23.552 0 38.912
16.384t16.384 38.912v187.392q38.912-23.552 72.704-23.552h237.568zM658.432 340.992
l-171.008 171.008h171.008v-171.008zM292.864 121.856l-171.008 171.008h171.008
v-171.008zM404.48 491.52l180.224-180.224v-238.592h-219.136v238.592q0 22.528-15.36
37.888t-38.912 16.384h-238.592v365.568h292.864v-146.432q0-22.528 11.264-50.176
t27.648-43.008zM951.296 951.296v-658.432h-220.16v237.568q0 22.528-15.36 38.912
t-38.912 15.36h-237.568v366.592h512z"/>
</svg>
`
};

export class Icon extends LitElement {
static styles = css`
:host {
width: 1em;
width: 1.2em;
height: 1em;
margin-right: 0.2em;
margin-right: 0.2em;
Expand Down
2 changes: 1 addition & 1 deletion public/components/package/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class PackageInfo {
const files = document.createElement("package-files");
files.package = this;
files.id = "pan-files";
files.classList.add("package-container");
files.classList.add("package-container", "hidden");
panFiles.parentElement.replaceChild(files, panFiles);
}

Expand Down
Loading
Loading