Skip to content

Commit

Permalink
chore: 优化card组件
Browse files Browse the repository at this point in the history
  • Loading branch information
jiazengp committed Feb 23, 2024
1 parent 6284097 commit 4781134
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .vitepress/theme/components/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ const Card: FunctionalComponent<CardProps> = ({
{
href: isLinkExternal(link) ? link : withBase(link),
target: isLinkExternal(link) ? '_blank' : '_self',
isExternalLink: isLinkExternal(link) ? 'true' : 'false',
...props,
},
children,
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
})
app.component('Link', Link)
app.component('Coins', Coins)
app.component('VPCard', Card)
app.component('Card', Card)
app.component('LinkGrid', LinkGrid)
app.component('Badge', VPBadge)
},
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/theme/markdown/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const cardRender = (

const cardData = checkCardProps(config)

if (cardData) return `<VPCard v-bind='${stringifyProp(cardData)}' />`
if (cardData) return `<Card v-bind='${stringifyProp(cardData)}' />`

console.error(
`Invalid card config${relativePath ? ` found in ${relativePath}` : ''}:
Expand Down
10 changes: 10 additions & 0 deletions .vitepress/theme/styles/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@
color: currentColor !important;
}

&[isexternallink='true']::after {
margin-top: -16px !important;
transform: translateX(8px);
}

&[isexternallink='false']::after {
margin-top: -16px !important;
transform: translateX(4px) rotate(45deg);
}

hr {
display: none;
}
Expand Down

0 comments on commit 4781134

Please sign in to comment.