diff --git "a/blog/lifestyle/\345\205\263\344\272\216 restful api \350\267\257\345\276\204\345\256\232\344\271\211\347\232\204\346\200\235\350\200\203.md" "b/blog/lifestyle/\345\205\263\344\272\216 restful api \350\267\257\345\276\204\345\256\232\344\271\211\347\232\204\346\200\235\350\200\203.md" index 1c56a0424..7f0fe4f13 100644 --- "a/blog/lifestyle/\345\205\263\344\272\216 restful api \350\267\257\345\276\204\345\256\232\344\271\211\347\232\204\346\200\235\350\200\203.md" +++ "b/blog/lifestyle/\345\205\263\344\272\216 restful api \350\267\257\345\276\204\345\256\232\344\271\211\347\232\204\346\200\235\350\200\203.md" @@ -82,7 +82,7 @@ export class UserController { 换做是我,肯定不会希望将用户的代码与文章的代码混杂在一起。解决办法也是有的,可以额外创建一个新的 UserController 文件,专门用于获取用户下的资源(这里指 article),这样可以 即与原有针对 user 资源进行解耦,有可以有比较清晰接口分类。 -:::waring +:::warning 不过针对这种情况我可能的解决办法是下会额外 **起一个别名**,例如 author,将 `/users/:id/articles`转为 `/authors/:id/articles`,不过在这里指向的是用户 id,而不是新建一个 author 实体(资源)。 diff --git a/src/pages/project/_components/ShowcaseCard/index.tsx b/src/pages/project/_components/ShowcaseCard/index.tsx index 9c721cdd6..b1519c899 100644 --- a/src/pages/project/_components/ShowcaseCard/index.tsx +++ b/src/pages/project/_components/ShowcaseCard/index.tsx @@ -1,9 +1,8 @@ -import React, { memo, useEffect, useRef } from 'react' +import React, { memo } from 'react' import clsx from 'clsx' import Image from '@theme/IdealImage' import Link from '@docusaurus/Link' import Translate from '@docusaurus/Translate' -import { motion } from 'framer-motion' import styles from './styles.module.css' import FavoriteIcon from '@site/src/components/svgIcons/FavoriteIcon' import Tooltip from '../ShowcaseTooltip' @@ -55,12 +54,9 @@ function ShowcaseCardTag({ tags }: { tags: TagType[] }) { const ShowcaseCard = memo(({ project }: { project: Project }) => { return ( - {project.preview && (
@@ -98,7 +94,7 @@ const ShowcaseCard = memo(({ project }: { project: Project }) => { - +
) }) diff --git a/src/pages/project/_components/ShowcaseCard/styles.module.css b/src/pages/project/_components/ShowcaseCard/styles.module.css index d0508e3c9..247570f33 100644 --- a/src/pages/project/_components/ShowcaseCard/styles.module.css +++ b/src/pages/project/_components/ShowcaseCard/styles.module.css @@ -1,7 +1,7 @@ .showcaseCard { position: relative; - box-shadow: 0 10px 30px -5px rgb(0 0 0 / 30%); - transition: box-shadow 0.5s, opacity 0.5s; + box-shadow: var(--blog-item-shadow); + transition: opacity 0.5s; will-change: transform; overflow: hidden; touch-action: none; diff --git a/src/pages/project/index.tsx b/src/pages/project/index.tsx index 7c6bdc5d8..edbc37ca5 100644 --- a/src/pages/project/index.tsx +++ b/src/pages/project/index.tsx @@ -1,15 +1,15 @@ import React from 'react' import _ from 'loadsh' -import Layout from '@theme/Layout' import clsx from 'clsx' -import Translate, { translate } from '@docusaurus/Translate' - +import { translate } from '@docusaurus/Translate' +import useDocusaurusContext from '@docusaurus/useDocusaurusContext' import ShowcaseCard from './_components/ShowcaseCard' -import { projects, groupByProjects } from '@site/data/project' +import { projects, groupByProjects, projectTypeMap } from '@site/data/project' import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment' import styles from './styles.module.css' +import MyLayout from '@site/src/theme/MyLayout' const TITLE = translate({ id: 'theme.project.title', @@ -17,11 +17,10 @@ const TITLE = translate({ }) const DESCRIPTION = translate({ id: 'theme.project.description', - message: - '学而无用,不如学而用之。这里是我在技术领域中努力实践和应用的最佳证明。', + message: '学而无用,不如学而用之。这里是我在技术领域中努力实践和应用的最佳证明。', }) -const GITHUB_URL = 'https://github.com/kuizuo' +// const GITHUB_URL = 'https://github.com/kuizuo' type ProjectState = { scrollTopPosition: number @@ -39,30 +38,27 @@ export function prepareUserState(): ProjectState | undefined { return undefined } -const SearchNameQueryKey = 'name' - -function readSearchName(search: string) { - return new URLSearchParams(search).get(SearchNameQueryKey) -} - function ShowcaseHeader() { return ( -
-

{TITLE}

+
+

{TITLE}

{DESCRIPTION}

- 前往 Github 克隆项目 - + */}
) } function ShowcaseCards() { + const { i18n } = useDocusaurusContext() + const lang = i18n.currentLocale + if (projects.length === 0) { return (
@@ -77,20 +73,13 @@ function ShowcaseCards() {
<>
-
+
{Object.entries(groupByProjects).map(([key, value]) => { return (
-
-

{_.upperFirst(key)}

+
+

{_.upperFirst(lang === 'en' ? key: projectTypeMap[key])}

    {value.map(project => ( @@ -108,12 +97,12 @@ function ShowcaseCards() { function Showcase(): JSX.Element { return ( - -
    + +
    - +
    ) } diff --git a/src/pages/project/styles.module.css b/src/pages/project/styles.module.css index d6ecb606d..19b7cdd0e 100644 --- a/src/pages/project/styles.module.css +++ b/src/pages/project/styles.module.css @@ -67,6 +67,7 @@ .showcaseFavoriteHeader { display: flex; + justify-content: center; align-items: center; } diff --git a/src/theme/MyLayout/index.tsx b/src/theme/MyLayout/index.tsx index 4aab942dd..383b5952b 100644 --- a/src/theme/MyLayout/index.tsx +++ b/src/theme/MyLayout/index.tsx @@ -7,12 +7,13 @@ import styles from './styles.module.scss' export default function MyLayout({ children, + maxWidth, ...layoutProps -}: Props): JSX.Element { +}: Props & { maxWidth: number }): JSX.Element { return ( -
    -
    +
    +
    {children}
    diff --git a/src/theme/MyLayout/styles.module.scss b/src/theme/MyLayout/styles.module.scss index bbbf3ef55..dd723ec3a 100644 --- a/src/theme/MyLayout/styles.module.scss +++ b/src/theme/MyLayout/styles.module.scss @@ -5,5 +5,4 @@ .myContainer { max-width: 800px; margin: 0 auto; - padding: 0.5rem 1rem; }