diff --git a/.vitepress/theme/components/Card.ts b/.vitepress/theme/components/Card.ts index 4ec94b8cd..87b09b2fd 100644 --- a/.vitepress/theme/components/Card.ts +++ b/.vitepress/theme/components/Card.ts @@ -191,6 +191,7 @@ const Card: FunctionalComponent = ({ { href: isLinkExternal(link) ? link : withBase(link), target: isLinkExternal(link) ? '_blank' : '_self', + isExternalLink: isLinkExternal(link) ? 'true' : 'false', ...props, }, children, diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 370057fe6..8e45ac58a 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -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) }, diff --git a/.vitepress/theme/markdown/card.ts b/.vitepress/theme/markdown/card.ts index f57062b57..253c00e35 100644 --- a/.vitepress/theme/markdown/card.ts +++ b/.vitepress/theme/markdown/card.ts @@ -82,7 +82,7 @@ const cardRender = ( const cardData = checkCardProps(config) - if (cardData) return `` + if (cardData) return `` console.error( `Invalid card config${relativePath ? ` found in ${relativePath}` : ''}: diff --git a/.vitepress/theme/styles/card.scss b/.vitepress/theme/styles/card.scss index d4316ec2f..65e82e04f 100644 --- a/.vitepress/theme/styles/card.scss +++ b/.vitepress/theme/styles/card.scss @@ -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; }