From 80efb750f951ed9db964cc735bec1fdeb6ea1c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ken-H=C3=A5vard=20Lieng?= Date: Thu, 30 Mar 2017 04:18:25 +0200 Subject: [PATCH] Rename util.scrollBarWidth() --- assets/bindata.go | 36 +++++++++++++------------- client/src/js/components/MessageBox.js | 10 +++---- client/src/js/util/index.js | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/assets/bindata.go b/assets/bindata.go index 16521f9c..6313d24b 100644 --- a/assets/bindata.go +++ b/assets/bindata.go @@ -90,7 +90,7 @@ func bundleCssGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "bundle.css.gz", size: 2116, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "bundle.css.gz", size: 2116, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -110,7 +110,7 @@ func bundleJsGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "bundle.js.gz", size: 122088, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "bundle.js.gz", size: 122088, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -130,7 +130,7 @@ func configDefaultToml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "config.default.toml", size: 1302, mode: os.FileMode(436), modTime: time.Unix(1490839895, 0)} + info := bindataFileInfo{name: "config.default.toml", size: 1302, mode: os.FileMode(436), modTime: time.Unix(1490840203, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -150,7 +150,7 @@ func fontMontserratBoldTtfGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Bold.ttf.gz", size: 13513, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "font/Montserrat-Bold.ttf.gz", size: 13513, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -170,7 +170,7 @@ func fontMontserratBoldWoff() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Bold.woff", size: 14076, mode: os.FileMode(436), modTime: time.Unix(1490839895, 0)} + info := bindataFileInfo{name: "font/Montserrat-Bold.woff", size: 14076, mode: os.FileMode(436), modTime: time.Unix(1490840203, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -190,7 +190,7 @@ func fontMontserratBoldWoff2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Bold.woff2", size: 9636, mode: os.FileMode(436), modTime: time.Unix(1490839895, 0)} + info := bindataFileInfo{name: "font/Montserrat-Bold.woff2", size: 9636, mode: os.FileMode(436), modTime: time.Unix(1490840204, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -210,7 +210,7 @@ func fontMontserratRegularTtfGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Regular.ttf.gz", size: 13517, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "font/Montserrat-Regular.ttf.gz", size: 13517, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -230,7 +230,7 @@ func fontMontserratRegularWoff() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Regular.woff", size: 14100, mode: os.FileMode(436), modTime: time.Unix(1490839897, 0)} + info := bindataFileInfo{name: "font/Montserrat-Regular.woff", size: 14100, mode: os.FileMode(436), modTime: time.Unix(1490840206, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -250,7 +250,7 @@ func fontMontserratRegularWoff2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/Montserrat-Regular.woff2", size: 9688, mode: os.FileMode(436), modTime: time.Unix(1490839899, 0)} + info := bindataFileInfo{name: "font/Montserrat-Regular.woff2", size: 9688, mode: os.FileMode(436), modTime: time.Unix(1490840208, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -270,7 +270,7 @@ func fontRobotomonoBoldTtfGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Bold.ttf.gz", size: 19877, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Bold.ttf.gz", size: 19877, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -290,7 +290,7 @@ func fontRobotomonoBoldWoff() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Bold.woff", size: 20304, mode: os.FileMode(436), modTime: time.Unix(1490839902, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Bold.woff", size: 20304, mode: os.FileMode(436), modTime: time.Unix(1490840212, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -310,7 +310,7 @@ func fontRobotomonoBoldWoff2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Bold.woff2", size: 16028, mode: os.FileMode(436), modTime: time.Unix(1490839908, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Bold.woff2", size: 16028, mode: os.FileMode(436), modTime: time.Unix(1490840219, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -330,7 +330,7 @@ func fontRobotomonoRegularTtfGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Regular.ttf.gz", size: 19871, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Regular.ttf.gz", size: 19871, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -350,7 +350,7 @@ func fontRobotomonoRegularWoff() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Regular.woff", size: 20316, mode: os.FileMode(436), modTime: time.Unix(1490839909, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Regular.woff", size: 20316, mode: os.FileMode(436), modTime: time.Unix(1490840220, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -370,7 +370,7 @@ func fontRobotomonoRegularWoff2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/RobotoMono-Regular.woff2", size: 16108, mode: os.FileMode(436), modTime: time.Unix(1490839909, 0)} + info := bindataFileInfo{name: "font/RobotoMono-Regular.woff2", size: 16108, mode: os.FileMode(436), modTime: time.Unix(1490840220, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -390,7 +390,7 @@ func fontFontelloTtfGz() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/fontello.ttf.gz", size: 3490, mode: os.FileMode(436), modTime: time.Unix(1490839924, 0)} + info := bindataFileInfo{name: "font/fontello.ttf.gz", size: 3490, mode: os.FileMode(436), modTime: time.Unix(1490840238, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -410,7 +410,7 @@ func fontFontelloWoff() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/fontello.woff", size: 3736, mode: os.FileMode(436), modTime: time.Unix(1490839909, 0)} + info := bindataFileInfo{name: "font/fontello.woff", size: 3736, mode: os.FileMode(436), modTime: time.Unix(1490840220, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -430,7 +430,7 @@ func fontFontelloWoff2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "font/fontello.woff2", size: 3100, mode: os.FileMode(436), modTime: time.Unix(1490839909, 0)} + info := bindataFileInfo{name: "font/fontello.woff2", size: 3100, mode: os.FileMode(436), modTime: time.Unix(1490840220, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/client/src/js/components/MessageBox.js b/client/src/js/components/MessageBox.js index 71e09033..cd2a39ca 100644 --- a/client/src/js/components/MessageBox.js +++ b/client/src/js/components/MessageBox.js @@ -2,9 +2,9 @@ import React, { PureComponent } from 'react'; import { List } from 'react-virtualized/dist/commonjs/List'; import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'; import Message from './Message'; -import { scrollBarWidth } from '../util'; +import { measureScrollBarWidth } from '../util'; -const sbWidth = scrollBarWidth(); +const scrollBarWidth = measureScrollBarWidth(); const listStyle = { padding: '7px 0', boxSizing: 'content-box' }; export default class MessageBox extends PureComponent { @@ -45,9 +45,9 @@ export default class MessageBox extends PureComponent { } // eslint-disable-next-line no-underscore-dangle - const c = this.list.Grid._scrollingContainer; - if (c.scrollHeight > c.clientHeight) { - wrapWidth -= sbWidth; + const container = this.list.Grid._scrollingContainer; + if (container.scrollHeight > container.clientHeight) { + wrapWidth -= scrollBarWidth; } if (this.wrapWidth !== wrapWidth) { diff --git a/client/src/js/util/index.js b/client/src/js/util/index.js index 442a14e9..3e600d53 100644 --- a/client/src/js/util/index.js +++ b/client/src/js/util/index.js @@ -25,7 +25,7 @@ export function stringWidth(str, font) { return ctx.measureText(str).width; } -export function scrollBarWidth() { +export function measureScrollBarWidth() { const outer = document.createElement('div'); outer.style.visibility = 'hidden'; outer.style.width = '100px';