-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from ocftw/feature/add-footer-in-cms
Feature/add footer collection in cms
- Loading branch information
Showing
9 changed files
with
164 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"footer": { | ||
"links": [ | ||
{ | ||
"display_text": "Rulebook", | ||
"url": "/s/manual" | ||
}, | ||
{ | ||
"display_text": "Admin", | ||
"url": "/admin" | ||
}, | ||
{ | ||
"display_text": "OCF.TW", | ||
"url": "https://ocf.tw/" | ||
}, | ||
{ | ||
"display_text": "Borrow Board Game", | ||
"url": "mailto:[email protected]" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"footer": { | ||
"links": [ | ||
{ | ||
"display_text": "遊戲規則書", | ||
"url": "/s/manual" | ||
}, | ||
{ | ||
"display_text": "後台管理", | ||
"url": "/admin" | ||
}, | ||
{ | ||
"display_text": "OCF.TW", | ||
"url": "https://ocf.tw/" | ||
}, | ||
{ | ||
"display_text": "借桌遊", | ||
"url": "mailto:[email protected]" | ||
} | ||
] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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, | ||
})); | ||
return ( | ||
<div className="site-footer" id="footer"> | ||
<div className="container footer-main"> | ||
<FooterLinks links={links} /> | ||
<span>{siteData.title}</span> | ||
<SocialMedia /> | ||
<div className="flex flex-row flex-justify-center logos margin-2-percent"> | ||
<Logo | ||
text="Initiator" | ||
src="/images/campaignpage/logo__OCF.png" | ||
dimension={{ width: 170, height: 34 }} | ||
/> | ||
<Logo | ||
text="Sponsor" | ||
src="/images/campaignpage/logo__FNF.png" | ||
dimension={{ width: 163, height: 45 }} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Footer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Link from 'next/link'; | ||
|
||
const FooterLinks = ({ links }) => ( | ||
<div className="flex flex-row gap"> | ||
{links.map((link) => ( | ||
<Link | ||
href={link.url} | ||
key={link.displayText} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
locale={false} | ||
> | ||
{link.displayText} | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
|
||
export default FooterLinks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"cms_manual_init": true, | ||
"local_backend": true, | ||
"backend": { | ||
"name": "git-gateway", | ||
"branch": "main" | ||
|
@@ -404,6 +405,47 @@ | |
} | ||
] | ||
}, | ||
{ | ||
"name": "footer", | ||
"label": "Footer", | ||
"label_singular": "Footer", | ||
"folder": "homepage/_footer", | ||
"i18n": true, | ||
"create": true, | ||
"delete": false, | ||
"slug": "footer", | ||
"extension": "json", | ||
"fields": [ | ||
{ | ||
"label": "Footer", | ||
"name": "footer", | ||
"widget": "object", | ||
"i18n": true, | ||
"fields": [ | ||
{ | ||
"label": "Links", | ||
"name": "links", | ||
"label_singular": "Link", | ||
"widget": "list", | ||
"i18n": true, | ||
"fields": [ | ||
{ | ||
"label": "Display Text", | ||
"name": "display_text", | ||
"widget": "string" | ||
}, | ||
{ | ||
"label": "Url", | ||
"name": "url", | ||
"widget": "string", | ||
"hint": "External link: `https://example.com/path/to/link`, Internal link: `/resouce`, Email: `mailto:[email protected]`" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "kitchenSink", | ||
"label": "Kitchen Sink", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters