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

feat(link): added :part pseudo-element to component #4749

Merged
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
5 changes: 4 additions & 1 deletion packages/web-components/src/components/link/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import BXLink from 'carbon-web-components/es/components/link/link.js';

/**
* Link.
*
* @csspart link The link element displayed as an <a /> tag (regular link) or <p /> (disabled link)
*/
class DDSLink extends BXLink {
@query('#link')
Expand All @@ -39,7 +41,7 @@ class DDSLink extends BXLink {
protected _renderDisabledLink() {
const { _classes: classes } = this;
return html`
<p id="link" class="${classes}">${this._renderInner()}</p>
<p id="link" part="link" class="${classes}">${this._renderInner()}</p>
`;
}

Expand All @@ -64,6 +66,7 @@ class DDSLink extends BXLink {
id="link"
role="${ifNonNull(linkRole)}"
class="${classes}"
part="link"
download="${ifNonNull(download)}"
href="${ifNonNull(href)}"
hreflang="${ifNonNull(hreflang)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a
class="bx--card__footer bx--link bx--link-with-icon bx--link-with-icon__icon-right dds-ce--card__footer"
id="link"
part="link"
>
<span
class="bx--card__cta__copy"
Expand All @@ -29,6 +30,7 @@
class="bx--card__footer bx--link bx--link-with-icon bx--link-with-icon__icon-right dds-ce--card__footer"
href="#"
id="link"
part="link"
>
<span class="bx--card__cta__copy">
<slot>
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tests/snapshots/dds-card-cta.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
class="bx--card__footer bx--link bx--link-with-icon bx--link-with-icon__icon-right dds-ce--card__footer"
href="#"
id="link"
part="link"
>
<span class="bx--card__cta__copy">
<slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
class="bx--card bx--card--link bx--feature-card-block-large bx--tile bx--tile--clickable"
href="https://example.com"
id="link"
part="link"
>
<slot name="image">
</slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
class="bx--card bx--card--link bx--feature-card bx--tile bx--tile--clickable"
href="https://example.com"
id="link"
part="link"
>
<slot name="image">
</slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class="bx--card bx--card--link bx--feature-card bx--tile bx--tile--clickable"
href="https://example.com"
id="link"
part="link"
>
<slot name="image">
</slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a
class="bx--footer__link bx--link"
id="link"
part="link"
>
<slot>
</slot>
Expand All @@ -21,6 +22,7 @@
<a
class="bx--footer__link bx--link"
id="link"
part="link"
>
<slot>
title-text-foo
Expand Down
2 changes: 2 additions & 0 deletions packages/web-components/tests/snapshots/dds-link-with-icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a
class="bx--link bx--link-with-icon"
id="link"
part="link"
>
<span>
<slot>
Expand All @@ -25,6 +26,7 @@
<p
class="bx--link bx--link--disabled bx--link-with-icon"
id="link"
part="link"
>
<span>
<slot>
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tests/snapshots/dds-locale-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a
class="bx--link"
id="link"
part="link"
>
<div class="bx--locale-modal__locales__name">
country-foo
Expand Down
2 changes: 2 additions & 0 deletions packages/web-components/tests/snapshots/dds-masthead-logo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
aria-label="IBM logo"
href="https://www.ibm.com/"
id="link"
part="link"
>
<slot>
</slot>
Expand All @@ -23,6 +24,7 @@
aria-label="IBM logo"
href="https://cloud.ibm.com/"
id="link"
part="link"
>
<slot>
</slot>
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tests/snapshots/dds-region-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class="bx--link"
href="about:blank"
id="link"
part="link"
>
<div class="bx--card__wrapper">
<div class="bx--card__content">
Expand Down
2 changes: 2 additions & 0 deletions packages/web-components/tests/snapshots/dds-text-cta.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a
class="bx--link bx--link-with-icon bx--link-with-icon__icon-right"
id="link"
part="link"
>
<span>
<slot>
Expand All @@ -26,6 +27,7 @@
class="bx--link bx--link-with-icon bx--link-with-icon__icon-right"
href="#"
id="link"
part="link"
>
<span>
<slot>
Expand Down