mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-17 06:53:11 +00:00
80 lines
2.6 KiB
HTML
80 lines
2.6 KiB
HTML
<!--
|
|
Copyright © 2022 - 2025 The Hinode Team / Mark Dumay. All rights reserved.
|
|
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
|
|
Visit gethinode.com/license for more details.
|
|
-->
|
|
|
|
{{ $error := false }}
|
|
|
|
<!-- Validate arguments -->
|
|
{{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "release" "args" .Params) }}
|
|
{{ errorf "Invalid arguments: %s" .Position -}}
|
|
{{ $error = true }}
|
|
{{ end }}
|
|
|
|
<!-- Initialize arguments -->
|
|
{{- $version := .Get "version" | default "" -}}
|
|
{{- $state := .Get "state" | default "new" -}}
|
|
{{- $short := false -}}
|
|
{{ if isset .Params "short" }}{{ $short = partial "utilities/CastBool.html" (.Get "short") }}{{ end -}}
|
|
{{- $inline := false -}}
|
|
{{ if isset .Params "inline" }}{{ $inline = partial "utilities/CastBool.html" (.Get "inline") }}{{ end -}}
|
|
{{- $title := $version -}}
|
|
{{- $color := "primary" -}}
|
|
{{- if eq $state "deprecated" -}}
|
|
{{- $color = "secondary" -}}
|
|
{{- end -}}
|
|
{{- $size := .Get "size" | default "md" -}}
|
|
{{- $class := .Get "class" | default "" -}}
|
|
{{- $type := .Get "type" | default "button" -}}
|
|
|
|
{{- $icon := "" -}}
|
|
{{- $tooltip := "" -}}
|
|
{{- if eq $state "deprecated" -}}
|
|
{{- if $short -}}
|
|
{{- $icon = "fas trash-can" -}}
|
|
{{- $tooltip = T "deprecatedFeature" $version -}}
|
|
{{ else }}
|
|
{{- $title = T "deprecatedFeature" $version -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- if $short -}}
|
|
{{- $icon = "fas rocket" -}}
|
|
{{- $tooltip = T "addedFeature" $version -}}
|
|
{{ else }}
|
|
{{- $title = T "addedFeature" $version -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if not $short -}}
|
|
{{- if eq $state "deprecated" -}}
|
|
{{- $title = T "deprecatedFeature" $version -}}
|
|
{{- else -}}
|
|
{{- $title = T "addedFeature" $version -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
<!-- Main code -->
|
|
{{- if not $error -}}
|
|
{{ $href := partial "partials/utilities/URLJoin.html" (dict "base" site.Params.docs.release "path" $version) }}
|
|
{{ if eq $type "link" }}
|
|
{{ partial "assets/link.html" (dict "destination" $href "text" $title "page" .Page) }}
|
|
{{ else }}
|
|
{{- if not $inline }}<div class="pb-3">{{ end -}}
|
|
{{- partial "assets/button.html" (dict
|
|
"title" $title
|
|
"href" $href
|
|
"size" "sm"
|
|
"color" $color
|
|
"outline" "true"
|
|
"size" $size
|
|
"icon" $icon
|
|
"tooltip" $tooltip
|
|
"order" "first"
|
|
"class" (trim (printf "rounded-2 fw-semibold %s" $class) " ")
|
|
"spacing" $inline)
|
|
-}}
|
|
{{- if not $inline }}</div>{{ end -}}
|
|
{{ end }}
|
|
{{- end -}}
|