forked from drowl87/hextra_mirror
feat: improve Cards link behaviour (#153)
* clickable feature-card when a link is provided * unclickable card when no link is provided --------- Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
parent
b5ab4ecdcb
commit
ae01ac08b6
@ -49,9 +49,8 @@
|
||||
|
||||
<a
|
||||
class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}"
|
||||
href="{{ $href }}"
|
||||
{{- if $external }}
|
||||
target="_blank" rel="noreferrer"
|
||||
{{- if $link -}}
|
||||
href="{{ $href }}" {{ with $external }}target="_blank" rel="noreferrer"{{ end -}}
|
||||
{{- end -}}
|
||||
>
|
||||
{{- with $image -}}
|
||||
|
@ -5,9 +5,13 @@
|
||||
{{- $imageClass := .Get "imageClass" -}}
|
||||
{{- $style := .Get "style" -}}
|
||||
{{- $icon := .Get "icon" -}}
|
||||
{{- $link := .Get "link" -}}
|
||||
|
||||
{{- $external := hasPrefix $link "http" -}}
|
||||
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
||||
|
||||
<div
|
||||
<a
|
||||
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
class="{{ $class }} hextra-feature-card relative overflow-hidden rounded-3xl border border-gray-200 hover:border-gray-300 dark:border-neutral-800 dark:hover:border-neutral-700 before:pointer-events-none before:absolute before:inset-0 before:bg-glass-gradient"
|
||||
>
|
||||
@ -25,4 +29,4 @@
|
||||
{{- with $image -}}
|
||||
<img src="{{ . }}" class="absolute max-w-none {{ $imageClass }}" alt="{{ $title }}" />
|
||||
{{- end -}}
|
||||
</div>
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user