-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(theme-default): add built-in global component Badge
.
#1134
feat(theme-default): add built-in global component Badge
.
#1134
Conversation
Looks fine to me. But might wanna move those color definitions to Also, probably register this globally, so users don't need to import it on each page. |
30d7373
to
e62a100
Compare
@brc-dd That's great, as your suggestion,
I also modify the related content in |
613fdb7
to
e62a100
Compare
VPBadge
.Badge
.
BTW, we could migrate to @mdit-vue/plugin-toc to allow badges in toc after this PR is merged. |
…lobal component `Badge`.
f2326e5
to
d0eb32f
Compare
@@ -6,7 +6,7 @@ import { | |||
onMounted, | |||
watch | |||
} from 'vue' | |||
import Theme from '/@theme/index' | |||
import Theme, { VPBadge } from '/@theme/index' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theme/index
is an alias to the theme entry, which could be the user's custom theme. So { VPBadge }
is not guaranteed to be exported.
@@ -19,6 +19,7 @@ export { default as VPTeamPage } from './components/VPTeamPage.vue' | |||
export { default as VPTeamPageTitle } from './components/VPTeamPageTitle.vue' | |||
export { default as VPTeamPageSection } from './components/VPTeamPageSection.vue' | |||
export { default as VPTeamMembers } from './components/VPTeamMembers.vue' | |||
export { default as VPBadge } from './components/VPBadge.vue' | |||
|
|||
const theme: Theme = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should register the component via enhanceApp
here
Looking forward this feature. |
@brc-dd Hi, this my first PR to vitepress. Could you please review the changes, any suggestion is nice for me to improve this PR, or drop it if you think the component is unnecessary for theme-default.
What does this PR take
One new component
<Badge />
to help writors add one marked badge in title, or somewhere they like.Why
I'm using custom
<Badge />
in my own vitepress theme/config for some time, I guess, maybe other developers would use this component if the official default theme provides it. So I try to add it into theme-default as<VPBadge />
fixes #1156