From 675895b7f813c6a55f68917d8f19afca555241ee Mon Sep 17 00:00:00 2001 From: Ryan Tsien Date: Mon, 12 Aug 2024 18:31:59 +0800 Subject: [PATCH] sponsors: refactor the code of sponsors' logo Signed-off-by: Ryan Tsien --- assets/ananke/css/custom.scss | 19 +-- layouts/partials/index-sections/sponsors.html | 114 ++++-------------- 2 files changed, 35 insertions(+), 98 deletions(-) diff --git a/assets/ananke/css/custom.scss b/assets/ananke/css/custom.scss index 340d291..950e2f4 100644 --- a/assets/ananke/css/custom.scss +++ b/assets/ananke/css/custom.scss @@ -495,7 +495,7 @@ section.section-container { div.sponsors-container { display: flex; flex-wrap: wrap; - a { + div.icon { position: relative; display: flex; background-color: #FFFFFF; @@ -503,8 +503,10 @@ section.section-container { padding: 10px 30px; border-radius: 10px; box-shadow: 2px 2px 5px #FFFFFF60; - img { + a { margin: auto; + } + img { object-fit: contain; height: 120px; @media all and (max-width: 800px) { @@ -518,32 +520,35 @@ section.section-container { box-shadow: none; img { height: 140px; + @media all and (max-width: 800px) { + height: 100px; + } } } } &.diamond, &.host { - a { + div.icon { width: calc(50% - 10px); } } &.gold, &.co-hosts, &.organizers, &.co-organizers { - a { + div.icon { width: calc(33% - 10px); } } &.silver, &.bronze, &.community { - a { + div.icon { width: calc(25% - 10px); } } @media all and (max-width: 800px) { &.diamond, &.host { - a { + div.icon { width: calc(100% - 10px); } } &.gold, &.silver, &.bronze, &.community, &.co-hosts, &.organizers, &.co-organizers { - a { + div.icon { width: calc(50% - 10px); } } diff --git a/layouts/partials/index-sections/sponsors.html b/layouts/partials/index-sections/sponsors.html index 4a15697..18c57d5 100644 --- a/layouts/partials/index-sections/sponsors.html +++ b/layouts/partials/index-sections/sponsors.html @@ -3,97 +3,29 @@

{{ .Title | markdownify | emojify }}

- {{ if .Params.diamond }} -

{{ i18n "diamond" }}

-
- {{ range .Params.diamond }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.gold }} -

{{ i18n "gold" }}

-
- {{ range .Params.gold }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.silver }} -

{{ i18n "silver" }}

-
- {{ range .Params.silver }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.bronze }} -

{{ i18n "bronze" }}

-
- {{ range .Params.bronze }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.community }} -

{{ i18n "community" }}

-
- {{ range .Params.community }} - - - - {{ end }} -
- {{ end }} -
- {{ if .Params.host }} -

{{ i18n "host" }}

-
- {{ range .Params.host }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.co_hosts }} -

{{ i18n "co_host" }}

-
- {{ range .Params.co_hosts }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.organizers }} -

{{ i18n "organizer" }}

-
- {{ range .Params.organizers }} - - - - {{ end }} -
- {{ end }} - {{ if .Params.co_organizers }} -

{{ i18n "co_organizer" }}

-
- {{ range .Params.co_organizers }} - - - - {{ end }} -
- {{ end }} + {{- $diamond := dict "id" "diamond" "title" (i18n "diamond") "value" .Params.diamond }} + {{- $gold := dict "id" "gold" "title" (i18n "gold") "value" .Params.gold }} + {{- $silver := dict "id" "silver" "title" (i18n "silver") "value" .Params.silver }} + {{- $bronze := dict "id" "bronze" "title" (i18n "bronze") "value" .Params.bronze }} + {{- $community := dict "id" "community" "title" (i18n "community") "value" .Params.community }} + {{- $host := dict "id" "host" "title" (i18n "host") "value" .Params.host }} + {{- $co_hosts := dict "id" "co-hosts" "title" (i18n "co_host") "value" .Params.co_hosts }} + {{- $organizers := dict "id" "organizers" "title" (i18n "organizer") "value" .Params.organizers }} + {{- $co_organizers := dict "id" "co-organizers" "title" (i18n "co_organizer") "value" .Params.co_organizers }} + {{- $sponsorsData := slice $diamond $gold $silver $bronze $community $host $co_hosts $organizers $co_organizers }} + {{- range $sponsorsData }} + {{- if .value }} +

{{ .title }}

+
+ {{ range .value }} +
+ +
+ {{ end }} +
+ {{- end }} + {{- end }} +

{{ .Content | markdownify | emojify | safeHTML }}

{{ if .Params.link_slug }}