forked from drowl87/hextra_mirror
chore: improve tags styling on card (#431)
* chore: improve tags styling on card * chore: npm run build:css
This commit is contained in:
parent
f439e6bb87
commit
e83c11f31a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com
|
||||
! tailwindcss v3.4.9 | MIT License | https://tailwindcss.com
|
||||
*//*
|
||||
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||
@ -596,10 +596,6 @@ video {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.hx-my-1 {
|
||||
margin-top: 0.25rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
.hx-my-1\.5 {
|
||||
margin-top: 0.375rem;
|
||||
margin-bottom: 0.375rem;
|
||||
@ -608,9 +604,6 @@ video {
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.-hx-mb-0 {
|
||||
margin-bottom: -0px;
|
||||
}
|
||||
.-hx-mb-0\.5 {
|
||||
margin-bottom: -0.125rem;
|
||||
}
|
||||
@ -719,9 +712,6 @@ video {
|
||||
.hx-h-2 {
|
||||
height: 0.5rem;
|
||||
}
|
||||
.hx-h-3 {
|
||||
height: 0.75rem;
|
||||
}
|
||||
.hx-h-3\.5 {
|
||||
height: 0.875rem;
|
||||
}
|
||||
@ -758,9 +748,6 @@ video {
|
||||
.hx-w-2 {
|
||||
width: 0.5rem;
|
||||
}
|
||||
.hx-w-3 {
|
||||
width: 0.75rem;
|
||||
}
|
||||
.hx-w-3\.5 {
|
||||
width: 0.875rem;
|
||||
}
|
||||
@ -888,10 +875,6 @@ video {
|
||||
.hx-gap-4 {
|
||||
gap: 1rem;
|
||||
}
|
||||
.hx-gap-x-1 {
|
||||
-moz-column-gap: 0.25rem;
|
||||
column-gap: 0.25rem;
|
||||
}
|
||||
.hx-gap-x-1\.5 {
|
||||
-moz-column-gap: 0.375rem;
|
||||
column-gap: 0.375rem;
|
||||
@ -1066,9 +1049,6 @@ video {
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
}
|
||||
.hx-p-0 {
|
||||
padding: 0px;
|
||||
}
|
||||
.hx-p-0\.5 {
|
||||
padding: 0.125rem;
|
||||
}
|
||||
@ -1087,10 +1067,6 @@ video {
|
||||
.hx-p-6 {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
.hx-px-1 {
|
||||
padding-left: 0.25rem;
|
||||
padding-right: 0.25rem;
|
||||
}
|
||||
.hx-px-1\.5 {
|
||||
padding-left: 0.375rem;
|
||||
padding-right: 0.375rem;
|
||||
@ -1099,6 +1075,10 @@ video {
|
||||
padding-left: 0.5rem;
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.hx-px-2\.5 {
|
||||
padding-left: 0.625rem;
|
||||
padding-right: 0.625rem;
|
||||
}
|
||||
.hx-px-3 {
|
||||
padding-left: 0.75rem;
|
||||
padding-right: 0.75rem;
|
||||
@ -1214,9 +1194,6 @@ video {
|
||||
.hx-text-xs {
|
||||
font-size: .75rem;
|
||||
}
|
||||
.hx-text-xxs {
|
||||
font-size: .65rem;
|
||||
}
|
||||
.hx-font-bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
@ -2128,7 +2105,7 @@ article details > summary::before {
|
||||
/* GenericDeleted */
|
||||
.dark .highlight .chroma .gd { color: #ffa198; background-color: #490202 }
|
||||
/* GenericEmph */
|
||||
.dark .highlight .chroma .ge { font-style: italic }
|
||||
.dark .highlight .chroma .ge { color: inherit; font-style: italic }
|
||||
/* GenericError */
|
||||
.dark .highlight .chroma .gr { color: #ffa198 }
|
||||
/* GenericHeading */
|
||||
@ -2287,12 +2264,12 @@ article details > summary::before {
|
||||
.dark .hextra-card:hover svg {
|
||||
color: currentColor;
|
||||
}
|
||||
/* If tag, position upright on the card */
|
||||
.hx-tag {
|
||||
.hextra-card-tag {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
z-index: 10;
|
||||
font-size: .65rem;
|
||||
}
|
||||
.steps h3 {
|
||||
counter-increment: step;
|
||||
@ -2514,7 +2491,7 @@ nav .search-wrapper {
|
||||
background-color: rgb(255 255 255 / .85);
|
||||
--tw-backdrop-blur: blur(12px);
|
||||
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
}
|
||||
.nav-container-blur:is(html[class~="dark"] *) {
|
||||
background-color: rgb(17 17 17 / 0.8) !important;
|
||||
@ -2589,7 +2566,7 @@ nav .search-wrapper {
|
||||
--tw-bg-opacity: .85;
|
||||
--tw-backdrop-blur: blur(12px);
|
||||
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
}
|
||||
.hextra-code-copy-btn:is(html[class~="dark"] *) {
|
||||
--tw-bg-opacity: 0.8;
|
||||
@ -2818,27 +2795,27 @@ body:is(html[class~="dark"] *) {
|
||||
.hx-group\/copybtn.copied .group-\[\.copied\]\/copybtn\:hx-hidden {
|
||||
display: none;
|
||||
}
|
||||
.data-\[state\=selected\]\:hx-block[data-state=selected] {
|
||||
.data-\[state\=selected\]\:hx-block[data-state="selected"] {
|
||||
display: block;
|
||||
}
|
||||
.data-\[state\=closed\]\:hx-hidden[data-state=closed] {
|
||||
.data-\[state\=closed\]\:hx-hidden[data-state="closed"] {
|
||||
display: none;
|
||||
}
|
||||
.data-\[state\=open\]\:hx-hidden[data-state=open] {
|
||||
.data-\[state\=open\]\:hx-hidden[data-state="open"] {
|
||||
display: none;
|
||||
}
|
||||
.data-\[state\=selected\]\:hx-border-primary-500[data-state=selected] {
|
||||
.data-\[state\=selected\]\:hx-border-primary-500[data-state="selected"] {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: hsl(var(--primary-hue) var(--primary-saturation) 50% / var(--tw-border-opacity));
|
||||
}
|
||||
.data-\[state\=selected\]\:hx-text-primary-600[data-state=selected] {
|
||||
.data-\[state\=selected\]\:hx-text-primary-600[data-state="selected"] {
|
||||
--tw-text-opacity: 1;
|
||||
color: hsl(var(--primary-hue) var(--primary-saturation) 45% / var(--tw-text-opacity));
|
||||
}
|
||||
.hx-group[data-theme=dark] .group-data-\[theme\=dark\]\:hx-hidden {
|
||||
.hx-group[data-theme="dark"] .group-data-\[theme\=dark\]\:hx-hidden {
|
||||
display: none;
|
||||
}
|
||||
.hx-group[data-theme=light] .group-data-\[theme\=light\]\:hx-hidden {
|
||||
.hx-group[data-theme="light"] .group-data-\[theme\=light\]\:hx-hidden {
|
||||
display: none;
|
||||
}
|
||||
@media (prefers-contrast: more) {
|
||||
@ -3383,9 +3360,6 @@ body:is(html[class~="dark"] *) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.ltr\:hx-right-1:where([dir="ltr"], [dir="ltr"] *) {
|
||||
right: 0.25rem;
|
||||
}
|
||||
.ltr\:hx-right-1\.5:where([dir="ltr"], [dir="ltr"] *) {
|
||||
right: 0.375rem;
|
||||
}
|
||||
@ -3460,9 +3434,6 @@ body:is(html[class~="dark"] *) {
|
||||
left: auto;
|
||||
}
|
||||
}
|
||||
.rtl\:hx-left-1:where([dir="rtl"], [dir="rtl"] *) {
|
||||
left: 0.25rem;
|
||||
}
|
||||
.rtl\:hx-left-1\.5:where([dir="rtl"], [dir="rtl"] *) {
|
||||
left: 0.375rem;
|
||||
}
|
||||
|
@ -33,10 +33,10 @@
|
||||
color: currentColor;
|
||||
}
|
||||
|
||||
/* If tag, position upright on the card */
|
||||
.hx-tag {
|
||||
.hextra-card-tag {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
z-index: 10;
|
||||
}
|
||||
font-size: .65rem;
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ linkTitle: Cards
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="../callout" title="Callout" icon="warning" >}}
|
||||
{{< card link="../callout" title="Card with tag" icon="tag" tag="A custom tag">}}
|
||||
{{< card link="../callout" title="Card with tag" icon="tag" tag="custom tag">}}
|
||||
{{< card link="/" title="No Icon" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="/" title="Image Card" image="https://source.unsplash.com/featured/800x600?landscape" subtitle="Unsplash Landscape" >}}
|
||||
{{< card link="/" title="Image Card" image="https://github.com/user-attachments/assets/71b7e3ec-1a8d-4582-b600-5425c6cc0407" subtitle="Internet Image" >}}
|
||||
{{< card link="/" title="Local Image" image="/images/card-image-unprocessed.jpg" subtitle="Raw image under static directory." >}}
|
||||
{{< card link="/" title="Local Image" image="images/space.jpg" subtitle="Image under assets directory, processed by Hugo." method="Resize" options="600x q80 webp" >}}
|
||||
{{< /cards >}}
|
||||
@ -69,20 +69,21 @@ For more on Hugo's built in image processing commands, methods, and options see
|
||||
|
||||
## Tags
|
||||
|
||||
The card supports adding tags with custom text and colors:
|
||||
Card supports adding tags which could be useful to show extra status information.
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="../callout" title="Card with default tag color" tag= "tag text" >}}
|
||||
{{< card link="../callout" title="Card with red tag" tag= "tag text" tagColor="red" >}}
|
||||
{{< card link="../callout" title="Card with blue tag" tag= "tag text" tagColor="blue" >}}
|
||||
{{< card link="../callout" title="Card with yellow tag" tag= "tag text" tagColor="yellow" >}}
|
||||
{{< card link="../callout" title="Card with default tag" tag="tag text" >}}
|
||||
{{< card link="../callout" title="Card with error tag" tag="tag text" tagType="error" >}}
|
||||
{{< card link="../callout" title="Card with info tag" tag="tag text" tagType="info" >}}
|
||||
{{< card link="../callout" title="Card with warning tag" tag="tag text" tagType="warning" >}}
|
||||
{{< card link="/" title="Image Card" image="https://github.com/user-attachments/assets/71b7e3ec-1a8d-4582-b600-5425c6cc0407" subtitle="Internet Image" tag="tag text" tagType="error" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
```
|
||||
{{</* cards */>}}
|
||||
{{</* card link="../callout" title="Card with default tag color" tag= "tag text" */>}}
|
||||
{{</* card link="../callout" title="Card with default red tag" tag= "tag text" tagColor="red" */>}}
|
||||
{{</* card link="../callout" title="Card with blue tag" tag= "tag text" tagColor="blue" */>}}
|
||||
{{</* card link="../callout" title="Card with yellow tag" tag= "tag text" tagColor="yellow" */>}}
|
||||
{{</* card link="../callout" title="Card with default tag color" tag="tag text" */>}}
|
||||
{{</* card link="../callout" title="Card with default red tag" tag="tag text" tagType="error" */>}}
|
||||
{{</* card link="../callout" title="Card with blue tag" tag="tag text" tagType="info" */>}}
|
||||
{{</* card link="../callout" title="Card with yellow tag" tag="tag text" tagType="warning" */>}}
|
||||
{{</* /cards */>}}
|
||||
```
|
||||
|
@ -211,6 +211,7 @@
|
||||
"hextra-card-icon",
|
||||
"hextra-card-image",
|
||||
"hextra-card-subtitle",
|
||||
"hextra-card-tag",
|
||||
"hextra-cards",
|
||||
"hextra-code-block",
|
||||
"hextra-code-copy-btn",
|
||||
@ -418,6 +419,7 @@
|
||||
"hx-pt-8",
|
||||
"hx-px-1.5",
|
||||
"hx-px-2",
|
||||
"hx-px-2.5",
|
||||
"hx-px-3",
|
||||
"hx-px-4",
|
||||
"hx-px-6",
|
||||
@ -454,7 +456,6 @@
|
||||
"hx-shrink-0",
|
||||
"hx-sr-only",
|
||||
"hx-sticky",
|
||||
"hx-tag",
|
||||
"hx-text-2xl",
|
||||
"hx-text-4xl",
|
||||
"hx-text-[10px]",
|
||||
|
@ -8,7 +8,7 @@
|
||||
{{- $height := .height -}}
|
||||
{{- $imageStyle := .imageStyle -}}
|
||||
{{- $tag := .tag -}}
|
||||
{{- $tagColor := .tagColor -}}
|
||||
{{- $tagType := .tagType -}}
|
||||
|
||||
{{ $linkClass := "hover:hx-border-gray-300 hx-bg-transparent hx-shadow-sm dark:hx-border-neutral-800 hover:hx-bg-slate-50 hover:hx-shadow-md dark:hover:hx-border-neutral-700 dark:hover:hx-bg-neutral-900" }}
|
||||
{{- with $image -}}
|
||||
@ -54,14 +54,15 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- if $tag }}
|
||||
{{ $defaultClass := "hx-text-gray-600 hx-text-xxs hx-bg-gray-100 hx-border dark:hx-bg-neutral-800 dark:hx-text-neutral-200" }}
|
||||
{{ $yellowClass := "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" }}
|
||||
{{ $blueClass := "hx-border-blue-200 hx-bg-blue-100 hx-text-blue-900 dark:hx-border-blue-200/30 dark:hx-bg-blue-900/30 dark:hx-text-blue-200" }}
|
||||
{{ $redClass := "hx-border-red-200 hx-bg-red-100 hx-text-red-900 dark:hx-border-red-200/30 dark:hx-bg-red-900/30 dark:hx-text-red-200" }}
|
||||
{{ $defaultClass := "hx-text-gray-600 hx-text-xxs hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200" }}
|
||||
{{ $warningClass := "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" }}
|
||||
{{ $infoClass := "hx-border-blue-200 hx-bg-blue-100 hx-text-blue-900 dark:hx-border-blue-200/30 dark:hx-bg-blue-900/30 dark:hx-text-blue-200" }}
|
||||
{{ $errorClass := "hx-border-red-200 hx-bg-red-100 hx-text-red-900 dark:hx-border-red-200/30 dark:hx-bg-red-900/30 dark:hx-text-red-200" }}
|
||||
|
||||
{{ $class := cond (eq $tagColor "yellow") $yellowClass (cond (eq $tagColor "blue") $blueClass (cond (eq $tagColor "red") $redClass $defaultClass)) }}
|
||||
|
||||
<span class="hx-flex hx-tag hx-text-xxs hx-border hx-rounded-full hx-px-2 hx-py-1 {{ $class }}">{{ $tag }}</span>
|
||||
{{- end -}}
|
||||
{{ $tagClass := cond (eq $tagType "info") $infoClass (cond (eq $tagType "warning") $warningClass (cond (eq $tagType "error") $errorClass $defaultClass)) }}
|
||||
<div class="hextra-card-tag">
|
||||
<span class="hx-inline-block hx-rounded-full hx-px-2.5 hx-leading-6 {{ $tagClass }}">{{ $tag }}</span>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</a>
|
||||
{{- /* Strip trailing newline. */ -}}
|
||||
|
@ -8,7 +8,7 @@
|
||||
{{- $height := 0 -}}
|
||||
{{- $imageStyle := .Get "imageStyle" -}}
|
||||
{{- $tag := .Get "tag" -}}
|
||||
{{- $tagColor := .Get "tagColor" -}}
|
||||
{{- $tagType := .Get "tagType" -}}
|
||||
|
||||
{{/* Image processing options */}}
|
||||
{{- $method := .Get "method" | default "Resize" | humanize -}}
|
||||
@ -51,6 +51,6 @@
|
||||
"height" $height
|
||||
"imageStyle" $imageStyle
|
||||
"tag" $tag
|
||||
"tagColor" $tagColor
|
||||
"tagType" $tagType
|
||||
)
|
||||
-}}
|
||||
|
@ -29,7 +29,6 @@ module.exports = {
|
||||
'2xl': '1536px'
|
||||
},
|
||||
fontSize: {
|
||||
xxs: '.65rem',
|
||||
xs: '.75rem',
|
||||
sm: '.875rem',
|
||||
base: '1rem',
|
||||
|
Loading…
x
Reference in New Issue
Block a user