-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(badge): add recipe and tokens #31043
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
base: ionic-modular
Are you sure you want to change the base?
Changes from 11 commits
396470a
9a2e0d1
a93bc68
cd2364c
9c691b4
b40e733
bf6c885
459a508
1493f90
556b111
50fe67f
89e9b04
e029fbc
3837435
929929e
25f4e87
539c476
9f7e6c1
2a27548
6a8a4cc
ba7f2ba
bd801b8
57e3faf
47fa6d5
cf65c7a
d8ae5b5
6e794f2
ce5d5e9
15033a0
6737cb6
14e2460
2d3ce7f
c468fa8
d5abd1e
03497cb
0aaca71
9365800
40463b7
8096abf
340a4a1
0fe440f
795c0de
5f92eab
f262f4c
593ab49
fb6f80c
6d660b7
bfb9a29
75175f6
a40e4d1
cbc4a19
08c8eb1
a7240cb
0ed4e14
a8962a1
213a1eb
cc01ecc
ec64124
bf60e08
084a391
b4b612e
ad6cdee
a8fb16d
a90a769
dab9757
fc040a4
4d14936
7555cef
b56e473
9289827
cac393d
f3be02e
2064468
0237e00
f951c5d
16c6032
fe25751
4de56c3
286dbf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,79 +169,6 @@ | |
| height: globals.$ion-scale-800; | ||
| } | ||
|
|
||
| // Avatar Badge Empty (hint) | ||
| // -------------------------------------------------- | ||
|
|
||
| :host ::slotted(ion-badge.badge-vertical-top:empty) { | ||
| @include globals.transform(translate(globals.$ion-scale-050, calc(globals.$ion-scale-050 * -1))); | ||
| } | ||
|
|
||
| :host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-top:empty) { | ||
| @include globals.transform(translate(globals.$ion-scale-100, calc(globals.$ion-scale-100 * -1))); | ||
| } | ||
|
|
||
| :host ::slotted(ion-badge.badge-vertical-bottom:empty) { | ||
| @include globals.transform(translate(0, globals.$ion-scale-100)); | ||
| } | ||
|
|
||
| :host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-bottom:empty) { | ||
| @include globals.transform(translate(globals.$ion-scale-100, globals.$ion-scale-100)); | ||
| } | ||
|
|
||
| // Avatar Badge Bottom (hint) | ||
| // -------------------------------------------------- | ||
|
|
||
| :host ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) { | ||
| @include globals.transform(translate(50%, 50%)); | ||
| } | ||
|
|
||
| :host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) { | ||
| @include globals.position(null, globals.$ion-scale-100, globals.$ion-scale-100, null); | ||
| @include globals.transform(translate(100%, 100%)); | ||
| } | ||
|
|
||
| :host(.avatar-xsmall) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) { | ||
| @include globals.position(null, calc(globals.$ion-scale-050 * -1), calc(globals.$ion-scale-050 * -1), null); | ||
| } | ||
|
|
||
| :host(.avatar-small) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)), | ||
| :host(.avatar-medium) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)), | ||
| :host(.avatar-large) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) { | ||
| @include globals.position(null, globals.$ion-scale-050, globals.$ion-scale-050, null); | ||
| } | ||
|
|
||
| :host(.avatar-xlarge) ::slotted(ion-badge.badge-vertical-bottom:not(:empty)) { | ||
| @include globals.position(null, globals.$ion-scale-150, globals.$ion-scale-150, null); | ||
| } | ||
|
|
||
| // Avatar Badge Top (hint) | ||
| // -------------------------------------------------- | ||
|
|
||
| :host ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.transform(translate(50%, -50%)); | ||
| } | ||
|
|
||
| :host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.position(globals.$ion-scale-050, 0, null, null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we worried about no longer using the variables here or is this not needed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are no longer needed with how the positions are being dynamically generated. So anything related to positioning badges have been removed. |
||
| } | ||
|
|
||
| :host(.avatar-xsmall) ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.position(globals.$ion-scale-100, calc(globals.$ion-scale-050 * -1), null, null); | ||
| } | ||
|
|
||
| :host(.avatar-small) ::slotted(ion-badge.badge-vertical-top:not(:empty)), | ||
| :host(.avatar-medium) ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.position(globals.$ion-scale-150, 0, null, null); | ||
| } | ||
|
|
||
| :host(.avatar-large) ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.position(globals.$ion-scale-150, globals.$ion-scale-050, null, null); | ||
| } | ||
|
|
||
| :host(.avatar-xlarge) ::slotted(ion-badge.badge-vertical-top:not(:empty)) { | ||
| @include globals.position(globals.$ion-scale-150, globals.$ion-scale-150, null, null); | ||
| } | ||
|
|
||
| // Avatar Disabled | ||
| // -------------------------------------------------- | ||
| :host(.avatar-disabled)::after { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Avatar - Hint</title> | ||
| <meta | ||
| name="viewport" | ||
| content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" | ||
| /> | ||
| <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
|
|
||
| <style> | ||
| .row { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 20px; | ||
| margin: 16px; | ||
| } | ||
|
|
||
| h2 { | ||
| font-size: 12px; | ||
| font-weight: normal; | ||
| color: #6f7378; | ||
| margin-top: 10px; | ||
| margin-left: 5px; | ||
| } | ||
| </style> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Avatar - Hint</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content id="content"></ion-content> | ||
| </ion-app> | ||
|
|
||
| <script> | ||
| const avatarSizes = ['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge']; | ||
| const badgeSizes = ['small', 'medium', 'large']; | ||
| const positions = ['top', 'bottom', '']; | ||
| const imgSrc = '/src/components/avatar/test/avatar.svg'; | ||
|
|
||
| // Badge content variants: empty (dot), text, icon | ||
| const badgeContents = [ | ||
| { label: 'empty', html: '' }, | ||
| { label: 'text', html: '1' }, | ||
| { label: 'longText', html: '999+' }, | ||
| { label: 'icon', html: '<ion-icon icon="star"></ion-icon>' }, | ||
| ]; | ||
|
|
||
| const content = document.getElementById('content'); | ||
|
|
||
| avatarSizes.forEach((avatarSize) => { | ||
| positions.forEach((position) => { | ||
| const heading = document.createElement('h2'); | ||
| heading.textContent = `avatar size: ${avatarSize} / badge position: ${position || 'none'}`; | ||
| content.appendChild(heading); | ||
|
|
||
| const row = document.createElement('div'); | ||
| row.className = 'row'; | ||
|
|
||
| badgeSizes.forEach((badgeSize) => { | ||
| badgeContents.forEach(({ html }) => { | ||
| const avatar = document.createElement('ion-avatar'); | ||
| avatar.setAttribute('size', avatarSize); | ||
|
|
||
| const img = document.createElement('img'); | ||
| img.setAttribute('src', imgSrc); | ||
| avatar.appendChild(img); | ||
|
|
||
| const badge = document.createElement('ion-badge'); | ||
| badge.setAttribute('hue', 'bold'); | ||
| badge.setAttribute('color', 'danger'); | ||
| badge.setAttribute('shape', 'round'); | ||
| badge.setAttribute('size', badgeSize); | ||
| if (position) { | ||
| badge.setAttribute('vertical', position); | ||
| } | ||
| badge.innerHTML = html; | ||
|
|
||
| avatar.appendChild(badge); | ||
| row.appendChild(avatar); | ||
| }); | ||
| }); | ||
|
|
||
| content.appendChild(row); | ||
| }); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These styles were removed in favor of the
positionBadgeutility that generates the position. The same goes for any styles like these for the other files.