Skip to content

Commit ade7eb8

Browse files
committed
perf(QIcon): simplify fontawesome logic
1 parent 8f7c560 commit ade7eb8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ui/src/components/icon/QIcon.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ const sameFn = i => i
1111
const ionFn = i => `ionicons ${ i }`
1212

1313
const libMap = {
14+
'mdi-': i => `mdi ${ i }`,
1415
'icon-': sameFn, // fontawesome equiv
1516
'bt-': i => `bt ${ i }`,
1617
'eva-': i => `eva ${ i }`,
1718
'ion-md': ionFn,
1819
'ion-ios': ionFn,
1920
'ion-logo': ionFn,
20-
'mdi-': i => `mdi ${ i }`,
2121
'iconfont ': sameFn,
2222
'ti-': i => `themify-icon ${ i }`,
2323
'bi-': i => `bootstrap-icons ${ i }`
@@ -35,8 +35,7 @@ const mRE = /^[Mm]\s?[-+]?\.?\d/
3535
const imgRE = /^img:/
3636
const svgUseRE = /^svguse:/
3737
const ionRE = /^ion-/
38-
const faLaRE = /^[lf]a[srlbdk]? /
39-
const fa6RE = /^fa-(solid|regular|light|brands|duotone|thin)/
38+
const faRE = /^(fa-(solid|regular|light|brands|duotone|thin)|[lf]a[srlbdk]?) /
4039

4140
export default createComponent({
4241
name: 'QIcon',
@@ -130,7 +129,7 @@ export default createComponent({
130129
if (matches !== null) {
131130
cls = libMap[ matches[ 1 ] ](icon)
132131
}
133-
else if (faLaRE.test(icon) === true || fa6RE.test(icon) === true) {
132+
else if (faRE.test(icon) === true) {
134133
cls = icon
135134
}
136135
else if (ionRE.test(icon) === true) {

0 commit comments

Comments
 (0)