-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(badge-patch): fix for badge text center (#67)
* feat(badge-patch): fix for badge text center * feat(fixed): empty line * feat(badge): fix comments
- Loading branch information
1 parent
cbf7887
commit 62802f1
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Patches provided vivid-3 VwcBadge instance to show text in the center | ||
* | ||
* @param {HTMLElement} badgeElement - target element to apply behavior to | ||
* @example <VwcBadge ref={vwcBadgeShowTextCenterDecorator()} /> | ||
*/ | ||
export const vwcBadgeShowTextCenterDecorator = () => badgeElement => | ||
setTimeout(() => { | ||
if (!badgeElement) { | ||
return | ||
} | ||
|
||
if (badgeElement.shadowRoot) { | ||
const span = badgeElement.shadowRoot.querySelector('span.base'); | ||
if (span) { | ||
span.style.display = 'flex'; | ||
span.style.justifyContent = 'center'; | ||
} | ||
} | ||
}, 0) | ||
|