Skip to content

Commit f2e2faf

Browse files
committed
test both image and font based icons
1 parent 3c61c1f commit f2e2faf

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

demo-ng/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"description": "NativeScript Application",
33
"main": "src/main.ts",
44
"dependencies": {
5+
"@mdi/font": "4.9.95",
56
"@angular/animations": "~11.2.7",
67
"@angular/common": "~11.2.7",
78
"@angular/compiler": "~11.2.7",

demo-ng/src/app.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@import '@nativescript/theme/css/core.css';
22
@import '@nativescript/theme/css/default.css';
3-
3+
.mdi {
4+
font-family: 'materialdesignicons-webfont', 'Material Design Icons';
5+
}
46
MDTabStrip {
57
selected-item-color: #FFFFFF;
68
un-selected-item-color: #404040;

demo-ng/src/app/examples/tabs/tabs.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</MDTabStripItem>
1212
<MDTabStripItem>
1313
<Label text="Search"></Label>
14-
<Image src="res://ic_menu"></Image>
14+
<Image src="font://&#xF349;" class="mdi"></Image>
1515
</MDTabStripItem>
1616
</MDTabStrip>
1717

demo-ng/src/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
// this import should be first in order to load some required settings (like globals and reflect-metadata)
22
import { platformNativeScriptDynamic } from "@nativescript/angular";
3-
3+
import { themer } from '@nativescript-community/ui-material-core';
44
import { AppModule } from './app/app.module';
55

6+
if (global.isIOS) {
7+
themer.setPrimaryColor('#bff937');
8+
themer.setPrimaryColorVariant('#33B5E5');
9+
themer.setAccentColor('#ff8a39');
10+
themer.setSecondaryColor('#a830d7');
11+
}
12+
613
// A traditional NativeScript application starts by initializing global objects,
714
// setting up global CSS rules, creating, and navigating to the main page.
815
// Angular applications need to take care of their own initialization:

demo-ng/webpack.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ module.exports = (env) => {
66
// Learn how to customize:
77
// https://docs.nativescript.org/webpack
88

9+
// Example: copy all files from a dependency
10+
webpack.Utils.addCopyRule({
11+
from: '@mdi/font/fonts/materialdesignicons-webfont.ttf',
12+
to: 'fonts',
13+
// the context of the "from" rule, in this case node_modules
14+
// we used the getProjectFilePath util here, but this could have been
15+
// a path.resolve(__dirname, 'node_modules') too.
16+
context: webpack.Utils.project.getProjectFilePath('node_modules')
17+
})
18+
919
return webpack.resolveConfig();
1020
};
1121

0 commit comments

Comments
 (0)