From f2dd785e7b3e80db3950800a5eb0eb40fdc7d3f9 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Fri, 30 Dec 2016 18:56:16 +0100 Subject: [PATCH] Simplify font stacks and limit to one default value --- src/components/inputs/FontInput.jsx | 9 ++------- src/config/fontstacks.json | 14 ++++---------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/components/inputs/FontInput.jsx b/src/components/inputs/FontInput.jsx index 3bf2967..b04d821 100644 --- a/src/components/inputs/FontInput.jsx +++ b/src/components/inputs/FontInput.jsx @@ -3,12 +3,7 @@ import SelectInput from './SelectInput' import input from '../../config/input.js' //TODO: Query available font stack dynamically -import fontFamilies from '../../config/fontstacks.json' -let fontStacks = [] - -Object.keys(fontFamilies).forEach(family => { - fontStacks = fontStacks.concat(fontFamilies[family]) -}) +import fontStacks from '../../config/fontstacks.json' class FontInput extends React.Component { static propTypes = { @@ -18,7 +13,7 @@ class FontInput extends React.Component { } get values() { - return this.props.value || this.props.default || [] + return this.props.value || this.props.default.slice(1) || [] } changeFont(idx, newValue) { diff --git a/src/config/fontstacks.json b/src/config/fontstacks.json index e9a9081..1b06d02 100644 --- a/src/config/fontstacks.json +++ b/src/config/fontstacks.json @@ -1,5 +1,4 @@ -{ - "Metropolis": [ +[ "Metropolis Black Italic", "Metropolis Black", "Metropolis Bold Italic", @@ -17,9 +16,7 @@ "Metropolis Semi Bold Italic", "Metropolis Semi Bold", "Metropolis Thin Italic", - "Metropolis Thin" - ], - "Open Sans": [ + "Metropolis Thin", "Open Sans Bold Italic", "Open Sans Bold", "Open Sans Extra Bold Italic", @@ -29,13 +26,10 @@ "Open Sans Light", "Open Sans Regular", "Open Sans Semibold Italic", - "Open Sans Semibold" - ], - "Klokantech Noto Sans": [ + "Open Sans Semibold", "Klokantech Noto Sans Bold", "Klokantech Noto Sans CJK Bold", "Klokantech Noto Sans CJK Regular", "Klokantech Noto Sans Italic", "Klokantech Noto Sans Regular" - ] -} +]