@hashicorp/hashi-basic-list
Advanced tools
Comparing version 0.0.10 to 1.0.0
@@ -14,13 +14,19 @@ 'use strict'; | ||
_ref$date_icon = _ref.date_icon, | ||
date_icon = _ref$date_icon === undefined ? 'true' : _ref$date_icon; | ||
date_icon = _ref$date_icon === undefined ? 'true' : _ref$date_icon, | ||
expire_old = _ref.expire_old; | ||
var data = reshapePreactComponents.decode(_data); | ||
var today = new Date(); | ||
var dateIcon = date_icon === 'true' || date_icon === true; | ||
return preact.h( | ||
'ul', | ||
{ 'class': 'g-basic-list' }, | ||
data.map(function (d) { | ||
return preact.h( | ||
data.reduce(function (acc, d) { | ||
var date = d.date ? new Date(d.date) : null; | ||
var renderTopSection = dateIcon && d.location || !dateIcon && date || d.detail; | ||
if (expire_old && date && today.getTime() > date.getTime()) return acc; | ||
acc.push(preact.h( | ||
'li', | ||
{ 'data-id': d.id ? d.id : '' }, | ||
date_icon === 'true' && d.date && preact.h( | ||
date && dateIcon && preact.h( | ||
'div', | ||
@@ -31,3 +37,3 @@ { 'class': 'date' }, | ||
null, | ||
strftime('%d', new Date(d.date)) | ||
strftime('%d', date) | ||
), | ||
@@ -37,3 +43,3 @@ preact.h( | ||
null, | ||
strftime('%b', new Date(d.date)) | ||
strftime('%b', date) | ||
) | ||
@@ -47,15 +53,15 @@ ), | ||
{ 'class': 'content' }, | ||
preact.h( | ||
renderTopSection && preact.h( | ||
'div', | ||
{ 'class': 'top' }, | ||
date_icon === 'true' && d.location && preact.h( | ||
!dateIcon && date && preact.h( | ||
'span', | ||
null, | ||
preact.h('i', { 'class': 'pin' }), | ||
d.location | ||
strftime('%d %b %Y', date) | ||
), | ||
date_icon === 'false' && d.date && preact.h( | ||
d.location && preact.h( | ||
'span', | ||
null, | ||
strftime('%d %b %Y', new Date(d.date)) | ||
preact.h('i', { 'class': 'pin' }), | ||
d.location | ||
), | ||
@@ -75,4 +81,5 @@ d.detail && preact.h( | ||
) | ||
); | ||
}) | ||
)); | ||
return acc; | ||
}, []) | ||
); | ||
@@ -79,0 +86,0 @@ } |
{ | ||
"name": "@hashicorp/hashi-basic-list", | ||
"description": "simple vertical list with optional date and location render", | ||
"version": "0.0.10", | ||
"version": "1.0.0", | ||
"main": "dist", | ||
"peerDependencies": { | ||
"@hashicorp/hashi-global-styles": "^0.1.2", | ||
"preact": "^8.2.6", | ||
"reshape-preact-components": "^0.6.0", | ||
"strftime": "^0.10.0" | ||
"@hashicorp/hashi-global-styles": "^1.0.0", | ||
"preact": "^8.2.7", | ||
"reshape-preact-components": "~0.6.0", | ||
"strftime": "~0.10.0" | ||
}, | ||
@@ -12,0 +12,0 @@ "publishConfig": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6607
185
1