mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 14:15:47 +00:00
refactor: make Portfolio widget use new 1-2 column wrapper
(it already supported the logic but didn't use the new wrapper)
This commit is contained in:
1 parent
08190d38dd
commit
8047fac2c1
2 files changed
+49
-71
No files matched your search
@@ -100,7 +100,7 @@
|
||||
{{end}}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $use_cols := in (slice "pages" "featured" "experience" "accomplishments" "contact" "blank" "tag_cloud") $widget }}
|
||||
{{ $use_cols := in (slice "pages" "featured" "experience" "accomplishments" "contact" "blank" "tag_cloud" "portfolio") $widget }}
|
||||
|
||||
{{/* Dedicated child div for bg prevents parallax 100% height issue within new CSS grid page wrapper. */}}
|
||||
<section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
|
||||
|
||||
@@ -6,88 +6,66 @@
|
||||
{{ $items_type := $st.Params.content.page_type | default "project" }}
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
{{/* Standard dual-column layout. */}}
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4 section-heading">
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $st.Title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
|
||||
</div>
|
||||
<div class="col-12 col-lg-8">
|
||||
{{ if $st.Params.content.filter_button }}
|
||||
|
||||
{{ else }}
|
||||
{{/* Single column layout. */}}
|
||||
{{ $filter_default := default (int $st.Params.content.filter_default) 0 }}
|
||||
|
||||
<div class="margin-auto">
|
||||
{{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $default_filter_tag_raw := (index $st.Params.content.filter_button ($filter_default)).tag }}
|
||||
{{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
|
||||
{{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
|
||||
{{ $default_filter_tag = $default_filter_tag_raw }}
|
||||
{{ end }}
|
||||
|
||||
<div class="center-text">
|
||||
{{ with $st.Title }}<h1 class="mt-0">{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
<div>
|
||||
{{ end }}
|
||||
<span class="d-none default-project-filter">{{ $default_filter_tag }}</span>
|
||||
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if $st.Params.content.filter_button }}
|
||||
|
||||
{{ $filter_default := default (int $st.Params.content.filter_default) 0 }}
|
||||
|
||||
{{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $default_filter_tag_raw := (index $st.Params.content.filter_button ($filter_default)).tag }}
|
||||
{{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
|
||||
{{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
|
||||
{{ $default_filter_tag = $default_filter_tag_raw }}
|
||||
{{ end }}
|
||||
|
||||
<span class="d-none default-project-filter">{{ $default_filter_tag }}</span>
|
||||
|
||||
{{/* Only show filter buttons if there are multiple filters. */}}
|
||||
{{ if gt (len $st.Params.content.filter_button) 1 }}
|
||||
<div class="project-toolbar">
|
||||
<div class="project-filters">
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group flex-wrap">
|
||||
{{ range $idx, $item := $st.Params.content.filter_button }}
|
||||
{{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
|
||||
{{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
|
||||
{{ $data_filter = .tag }}
|
||||
{{ end }}
|
||||
<a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a>
|
||||
{{/* Only show filter buttons if there are multiple filters. */}}
|
||||
{{ if gt (len $st.Params.content.filter_button) 1 }}
|
||||
<div class="project-toolbar">
|
||||
<div class="project-filters">
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group flex-wrap">
|
||||
{{ range $idx, $item := $st.Params.content.filter_button }}
|
||||
{{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
|
||||
{{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
|
||||
{{ $data_filter = .tag }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}">
|
||||
{{ range $idx, $item := where site.RegularPages "Type" $items_type }}
|
||||
|
||||
{{ $link := $item.RelPermalink }}
|
||||
{{ $target := "" }}
|
||||
{{ if $item.Params.external_link }}
|
||||
{{ $link = $item.Params.external_link }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $st.Params.design.view 1 }}
|
||||
{{ partial "portfolio_li_list" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 2 }}
|
||||
{{ partial "portfolio_li_compact" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 3 }}
|
||||
{{ partial "portfolio_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ else }}
|
||||
{{ partial "portfolio_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}">
|
||||
{{ range $idx, $item := where site.RegularPages "Type" $items_type }}
|
||||
|
||||
{{ $link := $item.RelPermalink }}
|
||||
{{ $target := "" }}
|
||||
{{ if $item.Params.external_link }}
|
||||
{{ $link = $item.Params.external_link }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $st.Params.design.view 1 }}
|
||||
{{ partial "portfolio_li_list" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 2 }}
|
||||
{{ partial "portfolio_li_compact" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 3 }}
|
||||
{{ partial "portfolio_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ else }}
|
||||
{{ partial "portfolio_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user