Skip to content
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

fix(kbadge): slotted link styles [KHCP-14774] #2585

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .stylelintrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
'custom-property-no-missing-var-function': true,
'rule-empty-line-before': ['always', { ignore: ['after-comment', 'first-nested'] }],
'@stylistic/block-opening-brace-space-before': 'always',
'selector-pseudo-class-no-unknown': [true, { ignorePseudoClasses: ['deep', 'slotted'] }],
// Disable the following rules
'no-descending-specificity': null,
},
Expand Down
60 changes: 57 additions & 3 deletions sandbox/pages/SandboxBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,62 @@
<SandboxSectionComponent
title="default"
>
<KBadge>
<b>Default</b> slot
</KBadge>
<div class="horizontal-spacing">
<KBadge>
Info.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
<KBadge appearance="success">
Success.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
<KBadge appearance="warning">
Warning.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
<KBadge appearance="danger">
Danger.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
<KBadge appearance="decorative">
Decorative.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
<KBadge appearance="neutral">
Neutral.
<KExternalLink
href="https://kongponents.konghq.com/components/badge.html"
target="_blank"
>
Link
</KExternalLink>
</KBadge>
</div>
<p>Using icon within the default slot basically becomes a don't unless you are willing to override some default component styles.</p>
<div class="horizontal-spacing">
<KBadge>
Expand Down Expand Up @@ -398,6 +451,7 @@ import { inject } from 'vue'
import SandboxTitleComponent from '../components/SandboxTitleComponent.vue'
import SandboxSectionComponent from '../components/SandboxSectionComponent.vue'
import { KongIcon, WarningOutlineIcon, CloseIcon } from '@kong/icons'
import KExternalLink from '@/components/KExternalLink/KExternalLink.vue'

const handleIconClick = (): void => {
alert('Icon clicked!')
Expand Down
11 changes: 10 additions & 1 deletion src/styles/mixins/_badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,22 @@
background-color: $bgColor;
color: $textColor;

/* stylelint-disable-next-line selector-pseudo-class-no-unknown */
:deep([role="button"]):not([disabled]):not(#{$kongponentsKCopyTooltipWrapperSelector}):not(.badge-content) {
&:hover,
&:focus {
color: $hoverColor !important;
}
}

:deep(a) {
color: $textColor;
font-weight: var(--kui-font-weight-semibold, $kui-font-weight-semibold);
text-decoration: none;

&:hover {
color: $hoverColor;
}
}
}

@mixin decorativeBadgeAppearance {
Expand Down
Loading