summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorFlorian Orben <florian.orben@gmail.com>2015-11-28 02:54:04 +0100
committerFlorian Orben <florian.orben@gmail.com>2015-11-28 02:54:04 +0100
commit42bf8173bd2dca7cb6c33c2df98c399958c6ef15 (patch)
treedf50c6217d327ea128e70be5288378ef168ee247 /web/react/utils
parent42a001c4e26acaebb7bade2a9b45428578b04164 (diff)
downloadchat-42bf8173bd2dca7cb6c33c2df98c399958c6ef15.tar.gz
chat-42bf8173bd2dca7cb6c33c2df98c399958c6ef15.tar.bz2
chat-42bf8173bd2dca7cb6c33c2df98c399958c6ef15.zip
PLT-1233: "Display Font" option in Account Settings > Display
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/constants.jsx15
-rw-r--r--web/react/utils/utils.jsx11
2 files changed, 26 insertions, 0 deletions
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index 372e15556..122fad348 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -344,6 +344,21 @@ export default {
}
],
DEFAULT_CODE_THEME: 'github',
+ FONTS: {
+ 'Droid Serif': 'font--droid_serif',
+ 'Roboto Slab': 'font--roboto_slab',
+ Lora: 'font--lora',
+ Slabo: 'font--slabo',
+ Arvo: 'font--arvo',
+ 'Open Sans': 'font--open_sans',
+ Roboto: 'font--roboto',
+ 'PT Sans': 'font--pt_sans',
+ Lato: 'font--lato',
+ 'Source Sans Pro': 'font--source_sans_pro',
+ 'Exo 2': 'font--exo_2',
+ Ubuntu: 'font--ubuntu'
+ },
+ DEFAULT_FONT: 'Open Sans',
Preferences: {
CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show',
CATEGORY_DISPLAY_SETTINGS: 'display_settings',
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 9b2f7e057..b3d1350b6 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -694,6 +694,17 @@ export function applyTheme(theme) {
}
updateCodeTheme(theme.codeTheme);
}
+
+export function applyFont(fontName) {
+ const body = document.querySelector('body');
+ body.classList.forEach((className) => {
+ if (className.lastIndexOf('font') === 0) {
+ body.classList.remove(className);
+ }
+ });
+ body.classList.add(Constants.FONTS[fontName]);
+}
+
export function changeCss(className, classValue, classRepeat) {
// we need invisible container to store additional css definitions
var cssMainContainer = $('#css-modifier-container');