forked from spacebarchat/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.web.js
30 lines (26 loc) · 953 Bytes
/
styles.web.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import iconFont from 'react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf';
import SSL from './assets/fonts/SourceSans/SourceSans3-Light.otf';
import SSR from './assets/fonts/SourceSans/SourceSans3-Regular.otf';
import SSSB from './assets/fonts/SourceSans/SourceSans3-Semibold.otf';
const fonts = [
{font: SSR, name: 'SourceSans3-Regular'},
{font: SSSB, name: 'SourceSans3-Semibold'},
{font: SSL, name: 'SourceSans3-Light'},
{font: iconFont, name: 'MaterialCommunityIcons'},
];
for (const font of fonts) {
const iconFontStyles = `@font-face {
src: url(${font.font});
font-family: ${font.name};
}`;
// Create stylesheet
const style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = iconFontStyles;
} else {
style.appendChild(document.createTextNode(iconFontStyles));
}
// Inject stylesheet
document.head.appendChild(style);
}