Skip to content

Commit

Permalink
[BasicUI] Upgrade to last version of Material icons
Browse files Browse the repository at this point in the history
Move from the outdated official NPM module (material-design-icons) to an
alternative NPM module (material-icons) providing most recent material
icons.

As a consequence, TTF format is no more provided, only WOFF and WOFF2
formats. All current browsers support WOFF format, so only very old
browsers could be impacted by the miss of the TTF format.

Also fix icon size in condensed mode (28x28).

Re-align material-icons.css to official file.

Fixes openhab#2011
Fixes openhab#2015

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo committed Aug 11, 2023
1 parent 0d34818 commit 274901d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
3 changes: 1 addition & 2 deletions bundles/org.openhab.ui.basic/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

var paths = {
FontLibs: [
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff*',
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf'
'./node_modules/material-icons/iconfont/material-icons.woff*'
]
};

Expand Down
18 changes: 9 additions & 9 deletions bundles/org.openhab.ui.basic/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bundles/org.openhab.ui.basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"gulp-eslint": "^6.0.0",
"gulp-sass": "^5.0.0",
"gulp-uglify": "^3.0.2",
"material-design-icons": "^3.0.1",
"material-icons": "^1.13.9",
"node-sass": "^8.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<spam class="material-icons md-oh">%icon_name%</spam>
<spam class="material-icons">%icon_name%</spam>
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
font-weight: 400;
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(fonts/MaterialIcons-Regular.woff2) format('woff2'),
url(fonts/MaterialIcons-Regular.woff) format('woff'),
url(fonts/MaterialIcons-Regular.ttf) format('truetype');
url(fonts/material-icons.woff2) format('woff2'),
url(fonts/material-icons.woff) format('woff');
}

.material-icons {
Expand All @@ -15,12 +14,12 @@
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
width: 1em;
height: 1em;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
Expand All @@ -33,14 +32,3 @@
/* Support for IE. */
font-feature-settings: 'liga';
}

.material-icons.md-oh {
font-size: 32px;
vertical-align: middle;
html:not(.ui-icons-enabled) & {
display: none;
}
html.ui-layout-condensed & {
font-size: 28px;
}
}
10 changes: 10 additions & 0 deletions bundles/org.openhab.ui.basic/web-src/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@
font-size: 28px;
}
}
.material-icons {
font-size: 32px;
vertical-align: middle;
html:not(.ui-icons-enabled) & {
display: none;
}
html.ui-layout-condensed & {
font-size: 28px;
}
}
}
&__label {
@media screen and (max-width: $layout-tablet-size-threshold) {
Expand Down

0 comments on commit 274901d

Please sign in to comment.