diff --git a/.dumi/theme/builtins/ResourceCards/index.tsx b/.dumi/theme/builtins/ResourceCards/index.tsx index 11c9a0d53f..c025809194 100644 --- a/.dumi/theme/builtins/ResourceCards/index.tsx +++ b/.dumi/theme/builtins/ResourceCards/index.tsx @@ -1,39 +1,27 @@ import React from 'react'; import { ExclamationCircleOutlined } from '@ant-design/icons'; -import { Col, Row, Tooltip } from 'antd'; +import { Col, Row, Tooltip, Card, Typography } from 'antd'; import { createStyles } from 'antd-style'; - import useLocale from '../../../hooks/useLocale'; -const useStyle = createStyles(({ token, css }) => { - const { boxShadowSecondary } = token; +const { Paragraph } = Typography; - return { - card: css` +const useStyle = createStyles(({ token, css }) => ({ + card: css` position: relative; - display: flex; - flex-direction: column; - height: 100%; - color: inherit; - list-style: none; - border: 1px solid ${token.colorSplit}; - border-radius: ${token.borderRadiusXS}px; - cursor: pointer; - transition: box-shadow ${token.motionDurationSlow}; + overflow: hidden; - &:hover { - box-shadow: ${boxShadowSecondary}; - color: inherit; + .ant-card-cover { + overflow: hidden; } - `, - image: css` - width: calc(100% + 2px); - max-width: none; - height: 184px; - margin: -1px -1px 0; - object-fit: cover; - `, - badge: css` + img { + transition: all ${token.motionDurationSlow} ease-out; + } + + &:hover img { + transform: scale(1.3); + `, + badge: css` position: absolute; top: 8px; right: 8px; @@ -42,25 +30,12 @@ const useStyle = createStyles(({ token, css }) => { font-size: ${token.fontSizeSM}px; line-height: 1; background: rgba(0, 0, 0, 0.65); - border-radius: ${token.borderRadiusXS}px; + border-radius: ${token.borderRadiusLG}px; box-shadow: 0 0 2px rgba(255, 255, 255, 0.2); display: inline-flex; column-gap: ${token.paddingXXS}px; `, - title: css` - margin: ${token.margin}px ${token.marginMD}px ${token.marginXS}px; - opacity: 0.85; - font-size: ${token.fontSizeXL}px; - line-height: 28px; - `, - description: css` - margin: 0 ${token.marginMD}px ${token.marginMD}px; - opacity: 0.65; - font-size: ${token.fontSizeXL}px; - line-height: 22px; - `, - }; -}); +})); export type Resource = { title: string; @@ -91,38 +66,33 @@ const ResourceCard: React.FC = ({ resource }) => { const { styles } = useStyle(); const [locale] = useLocale(locales); - const { title: titleStr, description, cover, src, official } = resource; + const { title, description, cover, src, official } = resource; - let coverColor: string | null = null; - let title: string = titleStr; - const titleMatch = titleStr.match(/(.*)(#[\dA-Fa-f]{6})/); - if (titleMatch) { - title = titleMatch[1].trim(); - // eslint-disable-next-line prefer-destructuring - coverColor = titleMatch[2]; - } + const badge = official ? ( +
{locale.official}
+ ) : ( + +
+ + {locale.thirdPart} +
+
+ ); return ( - + - {title} - {official ? ( -
{locale.official}
- ) : ( - -
- - {locale.thirdPart} -
-
- )} -

{title}

-

{description}

+ }> + + {description} + + } + /> + {badge} +
); @@ -133,7 +103,7 @@ export type ResourceCardsProps = { }; const ResourceCards: React.FC = ({ resources }) => ( - + {resources.map((item) => ( ))}