Add documentation on GH pages (#85)

* Add documentation on GH pages

* Expand classes for doc generation

* Update docs

* .nojekyll

* Update Identicon.tsx

* Update Demo.tsx

* Update KeyPair.tsx

* Export specific icons

* Convert tests to TypeScript
This commit is contained in:
Jaco Greeff
2019-02-27 11:18:35 +01:00
committed by GitHub
parent 8bbe9ab8ee
commit 28b991d61d
31 changed files with 494 additions and 339 deletions
+78
View File
@@ -0,0 +1,78 @@
// Copyright 2017-2019 @polkadot/ui-settings authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import store from 'store';
import { ENDPOINTS, LANGUAGES, UIMODES, UITHEMES } from './defaults';
import { Options, SettingsStruct } from './types';
export class Settings implements SettingsStruct {
private _apiUrl: string;
private _i18nLang: string;
private _uiMode: string;
private _uiTheme: string;
constructor () {
const settings = store.get('settings') || {};
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINTS[0].value;
this._i18nLang = settings.i18nLang || LANGUAGES[0].value;
this._uiMode = settings.uiMode || process.env.UI_MODE || UIMODES[0].value;
this._uiTheme = settings.uiTheme || process.env.UI_THEME || UITHEMES[0].value;
}
get apiUrl (): string {
return this._apiUrl;
}
get i18nLang (): string {
return this._i18nLang;
}
get uiMode (): string {
return this._uiMode;
}
get uiTheme (): string {
return this._uiTheme;
}
get availableNodes (): Options {
return ENDPOINTS;
}
get availableLanguages (): Options {
return LANGUAGES;
}
get availableUIModes (): Options {
return UIMODES;
}
get availableUIThemes (): Options {
return UITHEMES;
}
get (): SettingsStruct {
return {
apiUrl: this._apiUrl,
i18nLang: this._i18nLang,
uiMode: this._uiMode,
uiTheme: this._uiTheme
};
}
set (settings: Partial<SettingsStruct>): void {
this._apiUrl = settings.apiUrl || this._apiUrl;
this._i18nLang = settings.i18nLang || this._i18nLang;
this._uiMode = settings.uiMode || this._uiMode;
this._uiTheme = settings.uiTheme || this._uiTheme;
store.set('settings', this.get());
}
}
const settings = new Settings();
export default settings;