Skip to content

Commit 396470a

Browse files
committed
feat(badge): add recipe and tokens
1 parent 1ce0e2d commit 396470a

12 files changed

Lines changed: 569 additions & 168 deletions

File tree

core/src/components.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,19 @@ export namespace Components {
467467
*/
468468
"color"?: Color;
469469
/**
470-
* Set to `"bold"` for a badge with vibrant, bold colors or to `"subtle"` for a badge with muted, subtle colors. Only applies to the `ionic` theme.
470+
* Set to `"bold"` for a badge with vibrant, bold colors or to `"subtle"` for a badge with muted, subtle colors. Defaults to `"bold"` if both the hue property and theme config are unset.
471471
*/
472472
"hue"?: 'bold' | 'subtle';
473473
/**
474474
* The mode determines the platform behaviors of the component.
475475
*/
476476
"mode"?: "ios" | "md";
477477
/**
478-
* Set to `"rectangular"` for non-rounded corners. Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes.
478+
* Set to `"crisp"` for a badge with minimally rounded corners, `"soft"` for a badge with slightly rounded corners, `"round"` for a badge with fully rounded corners, or `"rectangular"` for a badge without rounded corners. Defaults to `"soft"` if both the shape property and theme config are unset.
479479
*/
480-
"shape"?: 'soft' | 'round | rectangular';
480+
"shape"?: 'crisp' | 'soft' | 'round' | 'rectangular';
481481
/**
482-
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
482+
* Set to `"small"` for a smaller size. Set to `"medium"` for a medium size. Set to `"large"` for a larger size. Defaults to `"small"` if both the size property and theme config are unset.
483483
*/
484484
"size"?: 'small' | 'medium' | 'large';
485485
/**
@@ -896,7 +896,7 @@ export namespace Components {
896896
*/
897897
"shape"?: 'soft' | 'round' | 'rectangular';
898898
/**
899-
* Set to `"small"` for a chip with less height and padding. Defaults to `"large"` if both the size property and theme config are unset.
899+
* Set to `"small"` for a chip with less height and padding, or `"large"` for a chip with more height and padding. Defaults to `"large"` if both the size property and theme config are unset.
900900
*/
901901
"size"?: 'small' | 'large';
902902
}
@@ -6402,19 +6402,19 @@ declare namespace LocalJSX {
64026402
*/
64036403
"color"?: Color;
64046404
/**
6405-
* Set to `"bold"` for a badge with vibrant, bold colors or to `"subtle"` for a badge with muted, subtle colors. Only applies to the `ionic` theme.
6405+
* Set to `"bold"` for a badge with vibrant, bold colors or to `"subtle"` for a badge with muted, subtle colors. Defaults to `"bold"` if both the hue property and theme config are unset.
64066406
*/
64076407
"hue"?: 'bold' | 'subtle';
64086408
/**
64096409
* The mode determines the platform behaviors of the component.
64106410
*/
64116411
"mode"?: "ios" | "md";
64126412
/**
6413-
* Set to `"rectangular"` for non-rounded corners. Set to `"soft"` for slightly rounded corners. Set to `"round"` for fully rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes.
6413+
* Set to `"crisp"` for a badge with minimally rounded corners, `"soft"` for a badge with slightly rounded corners, `"round"` for a badge with fully rounded corners, or `"rectangular"` for a badge without rounded corners. Defaults to `"soft"` if both the shape property and theme config are unset.
64146414
*/
6415-
"shape"?: 'soft' | 'round | rectangular';
6415+
"shape"?: 'crisp' | 'soft' | 'round' | 'rectangular';
64166416
/**
6417-
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
6417+
* Set to `"small"` for a smaller size. Set to `"medium"` for a medium size. Set to `"large"` for a larger size. Defaults to `"small"` if both the size property and theme config are unset.
64186418
*/
64196419
"size"?: 'small' | 'medium' | 'large';
64206420
/**
@@ -6866,7 +6866,7 @@ declare namespace LocalJSX {
68666866
*/
68676867
"shape"?: 'soft' | 'round' | 'rectangular';
68686868
/**
6869-
* Set to `"small"` for a chip with less height and padding. Defaults to `"large"` if both the size property and theme config are unset.
6869+
* Set to `"small"` for a chip with less height and padding, or `"large"` for a chip with more height and padding. Defaults to `"large"` if both the size property and theme config are unset.
68706870
*/
68716871
"size"?: 'small' | 'large';
68726872
}

core/src/components/badge/badge.common.scss

Lines changed: 0 additions & 47 deletions
This file was deleted.

core/src/components/badge/badge.ionic.scss

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
2-
@use "./badge.common";
2+
@use "./badge";
33

44
// Ionic Badge
55
// --------------------------------------------------
@@ -51,21 +51,22 @@
5151

5252
/* Soft Badge */
5353
:host(.badge-soft) {
54-
@include globals.border-radius(globals.$ion-soft-xs);
54+
@include globals.border-radius(globals.$ion-soft-xs); // 8px
5555
}
5656

57+
// TODO: add example that this needs to be done by passing props of small size ane crisp shape
5758
:host(.badge-small.badge-soft) {
58-
@include globals.border-radius(globals.$ion-soft-2xs);
59+
@include globals.border-radius(globals.$ion-soft-2xs); // 4px
5960
}
6061

6162
/* Round Badge */
6263
:host(.badge-round) {
63-
@include globals.border-radius(globals.$ion-round-sm);
64+
@include globals.border-radius(globals.$ion-round-sm); // 999px
6465
}
6566

6667
/* Rectangular Badge */
6768
:host(.badge-rectangular) {
68-
@include globals.border-radius(globals.$ion-rectangular-sm);
69+
@include globals.border-radius(globals.$ion-rectangular-sm); // 0
6970
}
7071

7172
// Badge Sizes
@@ -77,7 +78,7 @@
7778
--padding-end: #{globals.$ion-space-050};
7879

7980
min-width: globals.$ion-scale-400;
80-
height: globals.$ion-scale-400;
81+
height: globals.$ion-scale-400; // 16px
8182
}
8283

8384
:host(.badge-small) ::slotted(ion-icon) {
@@ -92,10 +93,10 @@
9293
--padding-start: #{globals.$ion-space-100};
9394
--padding-end: #{globals.$ion-space-100};
9495

95-
@include globals.typography(globals.$ion-body-md-medium);
96+
@include globals.typography(globals.$ion-body-md-medium); // TODO: Add this
9697

9798
min-width: globals.$ion-scale-600;
98-
height: globals.$ion-scale-600;
99+
height: globals.$ion-scale-600; // 24px
99100
}
100101

101102
:host(.badge-medium) ::slotted(ion-icon),
@@ -112,6 +113,7 @@
112113
--padding-end: 0;
113114
}
114115

116+
// TODO: don't add since this is an equivalent of size medium so give example
115117
:host([vertical]:not(:empty)) {
116118
--padding-start: #{globals.$ion-scale-100};
117119
--padding-end: #{globals.$ion-scale-100};

core/src/components/badge/badge.native.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import "../../themes/native/native.globals.md";
2-
@import "./badge.common";
2+
@import "./badge";
33
@import "./badge.native.vars";
44

55
// Badge
@@ -15,7 +15,7 @@
1515

1616
min-width: $badge-min-width;
1717

18-
font-family: $font-family-base;
18+
font-family: $font-family-base; // TODO: Add this
1919

2020
font-size: $badge-font-size;
2121
font-weight: $badge-font-weight;

0 commit comments

Comments
 (0)