mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-27 23:40:28 +05:30
Add Consolas webfont
This commit is contained in:
parent
bab6293d9e
commit
a33d0b66d0
@ -3,6 +3,7 @@ import ReactDOM from 'react-dom';
|
||||
|
||||
import { bsod } from './actions';
|
||||
import BSoD from 'components/ui/bsod/BSoD';
|
||||
import font from 'services/font';
|
||||
|
||||
let injectedStore;
|
||||
let onBsod;
|
||||
@ -11,9 +12,11 @@ export default function dispatchBsod(store = injectedStore) {
|
||||
store.dispatch(bsod());
|
||||
onBsod && onBsod();
|
||||
|
||||
ReactDOM.render(
|
||||
<BSoD store={store} />,
|
||||
document.getElementById('app')
|
||||
font.load(['Consolas']).then(() =>
|
||||
ReactDOM.render(
|
||||
<BSoD store={store} />,
|
||||
document.getElementById('app')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,16 @@
|
||||
|
||||
$font-family-monospaced: 'Consolas', monospace;
|
||||
|
||||
@font-face {
|
||||
font-family: 'Consolas';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Consolas'),
|
||||
url('~fonts/consolas/consolas-regular.woff2') format('woff2'), /* Super Modern Browsers */
|
||||
url('~fonts/consolas/consolas-regular.woff') format('woff'), /* Modern Browsers */
|
||||
url('~fonts/consolas/consolas-regular.ttf') format('truetype'); /* Safari, Android, iOS */
|
||||
}
|
||||
|
||||
.body {
|
||||
height: 100%;
|
||||
background-color: $dark_blue;
|
||||
|
BIN
src/fonts/consolas/consolas-regular.ttf
Normal file
BIN
src/fonts/consolas/consolas-regular.ttf
Normal file
Binary file not shown.
BIN
src/fonts/consolas/consolas-regular.woff
Normal file
BIN
src/fonts/consolas/consolas-regular.woff
Normal file
Binary file not shown.
BIN
src/fonts/consolas/consolas-regular.woff2
Normal file
BIN
src/fonts/consolas/consolas-regular.woff2
Normal file
Binary file not shown.
@ -3,19 +3,29 @@ import webFont from 'webfontloader';
|
||||
export default {
|
||||
/**
|
||||
* @param {array} families
|
||||
* @param {object} options
|
||||
* @param {bool} [options.external=false] - whether the font should be loaded from external source (e.g. google)
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
load(families = []) {
|
||||
load(families = [], options = {}) {
|
||||
let config = {
|
||||
custom: {families}
|
||||
};
|
||||
|
||||
if (options.external) {
|
||||
config = {
|
||||
google: {families}
|
||||
};
|
||||
}
|
||||
|
||||
return new Promise((resolve) =>
|
||||
webFont.load({
|
||||
classes: false,
|
||||
active: resolve,
|
||||
inactive: resolve, // TODO: may be we should track such cases
|
||||
timeout: 2000,
|
||||
custom: {
|
||||
families
|
||||
}
|
||||
...config
|
||||
})
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user