Skip to content

Commit

Permalink
refactor(badge): update to match conventions (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimshins authored Nov 17, 2024
1 parent 4158837 commit 24f8f03
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
10 changes: 10 additions & 0 deletions packages/web-components/src/badge-wrapper/badge-wrapper.style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { css } from "lit";

export default css`
*,
*::before,
*::after {
box-sizing: border-box;
}
:host {
display: inline-block;
}
.root.left .badge {
transform: translate(-50%, -50%);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/badge-wrapper/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const Slots = {
DEFAULT: "",
BADGE: "badge",
};
} as const;
8 changes: 5 additions & 3 deletions packages/web-components/src/badge/badge.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export default css`
}
:host {
display: inline-flex;
display: inline-block;
}
.root:not(.dot).medium {
.root:not(.dot).md {
height: 1.5rem;
min-width: 1.5rem;
}
.root:not(.dot).small {
.root:not(.dot).sm {
height: 1.25rem;
min-width: 1.25rem;
}
Expand Down Expand Up @@ -82,6 +82,8 @@ export default css`
align-items: center;
justify-content: center;
vertical-align: middle;
gap: var(--tap-sys-spacing-2);
font-family: var(--tap-sys-font-family);
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/badge/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Badge extends LitElement {
public priority: "high" | "low" = "high";

@property({ type: String })
public size: "medium" | "small" = "medium";
public size: "md" | "sm" = "md";

@state()
private _hasIcon = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/badge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export { Slots } from "./constants";
* @prop {'pill' | 'numeral' | 'dot'} [variant='pill'] - The variant of the badge.
* @prop {'success' | 'error' | 'info' | 'warning' | 'neutral'} [color='neutral'] - The color of the badge.
* @prop {'high' | 'low'} [priority='high'] - The priority level of the badge.
* @prop {'medium' | 'small'} [size='medium'] - The size of the badge.
* @prop {'md' | 'sm'} [size='md'] - The size of the badge.
*/
@customElement("tap-badge")
export class TapBadge extends Badge {
Expand Down

0 comments on commit 24f8f03

Please sign in to comment.