From babaf8d2922dd55b247071333265cd7ed2c53db5 Mon Sep 17 00:00:00 2001 From: Fallen_Breath Date: Wed, 25 Oct 2023 02:19:38 +0800 Subject: [PATCH] add download links to homepage --- website/i18n/zh-Hans/code.json | 134 ++++++++++++++++++ website/src/components/DownloadLinks/index.js | 52 +++++++ .../DownloadLinks/styles.module.css | 27 ++++ website/src/pages/index.js | 2 + website/src/pages/index.module.css | 1 + website/static/img/curseforge.svg | 1 + website/static/img/github.svg | 1 + website/static/img/modrinth.svg | 1 + 8 files changed, 219 insertions(+) create mode 100644 website/src/components/DownloadLinks/index.js create mode 100644 website/src/components/DownloadLinks/styles.module.css create mode 100644 website/static/img/curseforge.svg create mode 100644 website/static/img/github.svg create mode 100644 website/static/img/modrinth.svg diff --git a/website/i18n/zh-Hans/code.json b/website/i18n/zh-Hans/code.json index e9e24119d..040dc7b19 100644 --- a/website/i18n/zh-Hans/code.json +++ b/website/i18n/zh-Hans/code.json @@ -293,5 +293,139 @@ }, "homepage.header.rtd": { "message": "阅读文档" + }, + "homepage.downloads.title": { + "message": "下载模组" + }, + "theme.SearchBar.seeAll": { + "message": "查看全部 {count} 个结果" + }, + "theme.SearchPage.documentsFound.plurals": { + "message": "找到 {count} 份文件", + "description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.SearchPage.existingResultsTitle": { + "message": "「{query}」的搜索结果", + "description": "The search page title for non-empty query" + }, + "theme.SearchPage.emptyResultsTitle": { + "message": "在文档中搜索", + "description": "The search page title for empty query" + }, + "theme.SearchPage.inputPlaceholder": { + "message": "在此输入搜索字词", + "description": "The placeholder for search page input" + }, + "theme.SearchPage.inputLabel": { + "message": "搜索", + "description": "The ARIA label for search page input" + }, + "theme.SearchPage.algoliaLabel": { + "message": "通过 Algolia 搜索", + "description": "The ARIA label for Algolia mention" + }, + "theme.SearchPage.noResultsText": { + "message": "未找到任何结果", + "description": "The paragraph for empty search result" + }, + "theme.SearchPage.fetchingNewResults": { + "message": "正在获取新的搜索结果...", + "description": "The paragraph for fetching new search results" + }, + "theme.SearchBar.label": { + "message": "搜索", + "description": "The ARIA label and placeholder for search button" + }, + "theme.SearchModal.searchBox.resetButtonTitle": { + "message": "清除查询", + "description": "The label and ARIA label for search box reset button" + }, + "theme.SearchModal.searchBox.cancelButtonText": { + "message": "取消", + "description": "The label and ARIA label for search box cancel button" + }, + "theme.SearchModal.startScreen.recentSearchesTitle": { + "message": "最近搜索", + "description": "The title for recent searches" + }, + "theme.SearchModal.startScreen.noRecentSearchesText": { + "message": "没有最近搜索", + "description": "The text when no recent searches" + }, + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": { + "message": "保存这个搜索", + "description": "The label for save recent search button" + }, + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": { + "message": "从历史记录中删除这个搜索", + "description": "The label for remove recent search button" + }, + "theme.SearchModal.startScreen.favoriteSearchesTitle": { + "message": "收藏", + "description": "The title for favorite searches" + }, + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": { + "message": "从收藏列表中删除这个搜索", + "description": "The label for remove favorite search button" + }, + "theme.SearchModal.errorScreen.titleText": { + "message": "无法获取结果", + "description": "The title for error screen of search modal" + }, + "theme.SearchModal.errorScreen.helpText": { + "message": "你可能需要检查网络连接。", + "description": "The help text for error screen of search modal" + }, + "theme.SearchModal.footer.selectText": { + "message": "选中", + "description": "The explanatory text of the action for the enter key" + }, + "theme.SearchModal.footer.selectKeyAriaLabel": { + "message": "Enter 键", + "description": "The ARIA label for the Enter key button that makes the selection" + }, + "theme.SearchModal.footer.navigateText": { + "message": "导航", + "description": "The explanatory text of the action for the Arrow up and Arrow down key" + }, + "theme.SearchModal.footer.navigateUpKeyAriaLabel": { + "message": "向上键", + "description": "The ARIA label for the Arrow up key button that makes the navigation" + }, + "theme.SearchModal.footer.navigateDownKeyAriaLabel": { + "message": "向下键", + "description": "The ARIA label for the Arrow down key button that makes the navigation" + }, + "theme.SearchModal.footer.closeText": { + "message": "关闭", + "description": "The explanatory text of the action for Escape key" + }, + "theme.SearchModal.footer.closeKeyAriaLabel": { + "message": "Esc 键", + "description": "The ARIA label for the Escape key button that close the modal" + }, + "theme.SearchModal.footer.searchByText": { + "message": "搜索提供", + "description": "The text explain that the search is making by Algolia" + }, + "theme.SearchModal.noResultsScreen.noResultsText": { + "message": "没有结果:", + "description": "The text explains that there are no results for the following search" + }, + "theme.SearchModal.noResultsScreen.suggestedQueryText": { + "message": "试试搜索", + "description": "The text for the suggested query when no results are found for the following search" + }, + "theme.SearchModal.noResultsScreen.reportMissingResultsText": { + "message": "认为这个查询应该有结果?", + "description": "The text for the question where the user thinks there are missing results" + }, + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": { + "message": "请告知我们。", + "description": "The text for the link to report missing results" + }, + "theme.SearchModal.placeholder": { + "message": "搜索文档", + "description": "The placeholder of the input of the DocSearch pop-up modal" } } diff --git a/website/src/components/DownloadLinks/index.js b/website/src/components/DownloadLinks/index.js new file mode 100644 index 000000000..06e56cb3f --- /dev/null +++ b/website/src/components/DownloadLinks/index.js @@ -0,0 +1,52 @@ +import React from 'react'; +import styles from './styles.module.css'; +import Translate from '@docusaurus/Translate'; + +const DownloadWebsites = [ + { + name: 'GitHub', + Svg: require('@site/static/img/github.svg').default, + url: "https://github.com/TISUnion/Carpet-TIS-Addition/releases", + color: '#24292F', + }, + { + name: 'CurseForge', + Svg: require('@site/static/img/curseforge.svg').default, + url: "https://legacy.curseforge.com/minecraft/mc-mods/carpet-tis-addition/files", + color: '#F16436', + }, + { + name: 'Modrinth', + Svg: require('@site/static/img/modrinth.svg').default, + url: "https://modrinth.com/mod/carpet-tis-addition/versions", + color: '#00AF5C', + }, +] + +function DownloadLink({name, Svg, url, color}) { + return ( + <> + + +

{name}

+
+ + ); +} + +export default function DownloadLinks() { + return ( + <> +
+

+ + Download Mod + +

+ {DownloadWebsites.map((props, idx) => ( + + ))} +
+ + ); +} \ No newline at end of file diff --git a/website/src/components/DownloadLinks/styles.module.css b/website/src/components/DownloadLinks/styles.module.css new file mode 100644 index 000000000..e4a017598 --- /dev/null +++ b/website/src/components/DownloadLinks/styles.module.css @@ -0,0 +1,27 @@ +.brandsContainer { + padding: 2rem 0; + width: 100%; +} + +.downloadSvg { + width: 40px; + height: 40px; + margin: 10px; +} + +.brandContainer { + display: flex; + border-radius: 10px; + width: 240px; + margin: 10px auto; +} + +.brandContainer:hover { + text-decoration: none; +} + +.brandContainer p { + color: white; + font-size: 1.2rem; + margin: auto 0 auto 1rem; +} diff --git a/website/src/pages/index.js b/website/src/pages/index.js index fa1de63d1..24c120802 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -4,6 +4,7 @@ import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Translate, {translate} from '@docusaurus/Translate'; import Layout from '@theme/Layout'; +import DownloadLinks from '@site/src/components/DownloadLinks'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; import styles from './index.module.css'; @@ -41,6 +42,7 @@ export default function Home() {
+ ); } diff --git a/website/src/pages/index.module.css b/website/src/pages/index.module.css index cf79f0e2a..f8ba6395e 100644 --- a/website/src/pages/index.module.css +++ b/website/src/pages/index.module.css @@ -25,4 +25,5 @@ .downloadsContainer { text-align: center; + text-decoration: none; } diff --git a/website/static/img/curseforge.svg b/website/static/img/curseforge.svg new file mode 100644 index 000000000..165e5e12d --- /dev/null +++ b/website/static/img/curseforge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/website/static/img/github.svg b/website/static/img/github.svg new file mode 100644 index 000000000..9021301dc --- /dev/null +++ b/website/static/img/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/website/static/img/modrinth.svg b/website/static/img/modrinth.svg new file mode 100644 index 000000000..784f398d6 --- /dev/null +++ b/website/static/img/modrinth.svg @@ -0,0 +1 @@ + \ No newline at end of file