Replace magic number with constant

pull/10616/head
Alex P 2018-06-14 10:31:20 -07:00
parent 29dc7bb479
commit bda487acb8
2 changed files with 11 additions and 3 deletions

View File

@ -8,7 +8,11 @@ import classnames from 'classnames'
import calculateSize from 'calculate-size'
import DivisionHeader from 'src/shared/components/threesizer/DivisionHeader'
import {HANDLE_VERTICAL, HANDLE_HORIZONTAL} from 'src/shared/constants/index'
import {
HANDLE_VERTICAL,
HANDLE_HORIZONTAL,
MIN_HANDLE_PIXELS,
} from 'src/shared/constants/index'
import {MenuItem} from 'src/shared/components/threesizer/DivisionMenu'
const NOOP = () => {}
@ -156,7 +160,10 @@ class Division extends PureComponent<Props> {
return
}
if (orientation === HANDLE_HORIZONTAL && handlePixels >= 20) {
if (
orientation === HANDLE_HORIZONTAL &&
handlePixels >= MIN_HANDLE_PIXELS
) {
return (
<DivisionHeader
buttons={headerButtons}
@ -168,7 +175,7 @@ class Division extends PureComponent<Props> {
)
}
if (handlePixels >= 20) {
if (handlePixels >= MIN_HANDLE_PIXELS) {
return <div className={this.titleClass}>{name}</div>
}
}

View File

@ -481,6 +481,7 @@ export const HANDLE_VERTICAL = 'vertical'
export const HANDLE_HORIZONTAL = 'horizontal'
export const HANDLE_NONE = 'none'
export const HANDLE_PIXELS = 20
export const MIN_HANDLE_PIXELS = 20
export const MAX_SIZE = 1
export const MIN_SIZE = 0