Skip to content

Commit 9c0bb8b

Browse files
fix(icon): resolve font path and add i.ph sizing for ionic theme components
1 parent 0e2eeff commit 9c0bb8b

14 files changed

Lines changed: 93 additions & 11 deletions

File tree

core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
},
8181
"scripts": {
8282
"build": "npm run clean && npm run build.css && stencil build --es5 --docs-json dist/docs.json",
83-
"build.css": "npm run css.sass && npm run css.minify",
83+
"build.css": "npm run css.sass && npm run copy.fonts && npm run css.minify",
84+
"copy.fonts": "node scripts/copy-fonts.mjs",
8485
"build.debug": "npm run clean && stencil build --debug",
8586
"build.docs.json": "stencil build --docs-json dist/docs.json",
8687
"build.tokens": "npx build.tokens --dest src/foundations/ --root=false --scss=true --scss-file=ionic.vars.scss --scss-prefix=ion --utilities=false && npm run prettier.tokens",

core/scripts/copy-fonts.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { copyFileSync, mkdirSync } from 'fs';
2+
import { join, dirname } from 'path';
3+
import { fileURLToPath } from 'url';
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url));
6+
7+
const src = join(__dirname, '../node_modules/@phosphor-icons/web/src/regular');
8+
const dest = join(__dirname, '../css/fonts');
9+
10+
mkdirSync(dest, { recursive: true });
11+
12+
['Phosphor.woff2', 'Phosphor.woff'].forEach((file) => {
13+
copyFileSync(join(src, file), join(dest, file));
14+
});

core/src/components/avatar/avatar.ionic.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,31 +144,55 @@
144144
height: globals.$ion-scale-300;
145145
}
146146

147+
:host(.avatar-xxsmall) ::slotted(i.ph) {
148+
font-size: globals.$ion-scale-300;
149+
}
150+
147151
:host(.avatar-xsmall) ::slotted(ion-icon) {
148152
width: globals.$ion-scale-400;
149153
height: globals.$ion-scale-400;
150154
}
151155

156+
:host(.avatar-xsmall) ::slotted(i.ph) {
157+
font-size: globals.$ion-scale-400;
158+
}
159+
152160
:host(.avatar-small) ::slotted(ion-icon) {
153161
width: globals.$ion-scale-500;
154162
height: globals.$ion-scale-500;
155163
}
156164

165+
:host(.avatar-small) ::slotted(i.ph) {
166+
font-size: globals.$ion-scale-500;
167+
}
168+
157169
:host(.avatar-medium) ::slotted(ion-icon) {
158170
width: globals.$ion-scale-600;
159171
height: globals.$ion-scale-600;
160172
}
161173

174+
:host(.avatar-medium) ::slotted(i.ph) {
175+
font-size: globals.$ion-scale-600;
176+
}
177+
162178
:host(.avatar-large) ::slotted(ion-icon) {
163179
width: globals.$ion-scale-700;
164180
height: globals.$ion-scale-700;
165181
}
166182

183+
:host(.avatar-large) ::slotted(i.ph) {
184+
font-size: globals.$ion-scale-700;
185+
}
186+
167187
:host(.avatar-xlarge) ::slotted(ion-icon) {
168188
width: globals.$ion-scale-800;
169189
height: globals.$ion-scale-800;
170190
}
171191

192+
:host(.avatar-xlarge) ::slotted(i.ph) {
193+
font-size: globals.$ion-scale-800;
194+
}
195+
172196
// Avatar Badge Empty (hint)
173197
// --------------------------------------------------
174198

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
height: globals.$ion-scale-300;
8686
}
8787

88+
:host(.badge-small) ::slotted(i.ph) {
89+
font-size: globals.$ion-scale-300;
90+
}
91+
8892
/* Medium Badge */
8993
/* Large size defaults to the medium size to avoid styles breakage */
9094
:host(.badge-medium),
@@ -104,6 +108,11 @@
104108
height: globals.$ion-scale-400;
105109
}
106110

111+
:host(.badge-medium) ::slotted(i.ph),
112+
:host(.badge-large) ::slotted(i.ph) {
113+
font-size: globals.$ion-scale-400;
114+
}
115+
107116
// Badge (hint)
108117
// --------------------------------------------------
109118

@@ -173,4 +182,8 @@
173182
width: globals.$ion-scale-300;
174183
height: globals.$ion-scale-300;
175184
}
185+
186+
::slotted(i.ph) {
187+
font-size: globals.$ion-scale-300;
188+
}
176189
}

core/src/components/button/button.ionic.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@
146146
width: globals.$ion-scale-500;
147147
height: globals.$ion-scale-500;
148148
}
149+
150+
::slotted(i.ph[slot="start"]),
151+
::slotted(i.ph[slot="end"]),
152+
::slotted(i.ph[slot="icon-only"]) {
153+
font-size: globals.$ion-scale-500;
154+
}
149155
}
150156

151157
:host(.button-large) {
@@ -155,6 +161,12 @@
155161
width: globals.$ion-scale-600;
156162
height: globals.$ion-scale-600;
157163
}
164+
165+
::slotted(i.ph[slot="start"]),
166+
::slotted(i.ph[slot="end"]),
167+
::slotted(i.ph[slot="icon-only"]) {
168+
font-size: globals.$ion-scale-600;
169+
}
158170
}
159171

160172
:host(.button-has-icon-only) {

core/src/components/chip/chip.ionic.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868

6969
font-size: globals.$ion-font-size-300;
7070

71-
::slotted(ion-icon) {
71+
::slotted(ion-icon),
72+
::slotted(i.ph) {
7273
font-size: globals.$ion-font-size-300;
7374
}
7475
}
@@ -78,7 +79,8 @@
7879

7980
font-size: globals.$ion-font-size-350;
8081

81-
::slotted(ion-icon) {
82+
::slotted(ion-icon),
83+
::slotted(i.ph) {
8284
font-size: globals.$ion-font-size-400;
8385
}
8486
}

core/src/components/item-option/item-option.ionic.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
height: globals.$ion-scale-500;
4343
}
4444

45+
::slotted(i.ph) {
46+
@include globals.margin(0);
47+
48+
font-size: globals.$ion-scale-500;
49+
}
50+
4551
// Item Option Shapes
4652
// --------------------------------------------------
4753

core/src/components/item/item.ionic.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ slot[name="end"]::slotted(*) {
4949
@include globals.margin(null, null, null, #{globals.$ion-space-400});
5050
}
5151

52-
::slotted(ion-icon:not(.item-detail-icon)) {
52+
::slotted(ion-icon:not(.item-detail-icon)),
53+
::slotted(i.ph) {
5354
color: globals.$ion-primitives-neutral-1000;
5455

5556
font-size: globals.$ion-scale-1000;

core/src/components/range/range.ionic.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
background: globals.current-color(base);
3535
}
3636

37-
::slotted(ion-icon[slot]) {
37+
::slotted(ion-icon[slot]),
38+
::slotted(i.ph[slot]) {
3839
font-size: globals.$ion-font-size-600;
3940
}
4041

core/src/components/segment-button/segment-button.ionic.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
height: globals.$ion-scale-600;
6464
}
6565

66+
::slotted(i.ph) {
67+
font-size: globals.$ion-scale-600;
68+
}
69+
6670
// Segment Button: Checked
6771
// All slot content should have the checked color even when it's not label or icon
6872
// --------------------------------------------------

0 commit comments

Comments
 (0)