diff --git a/microsite/pages/en/plugins.js b/microsite/pages/en/plugins.js index de336444ab..91f4138174 100644 --- a/microsite/pages/en/plugins.js +++ b/microsite/pages/en/plugins.js @@ -16,11 +16,30 @@ const { const pluginsDirectory = require('path').join(process.cwd(), 'data/plugins'); const pluginMetadata = fs .readdirSync(pluginsDirectory) - .map(file => yaml.load(fs.readFileSync(`./data/plugins/${file}`, 'utf8'))) + .map(file => { + const fileContent = fs.readFileSync(`./data/plugins/${file}`, 'utf8'); + let metadata = yaml.load(fileContent); + + const gitIsoDate = require('child_process') + .execFileSync('git', [ + 'log', + '-1', + '--format="%ai"', + '--reverse', + `./data/plugins/${file}`, + ]) + .toString(); + + metadata.date = new Date(gitIsoDate); + + return metadata; + }) .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase())); const truncate = text => text.length > 170 ? text.substr(0, 170) + '...' : text; +const newForDays = 100; + const addPluginDocsLink = '/docs/plugins/add-to-marketplace'; const defaultIconUrl = 'img/logo-gradient-on-dark.svg'; @@ -100,8 +119,15 @@ const Plugins = () => ( authorUrl, documentation, category, + date, }) => (
+ {Math.trunc((Date.now() - date) / (1000 * 60 * 60 * 24)) < + newForDays && ( +
+ NEW +
+ )}
{title} diff --git a/microsite/static/css/plugins.css b/microsite/static/css/plugins.css index b9aebfa84c..55a0c6df40 100644 --- a/microsite/static/css/plugins.css +++ b/microsite/static/css/plugins.css @@ -4,6 +4,7 @@ padding: 16px; display: flex; flex-direction: column; + position: relative; } .PluginGrid { @@ -141,3 +142,31 @@ #add-plugin-card { border: 1px solid #69ddc7; } + +/* RIBBON */ + +.ribbon { + width: 80px; + height: 80px; + overflow: hidden; + position: absolute; +} +.ribbon span { + position: absolute; + display: block; + width: 140px; + padding: 4px 0; + background-color: rgb(54, 186, 162, 0.85); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); + color: #fff; + text-align: center; +} +.ribbon-top-right { + top: 0; + right: 0; +} +.ribbon-top-right span { + left: -17px; + top: 11px; + transform: rotate(45deg); +}