diff --git a/src/components/EventLanding.js b/src/components/EventLanding.js index 1af83912..82babdc5 100644 --- a/src/components/EventLanding.js +++ b/src/components/EventLanding.js @@ -1,5 +1,6 @@ import Layout from "@theme/Layout"; import Head from "@docusaurus/Head"; +import Link from "@docusaurus/Link"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faDiscord, faGithub } from "@fortawesome/free-brands-svg-icons"; @@ -14,16 +15,9 @@ import { import useBaseUrl from "@docusaurus/useBaseUrl"; import events from "@site/src/data/events"; import { formatDate, formatDateRange } from "@site/src/utils/date"; +import { isChinese, pick } from "@site/src/utils/i18n"; import styles from "./EventLanding.module.css"; -function isChinese(locale) { - return locale.startsWith("zh"); -} - -function pick(locale, obj) { - return isChinese(locale) && obj.zh ? obj.zh : obj.en; -} - function utm(url, slug) { let u; try { @@ -94,6 +88,9 @@ export default function EventLanding({ slug }) {
+ + ← {isZh ? "落地页" : "Landing Pages"} + {event.banner && ( {pick(locale, )} @@ -245,6 +242,13 @@ export default function EventLanding({ slug }) {
+
+
+ + ← {isZh ? "活动日历" : "Events Calendar"} + +
+
); diff --git a/src/components/EventLanding.module.css b/src/components/EventLanding.module.css index 44b193c0..06a29b68 100644 --- a/src/components/EventLanding.module.css +++ b/src/components/EventLanding.module.css @@ -70,6 +70,59 @@ text-decoration: none; } +/* Backlink */ +.backLink { + display: inline-block; + margin-bottom: var(--hami-space-16); + color: var(--hami-color-muted); + font-size: 0.95rem; + text-decoration: none; +} + +.backLink:hover { + color: var(--hami-color-primary); + text-decoration: none; +} + +.moreEvents { + padding: var(--hami-space-16) 0 var(--hami-space-48); + text-align: center; +} + +/* Event list (landing index) */ +.eventList { + display: flex; + flex-direction: column; + gap: var(--hami-space-16); + margin-top: var(--hami-space-32); +} + +.eventCard { + display: block; + padding: var(--hami-space-24) var(--hami-space-32); + text-decoration: none; + transition: border-color var(--hami-motion-fast); +} + +.eventCard:hover { + border-color: var(--hami-color-primary); + text-decoration: none; +} + +.eventTitle { + font-family: var(--hami-font-display); + font-size: 1.25rem; + font-weight: 700; + color: var(--hami-color-text); + margin-bottom: var(--hami-space-8); +} + +.eventMeta { + color: var(--hami-color-muted); + font-size: 0.95rem; + margin: 0; +} + /* Case study */ .caseStudySection { padding: var(--hami-space-32) 0; diff --git a/src/pages/landing/index.js b/src/pages/landing/index.js new file mode 100644 index 00000000..4004b304 --- /dev/null +++ b/src/pages/landing/index.js @@ -0,0 +1,54 @@ +import Layout from "@theme/Layout"; +import Link from "@docusaurus/Link"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +import events from "@site/src/data/events"; +import { formatDate, formatDateRange } from "@site/src/utils/date"; +import { isChinese, pick } from "@site/src/utils/i18n"; +import styles from "@site/src/components/EventLanding.module.css"; + +export default function EventLandingList() { + const { i18n } = useDocusaurusContext(); + const isZh = isChinese(i18n.currentLocale); + const locale = i18n.currentLocale; + + return ( + +
+
+
+

{isZh ? "落地页" : "Landing Pages"}

+

+ {isZh + ? "查看 HAMi 团队的活动落地页,获取演讲详情与社区资料。" + : "See the events and talks the HAMi team is part of, with slides and community resources."} +

+
+ {events.map((e) => ( + +

{pick(locale, e.title)}

+

+ {e.endDate + ? formatDateRange(e.date, e.endDate, locale) + : formatDate(e.date, locale)} + {e.location ? ` - ${pick(locale, e.location)}` : ""} +

+ + ))} +
+
+
+
+
+ ); +} diff --git a/src/utils/i18n.js b/src/utils/i18n.js new file mode 100644 index 00000000..31ff91a7 --- /dev/null +++ b/src/utils/i18n.js @@ -0,0 +1,7 @@ +export function isChinese(locale) { + return locale.startsWith("zh"); +} + +export function pick(locale, obj) { + return isChinese(locale) && obj.zh ? obj.zh : obj.en; +}