From 85833b362b177a37598a6331377df34d4eb4512b Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Fri, 3 Nov 2023 17:25:03 +0700 Subject: [PATCH 01/12] feat: add footer logo in cms config.json --- homepage/src/CMS/decap-cms.config.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/homepage/src/CMS/decap-cms.config.js b/homepage/src/CMS/decap-cms.config.js index cb469ce0..9a1b2f5c 100644 --- a/homepage/src/CMS/decap-cms.config.js +++ b/homepage/src/CMS/decap-cms.config.js @@ -429,6 +429,26 @@ module.exports = { }, ], }, + { + label: 'Logos', + name: 'logos', + label_singular: 'Logo', + widget: 'list', + i18n: true, + summary: '{{fields.logo_text}}', + fields: [ + { + label: 'Logo Text', + name: 'logo_text', + widget: 'string', + }, + { + label: 'Logo Image', + name: 'logo_image', + widget: 'image', + }, + ], + }, ], }, ], From 2b6175eb2fddfe49db12f409a00c9c148c20fe2b Mon Sep 17 00:00:00 2001 From: ljc1991 Date: Mon, 30 Oct 2023 17:01:11 +0800 Subject: [PATCH 02/12] feat: add footer logos by cms --- homepage/_footer/en/footer.json | 10 ++ homepage/_footer/zh-tw/footer.json | 10 ++ homepage/public/images/uploads/logo__fnf.png | Bin 0 -> 5457 bytes homepage/public/images/uploads/logo__ocf.svg | 165 +++++++++++++++++++ 4 files changed, 185 insertions(+) create mode 100644 homepage/public/images/uploads/logo__fnf.png create mode 100644 homepage/public/images/uploads/logo__ocf.svg diff --git a/homepage/_footer/en/footer.json b/homepage/_footer/en/footer.json index e872d530..8d5818ac 100644 --- a/homepage/_footer/en/footer.json +++ b/homepage/_footer/en/footer.json @@ -13,6 +13,16 @@ "display_text": "Play Online!", "url": "/resource/#play-online" } + ], + "logos": [ + { + "logo_text": "Initiator", + "logo_image": "/images/uploads/logo__ocf.svg" + }, + { + "logo_text": "Sponsor", + "logo_image": "/images/uploads/logo__fnf.png" + } ] } } \ No newline at end of file diff --git a/homepage/_footer/zh-tw/footer.json b/homepage/_footer/zh-tw/footer.json index a40390ac..ee106a02 100644 --- a/homepage/_footer/zh-tw/footer.json +++ b/homepage/_footer/zh-tw/footer.json @@ -13,6 +13,16 @@ "display_text": "來玩線上桌遊!", "url": "/resource/#線上桌遊一起玩" } + ], + "logos": [ + { + "logo_text": "Initiator", + "logo_image": "/images/uploads/logo__ocf.svg" + }, + { + "logo_text": "Sponsor", + "logo_image": "/images/uploads/logo__fnf.png" + } ] } } \ No newline at end of file diff --git a/homepage/public/images/uploads/logo__fnf.png b/homepage/public/images/uploads/logo__fnf.png new file mode 100644 index 0000000000000000000000000000000000000000..0cd184dd0b483915ee9f6047e28d20c38bd2ca79 GIT binary patch literal 5457 zcmaJ_c|25o`=*8l5wb@_S+dNSF~eB1uY)X+CC1D!BV%Tanvp>!*`t)Q6+^Z{WNDFQ z5D~IO_NB#=z0F=fJNCX)j|;48qF5)xfG~Fc>1EiBMCAYiMX`smMUU5HJX=2~r2ELLk~;xHb$b z^Uo!_=Pd~1tL@MedIU6D$QCgeL{#iGeb|Euwsg7lQR<_mut}0)d1?{%bgp@=v1nQU;=-NFa4J zFo;0-9oJuIO0Wa=|7HAFG{q@|gatWZDZ~pw=)LpsmHR{9%iaHW^c%RRM%yk3zjr98 z023nm0s$KsY-yq=yZ1&7gU4w5!XZ9B5OtU;7zWl<#b{{wsvZrAP^=9Q$tgAO(+y$W~!z6hie%~2}T8?v44Ey_k91u zh5k>jws8;^6-*3rA`%1sRDnH?7)+$#h$I;ZL=7yX=zFetY0b|ivbr@C_v?metyKerY zj{a=z73c5izg@An__wdHfqTsqwAVFrzH{SjYy!TPCWcP5k;S`QH0J?Vnc{E5{0>x%2#46%2O96@lljN?xl4Q{t?C{e`f2XEAr4R<3R#$v%q}59JNb zjUKOk*|`E{-w%KUb|efcD)41fZY)TIIQ@aO*fvj~u;k>cm2D?`nIXWLuj^+cl<3?F ziFF)@fJwNhpHH}JF2fj40M?sN`ji+k9ECjRzT81i7F?cver>9Z6Zl?~A(fTuJarp* zPIL#gDG8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G1vUQ#BjeRl$l}i5JA;uGCj8NmR|5| zg7Txs$fD~Ac6Oz<)RWX1(O{2nbc+-9>x$&o@JrTfkd2JpweIe*GB=r50 zN5kui6KTX1_uFdHFLdMlC2xeEpLKP*sB`#1YrE-yFYG-acs9##XOi%({q3$YhCrSH zZAMS*LJG%Be?m5#vcV%V^Ek=AbJxCgFGU^oojSPv(b1_1hX;p`_izHS>NFif!m&#O2as8P}pDzL~6RACPO%=qxl7Fte6eTwDQS&MVj!m~R;w z0VHZ@(xr1Z?IvTv;gk3X$4ucO6P;1;6?ZFa!_#U#BkAX?_}tLDry+8Lxyr2RU6%OB^TJB|mg)@Mu-}K;uc>XY$`Z zIDCG*XcUSi8}MkFjUPddB4Ny6Z@;Q>`H}nNU8N7!J_mmka;~Gl!Zev0{&4hX7M;iD z!|qcCC{f*E@4Lh9&O~ZlgxKXRppvf-Yg7jeNH~VWzVBL!yl{MH-zu#IWuHvM1_!EbLb=*ZFx^tp)wK*56yH6*0Jb@&g##PMn+wV#=3d$bb z#LWO?g-+&BkCkgDw>_%~KhK65K+L%uEXcIKhUHuOk=8>kFHG-AuGz|1)5#e{F0Hg2 zM3c`otJF6$e)1jbVe~@z`-G$JshtAr%N@t^9OOpM{W2|Sx<%ArW~bInK7Q-)=xdK# z|D2y#py7#d93}VQC)`}WShD|&b#G2a;Yz!XGXKoUvV^X85x$pT0twdTY;N8UUrPH` kBC6c*uMeT7e}Wp>_PrSFUKXY3{r<^mX=-ayX5`KIKQ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ebfe27ed9620792302ae1325b494df087870634c Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Fri, 3 Nov 2023 17:26:40 +0700 Subject: [PATCH 03/12] feat: replace footer logos from cms file --- homepage/src/layouts/footer/footer.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/homepage/src/layouts/footer/footer.jsx b/homepage/src/layouts/footer/footer.jsx index 30a24db4..b3ca7dc3 100644 --- a/homepage/src/layouts/footer/footer.jsx +++ b/homepage/src/layouts/footer/footer.jsx @@ -14,6 +14,13 @@ const Footer = ({ siteData, footer }) => { displayText: link.display_text, url: link.url, })); + + const footerLogos = footerData?.footer?.logos ?? []; + const logos = footerLogos.map((logo) => ({ + text: logo.logo_text, + image: logo.logo_image, + })); + return ( From b0ef0dacd455a7e361aa5615a656276df1672b09 Mon Sep 17 00:00:00 2001 From: ljc1991 Date: Wed, 1 Nov 2023 02:10:37 +0800 Subject: [PATCH 05/12] fix: fix css in footer --- homepage/public/css/style.css | 8 ++++---- homepage/src/components/logo.jsx | 2 +- homepage/src/layouts/footer/footer.jsx | 2 +- homepage/src/layouts/footer/footerLinks.jsx | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homepage/public/css/style.css b/homepage/public/css/style.css index fd61cadf..91cc2dc5 100644 --- a/homepage/public/css/style.css +++ b/homepage/public/css/style.css @@ -916,7 +916,7 @@ code { margin-left: 1rem; } .logo-margin { - margin: 0 15px; + margin: 0 1rem; } .avatar { margin: 0.5rem auto; @@ -985,9 +985,6 @@ code { .logos { flex-wrap: wrap; } - .logo-margin { - margin: 10px auto; - } } @media only screen and (max-width: 568px) { .photos-page-list .item { @@ -1021,6 +1018,9 @@ code { .blogs-list .item .inner .details .title { font-size: 20px; } + .logo-margin { + margin: 0.25rem auto; + } } @media only screen and (max-width: 480px) { /* .image-and-text-main .left img{height:400px} */ diff --git a/homepage/src/components/logo.jsx b/homepage/src/components/logo.jsx index 32afbebd..6ebcf649 100644 --- a/homepage/src/components/logo.jsx +++ b/homepage/src/components/logo.jsx @@ -1,7 +1,7 @@ import Image from 'next/image'; const Logo = ({ text, src, dimension }) => ( -
+
{text} { {siteData.title} -
+
{logos.map((logo) => ( ( -
+
{links.map((link) => ( Date: Sat, 4 Nov 2023 15:48:21 +0700 Subject: [PATCH 06/12] feat(homepage): add footer logo link --- homepage/_footer/en/footer.json | 12 ++++++++---- homepage/_footer/zh-tw/footer.json | 12 ++++++++---- homepage/src/CMS/decap-cms.config.js | 14 +++++++++++-- homepage/src/components/logo.jsx | 27 ++++++++++++++------------ homepage/src/layouts/footer/footer.jsx | 4 ++++ 5 files changed, 47 insertions(+), 22 deletions(-) diff --git a/homepage/_footer/en/footer.json b/homepage/_footer/en/footer.json index 8d5818ac..39792b13 100644 --- a/homepage/_footer/en/footer.json +++ b/homepage/_footer/en/footer.json @@ -16,12 +16,16 @@ ], "logos": [ { - "logo_text": "Initiator", - "logo_image": "/images/uploads/logo__ocf.svg" + "logo_text": "open culture foundation", + "logo_image": "/images/uploads/logo__ocf.svg", + "logo_title": "Initiator", + "logo_link": "https://ocf.tw/" }, { - "logo_text": "Sponsor", - "logo_image": "/images/uploads/logo__fnf.png" + "logo_text": "Friedrich Naumann Foundation for Freedom", + "logo_image": "/images/uploads/logo__fnf.png", + "logo_title": "Sponsor", + "logo_link": "https://www.freiheit.org/" } ] } diff --git a/homepage/_footer/zh-tw/footer.json b/homepage/_footer/zh-tw/footer.json index ee106a02..736a0b4e 100644 --- a/homepage/_footer/zh-tw/footer.json +++ b/homepage/_footer/zh-tw/footer.json @@ -16,12 +16,16 @@ ], "logos": [ { - "logo_text": "Initiator", - "logo_image": "/images/uploads/logo__ocf.svg" + "logo_text": "open culture foundation", + "logo_image": "/images/uploads/logo__ocf.svg", + "logo_title": "Initiator", + "logo_link": "https://ocf.tw/" }, { - "logo_text": "Sponsor", - "logo_image": "/images/uploads/logo__fnf.png" + "logo_text": "Friedrich Naumann Foundation for Freedom", + "logo_image": "/images/uploads/logo__fnf.png", + "logo_title": "Sponsor", + "logo_link": "https://www.freiheit.org/" } ] } diff --git a/homepage/src/CMS/decap-cms.config.js b/homepage/src/CMS/decap-cms.config.js index 9a1b2f5c..df70d093 100644 --- a/homepage/src/CMS/decap-cms.config.js +++ b/homepage/src/CMS/decap-cms.config.js @@ -364,7 +364,7 @@ module.exports = { label: 'Links', label_singular: 'Link', widget: 'list', - summary: '{{fields.type} - {{fields.url}}', + summary: '{{fields.type}} - {{fields.url}}', fields: [ { label: 'Type', @@ -435,8 +435,13 @@ module.exports = { label_singular: 'Logo', widget: 'list', i18n: true, - summary: '{{fields.logo_text}}', + summary: '{{fields.logo_title}} | {{fields.logo_text}}', fields: [ + { + label: 'Logo Title', + name: 'logo_title', + widget: 'string', + }, { label: 'Logo Text', name: 'logo_text', @@ -447,6 +452,11 @@ module.exports = { name: 'logo_image', widget: 'image', }, + { + label: 'Logo Link', + name: 'logo_link', + widget: 'string', + }, ], }, ], diff --git a/homepage/src/components/logo.jsx b/homepage/src/components/logo.jsx index 6ebcf649..3e1a058f 100644 --- a/homepage/src/components/logo.jsx +++ b/homepage/src/components/logo.jsx @@ -1,18 +1,21 @@ import Image from 'next/image'; +import Link from 'next/link'; -const Logo = ({ text, src, dimension }) => ( +const Logo = ({ title, text, src, dimension, link }) => (
- {text} - {`${text}-logo`} + {title} + + {`${text}`} +
); diff --git a/homepage/src/layouts/footer/footer.jsx b/homepage/src/layouts/footer/footer.jsx index 0a013d72..f647aaf1 100644 --- a/homepage/src/layouts/footer/footer.jsx +++ b/homepage/src/layouts/footer/footer.jsx @@ -17,8 +17,10 @@ const Footer = ({ siteData, footer }) => { const footerLogos = footerData?.footer?.logos ?? []; const logos = footerLogos.map((logo) => ({ + title: logo.logo_title, text: logo.logo_text, image: logo.logo_image, + link: logo.logo_link, })); return ( @@ -31,9 +33,11 @@ const Footer = ({ siteData, footer }) => { {logos.map((logo) => ( ))}
From 40d73d972d1bdee549c51e841e9e5c263d04a8e6 Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Sat, 4 Nov 2023 18:00:55 +0700 Subject: [PATCH 07/12] refactor(homepage): get footer data dynamically from get static props --- homepage/src/layouts/footer/footer.jsx | 22 +--------------- homepage/src/layouts/header/header.jsx | 4 +-- .../src/layouts/siteLayout/siteLayout.jsx | 6 ++--- homepage/src/lib/fetchFooter.js | 25 +++++++++++++++++++ homepage/src/pages/404.jsx | 22 ++++++++++------ homepage/src/pages/_app.jsx | 7 +++++- homepage/src/pages/cards.jsx | 16 +++++++++--- homepage/src/pages/index.jsx | 16 +++++++++--- homepage/src/pages/resource.jsx | 15 +++++++++-- 9 files changed, 90 insertions(+), 43 deletions(-) create mode 100644 homepage/src/lib/fetchFooter.js diff --git a/homepage/src/layouts/footer/footer.jsx b/homepage/src/layouts/footer/footer.jsx index f647aaf1..ff39ac84 100644 --- a/homepage/src/layouts/footer/footer.jsx +++ b/homepage/src/layouts/footer/footer.jsx @@ -1,28 +1,8 @@ -import { useRouter } from 'next/router'; import SocialMedia from '../../components/socialMedia'; import Logo from '../../components/logo'; -import footerZh from '../../../_footer/zh-tw/footer.json'; -import footerEn from '../../../_footer/en/footer.json'; import FooterLinks from './footerLinks'; -const Footer = ({ siteData, footer }) => { - const router = useRouter(); - const locale = router.locale; - const footerData = locale === 'en' ? footerEn : footerZh; - const footerLinks = footer?.links ?? footerData?.footer?.links ?? []; - const links = footerLinks.map((link) => ({ - displayText: link.display_text, - url: link.url, - })); - - const footerLogos = footerData?.footer?.logos ?? []; - const logos = footerLogos.map((logo) => ({ - title: logo.logo_title, - text: logo.logo_text, - image: logo.logo_image, - link: logo.logo_link, - })); - +const Footer = ({ siteData, footer, links = [], logos = [] }) => { return (