Skip to content

Commit

Permalink
[BasicUI] Add support for framework7 icons (#2013)
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored Aug 13, 2023
1 parent 034d8b9 commit 391f0fd
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bundles/org.openhab.ui.basic/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
var paths = {
FontLibs: [
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff*',
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf'
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf',
'./node_modules/framework7-icons/fonts/Framework7Icons-Regular.woff*',
'./node_modules/framework7-icons/fonts/Framework7Icons-Regular.ttf'
]
};

Expand Down
14 changes: 14 additions & 0 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.

1 change: 1 addition & 0 deletions bundles/org.openhab.ui.basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"gulp-sass": "^5.0.0",
"gulp-uglify": "^3.0.2",
"material-design-icons": "^3.0.1",
"framework7-icons": "^5.0.5",
"node-sass": "^8.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public abstract class AbstractWidgetRenderer implements WidgetRenderer {
private static final String ICON_SOURCE_IF = "if";
private static final String ICON_SOURCE_ICONIFY = "iconify";
private static final String ICON_SOURCE_MATERIAL = "material";
private static final String ICON_SOURCE_FRAMEWORK7 = "f7";
private static final String ICON_SET_OH_CLASSIC = "classic";
private static final String DEFAULT_ICON_SOURCE = ICON_SOURCE_OH;
private static final String DEFAULT_ICON_SET = ICON_SET_OH_CLASSIC;
Expand Down Expand Up @@ -176,6 +177,9 @@ private String preprocessIcon(String originalSnippet, Widget w, boolean ignoreSt
case ICON_SOURCE_MATERIAL:
iconSnippet = getSnippet("icon_material");
break;
case ICON_SOURCE_FRAMEWORK7:
iconSnippet = getSnippet("icon_framework7");
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<spam class="f7-icons">%icon_name%</spam>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<link rel="stylesheet" type="text/css" href="mdl/material.min.css" />
<link rel="stylesheet" type="text/css" href="material-icons.css" />
<link rel="stylesheet" type="text/css" href="framework7-icons.css" />
<link rel="stylesheet" type="text/css" href="smarthome.css" />

<script type="application/json" id="config">{"webAudio":%config.web-audio%}</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@font-face {
font-family: 'Framework7 Icons';
font-style: normal;
font-weight: 400;
src: local('Framework7 Icons'),
local('Framework7Icons-Regular'),
url('fonts/Framework7Icons-Regular.woff2') format('woff2'),
url('fonts/Framework7Icons-Regular.woff') format('woff'),
url('fonts/Framework7Icons-Regular.ttf') format('truetype');
}

.f7-icons,
.framework7-icons {
font-family: 'Framework7 Icons';
font-weight: normal;
font-style: normal;
font-size: 28px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
-webkit-font-feature-settings: 'liga';
-moz-font-feature-settings: 'liga=1';
-moz-font-feature-settings: 'liga';
font-feature-settings: 'liga';
text-align: center;
}
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 @@ -170,6 +170,16 @@
font-size: 28px;
}
}
.f7-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 391f0fd

Please sign in to comment.