Initial Commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const moment = require("moment")
|
||||
|
||||
module.exports = class {
|
||||
onCreate({kind, value, updated}) {
|
||||
this.state = {text: null, color: "color-menu", tooltip: null}
|
||||
|
||||
if (value == null || value == "") {
|
||||
return
|
||||
}
|
||||
|
||||
switch (kind) {
|
||||
case "date": {
|
||||
const m = moment(value)
|
||||
if (m.year() < 2) {
|
||||
break
|
||||
}
|
||||
|
||||
const dateStr = m.format("MMM D, YYYY")
|
||||
|
||||
this.state.text = dateStr
|
||||
|
||||
if (updated != null && Date.parse(updated) > Date.parse(value)) {
|
||||
const m2 = moment(updated)
|
||||
this.state.tooltip = "Originally posted: " + dateStr
|
||||
this.state.text = m2.format("MMM D, YYYY") + " *"
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case "tag": {
|
||||
this.state.color = `color-tag-${value.kind.toLowerCase()}`
|
||||
this.state.text = value.name
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case "author": {
|
||||
this.state.text = value
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
this.state.color = "color-menu"
|
||||
this.state.text = value
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<div if(state.text != null && state.text != "") class=["item-meta", input.kind, state.color] title=state.tooltip>${state.text}</div>
|
||||
<div class="spc"> </div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<if(input.enableAllTags)>
|
||||
<item-meta for(tag in input.tags) kind="tag" value=tag />
|
||||
</if>
|
||||
<else>
|
||||
<item-meta kind="tag" value=(input.tags[0] || null) />
|
||||
</else>
|
||||
@@ -0,0 +1,15 @@
|
||||
<tr class="content-list-item color-primary">
|
||||
<td class="icon color-highlight-primary">${input.icon}</td>
|
||||
<td class="content color-primary color-highlight-dark">
|
||||
<div class="title">
|
||||
<a class="color-primary" href=input.link>${input.name}</a>
|
||||
</div>
|
||||
<div class="description color-text">${input.description || ""}</div>
|
||||
<div class="meta">
|
||||
<item-meta kind="date" value=input.createdDate updated=input.updatedDate />
|
||||
<item-meta kind="date" value=input.fictionalDate />
|
||||
<item-tag-list tags=input.tags enableAllTags=input.enableAllTags />
|
||||
<item-meta kind="author" value=input.author />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,51 @@
|
||||
tr.content-list-item {
|
||||
user-select: none;
|
||||
outline: 0.05px solid;
|
||||
|
||||
> td.icon {
|
||||
font-size: 2.75em;
|
||||
text-align: center;
|
||||
width: 2.5ch;
|
||||
outline: 0.05px solid;
|
||||
}
|
||||
|
||||
> td.content {
|
||||
padding: 0.25em;
|
||||
padding-bottom: 0.33em;
|
||||
margin: 0;
|
||||
|
||||
> .title {
|
||||
padding: 0.25em 1ch;
|
||||
user-select: text;
|
||||
|
||||
a {
|
||||
font-size: 1.333em;
|
||||
}
|
||||
a:hover {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
> .description {
|
||||
margin: 0 1ch;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .meta {
|
||||
> div {
|
||||
display: inline-block;
|
||||
padding: 0.25em 1ch;
|
||||
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
> div.spc {
|
||||
padding: 0;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user