diff --git a/src/main/index.js b/src/main/index.js index d753094..48580b9 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -17,8 +17,8 @@ if ( isDev = true } -const width = 620 -const height = 440 +const width = 640 +const height = 450 const createWindow = async () => { const isDarkMode = systemPreferences.isDarkMode() diff --git a/src/renderer/components/Ticker.css b/src/renderer/components/Ticker.css index c948813..a74057d 100644 --- a/src/renderer/components/Ticker.css +++ b/src/renderer/components/Ticker.css @@ -1,24 +1,25 @@ .ticker { - justify-content: center; - margin-top: 2rem; - margin-bottom: 2rem; + margin-top: 3rem; + margin-bottom: 4rem; + width: 100%; } .ticker .number-unit { - flex: initial; - margin-top: 1rem; + margin-top: 0; } .ticker button { background: none; border: 1px solid #e2e2e2; box-shadow: none; - margin: 0; + margin: 0 auto; outline: 0; - font-size: .8rem; + font-size: .75rem; border-radius: .3rem; - padding: .2rem .4rem; + padding: .3rem .4rem; display: block; + width: 100%; + max-width: 12rem; transition: border .2s ease-out; color: #41474e; } @@ -33,12 +34,11 @@ } .label--price { - display: inline-block; font-size: .95rem; } .change { - font-size: .7rem; + font-size: .65rem; display: inline-block; margin-left: .25rem; } diff --git a/src/renderer/components/Ticker.jsx b/src/renderer/components/Ticker.jsx index 1c6bb92..412e8fc 100644 --- a/src/renderer/components/Ticker.jsx +++ b/src/renderer/components/Ticker.jsx @@ -11,12 +11,12 @@ const Item = posed.div(fadeIn) const Change = ({ currency }) => ( {({ priceChanges }) => { - let classes = JSON.stringify(priceChanges[currency]).startsWith('+') - ? 'change--positive' - : 'change--negative' + const isNegative = JSON.stringify(priceChanges[currency]).startsWith('-') + let classes = isNegative ? 'change--negative' : 'change--positive' return ( - + + {!isNegative && '+'} {Number(priceChanges[currency]).toFixed(1)}% ) @@ -31,29 +31,14 @@ Change.propTypes = { export default class Ticker extends PureComponent { static contextType = AppContext - items = activeStyle => - // convert Map to array first, cause for...of or forEach returns undefined, - // so it cannot be mapped to a collection of elements - [...this.context.prices.entries()].map(([key, value]) => ( - - - - )) - - render() { - const { accentColor } = this.context + items = () => { + const { + prices, + needsConfig, + currency, + toggleCurrencies, + accentColor + } = this.context const activeStyle = { backgroundColor: accentColor, @@ -61,9 +46,29 @@ export default class Ticker extends PureComponent { borderColor: accentColor } + // convert Map to array first, cause for...of or forEach returns undefined, + // so it cannot be mapped to a collection of elements + return [...prices.entries()].map(([key, value]) => ( + + + + )) + } + + render() { return ( -