From ee0460ff5951ca49a09db8887fdc4418fe75e592 Mon Sep 17 00:00:00 2001 From: fechin Date: Wed, 23 Nov 2022 17:54:00 +0800 Subject: [PATCH] Added label for card --- themes/coo/layout/_partial/index/card.ejs | 2 +- themes/coo/layout/index.ejs | 1 + themes/coo/source/css/style.tailwindcss | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/themes/coo/layout/_partial/index/card.ejs b/themes/coo/layout/_partial/index/card.ejs index b8a1e6f..738c913 100644 --- a/themes/coo/layout/_partial/index/card.ejs +++ b/themes/coo/layout/_partial/index/card.ejs @@ -1,5 +1,5 @@ -
+
data-label="<%- label %>" <% }%> >

<%- title %>

diff --git a/themes/coo/layout/index.ejs b/themes/coo/layout/index.ejs index 3fe80db..04653dc 100644 --- a/themes/coo/layout/index.ejs +++ b/themes/coo/layout/index.ejs @@ -13,6 +13,7 @@ <%- partial('_partial/index/card', { url: url_for(post.path), title: post.title, + label: post.label, icon: post.icon == undefined ? 'icon-style' : post.icon, background: post.background == undefined ? 'bg-emerald-500' : post.background }) %> diff --git a/themes/coo/source/css/style.tailwindcss b/themes/coo/source/css/style.tailwindcss index f17c963..75359af 100644 --- a/themes/coo/source/css/style.tailwindcss +++ b/themes/coo/source/css/style.tailwindcss @@ -45,11 +45,23 @@ html.scrollbar { } .home .card { - @apply p-4 flex items-center rounded-lg shadow-sm cursor-pointer text-slate-900/90 bg-opacity-[.65] fadeIn; + @apply relative p-4 flex items-center rounded-lg shadow-sm cursor-pointer text-slate-900/90 bg-opacity-[.65] fadeIn; @apply dark:text-slate-300 dark:bg-opacity-50; @apply hover:text-slate-50/90 hover:bg-opacity-100 hover:shadow-xl; } +.home .card[data-label]::before { + content: attr(data-label); + display: block; + position: absolute; + font-size: 10px; + right: 8px; + top: 8px; + background: rgba(255 255 255 / 0.3); + border-radius: 4px; + padding: 1px 3px 2px 3px; +} + .home .card > i { @apply text-3xl; }