Skip to content

Commit de87561

Browse files
author
Philip Weiss
committed
begin cleaning up css
1 parent 5ecf6e1 commit de87561

File tree

3 files changed

+27
-34
lines changed

3 files changed

+27
-34
lines changed

src/DefaultHandle.jsx

+15-31
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import PropTypes from 'prop-types';
33
import { forbidExtraProps } from 'airbnb-prop-types';
44
import { withStyles, withStylesPropTypes } from 'react-with-styles';
55

6-
import {
7-
DEFAULT_HANDLE_WIDTH_UNITS,
8-
BACKGROUND_HEIGHT_UNITS,
9-
VERTICAL,
10-
} from './constants/SliderConstants';
6+
import { VERTICAL } from './constants/SliderConstants';
117

128
import handlePropTypes, { handleDefaultProps } from './propTypes/HandlePropTypes';
139

@@ -52,10 +48,10 @@ DefaultHandle.propTypes = propTypes;
5248

5349
DefaultHandle.defaultProps = defaultProps;
5450

55-
export default withStyles(({ color, unit }) => ({
51+
export default withStyles(({ color, unit, constants }) => ({
5652
DefaultHandle_handle: {
57-
width: DEFAULT_HANDLE_WIDTH_UNITS * 3.8 * unit,
58-
height: DEFAULT_HANDLE_WIDTH_UNITS * 3.8 * unit,
53+
width: 2 * constants.DEFAULT_HANDLE_WIDTH * unit,
54+
height: 2 * constants.DEFAULT_HANDLE_WIDTH * unit,
5955
borderWidth: 1,
6056
borderStyle: 'solid',
6157
borderColor: color.grey,
@@ -65,7 +61,7 @@ export default withStyles(({ color, unit }) => ({
6561
zIndex: 2,
6662
boxShadow: `0 ${unit / 4}px ${unit / 4}px ${color.textDisabled}`,
6763
':focus': {
68-
boxShadow: `${color.focus} 0 0 2px 2px`,
64+
boxShadow: `${color.teal} 0 0 1px 1px`,
6965
},
7066

7167
':after': {
@@ -99,33 +95,21 @@ export default withStyles(({ color, unit }) => ({
9995
width: 1,
10096
left: 13,
10197
},
102-
103-
background: {
104-
borderRadius: 15,
105-
},
10698
},
10799

108100
DefaultHandle_handle__vertical: {
109-
marginTop: -(DEFAULT_HANDLE_WIDTH_UNITS * 1.9) * unit,
110-
left: ((BACKGROUND_HEIGHT_UNITS * 1.9) - (DEFAULT_HANDLE_WIDTH_UNITS * 1.9)) * unit,
111-
progress: {
112-
left: 2,
113-
width: 13,
114-
},
115-
handle: {
116-
left: -5,
117-
marginTop: -12,
101+
marginTop: -(constants.DEFAULT_HANDLE_WIDTH) * unit,
102+
left: (constants.BACKGROUND_HEIGHT - constants.DEFAULT_HANDLE_WIDTH) * unit,
118103

119-
':before': {
120-
top: 10,
121-
},
104+
':before': {
105+
top: 10,
106+
},
122107

123-
':after': {
124-
top: 13,
125-
left: 8,
126-
height: 1,
127-
width: 10,
128-
},
108+
':after': {
109+
top: 13,
110+
left: 8,
111+
height: 1,
112+
width: 10,
129113
},
130114
},
131115

src/constants/SliderConstants.js

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ export const KEYS = {
1212
export const PERCENT_EMPTY = 0;
1313
export const PERCENT_FULL = 100;
1414
export const DEFAULT_STEP = 1;
15-
export const BACKGROUND_HEIGHT_UNITS = 0.5;
16-
export const DEFAULT_HANDLE_WIDTH_UNITS = 0.8;
1715
export const HORIZONTAL = 'horizontal';
1816
export const VERTICAL = 'vertical';

src/themes/DefaultTheme.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
const DefaultTheme = {
22
unit: 8,
3-
responsive: {},
3+
4+
responsive: {
5+
mediumAndAbove: '@media (min-width: 744px)',
6+
largeAndAbove: '@media (min-width: 1128px)',
7+
},
8+
9+
constants: {
10+
DEFAULT_HANDLE_WIDTH: 1.5,
11+
BACKGROUND_HEIGHT: 0.25,
12+
},
13+
414
color: {
515
black: 'black',
616
white: '#fcfcfc',
717
grey: '#d8d8d8',
818
teal: '#abc4e8',
19+
textDisabled: '#DBDBDB',
920

1021
buttons: {
1122
defaultDisabledColor: 'blue',

0 commit comments

Comments
 (0)