From fdb36449f33b72511fd8b0601a6fddbdb087d5d5 Mon Sep 17 00:00:00 2001 From: Javi Velasco Date: Sat, 28 May 2016 19:37:46 +0200 Subject: [PATCH] Autoinject styles for ProgressBar --- components/identifiers.js | 1 + components/progress_bar/ProgressBar.js | 43 +++++++++++++------------- components/progress_bar/index.js | 10 +++++- components/progress_bar/readme.md | 11 +++---- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/components/identifiers.js b/components/identifiers.js index 5d44773a..64a10fcf 100644 --- a/components/identifiers.js +++ b/components/identifiers.js @@ -5,4 +5,5 @@ export const BUTTON = 'RTButton'; export const CARD = 'RTCard'; export const CHIP = 'RTChip'; export const INPUT = 'RTInput'; +export const PROGRESS_BAR = 'RTProgressBar'; export const RIPPLE = 'RTRipple'; diff --git a/components/progress_bar/ProgressBar.js b/components/progress_bar/ProgressBar.js index 8d8cc1ab..ac75e355 100644 --- a/components/progress_bar/ProgressBar.js +++ b/components/progress_bar/ProgressBar.js @@ -1,28 +1,29 @@ -import React from 'react'; +import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; import { themr } from 'react-css-themr'; -import prefixer from '../utils/prefixer'; +import { PROGRESS_BAR } from '../identifiers.js'; +import prefixer from '../utils/prefixer.js'; -class ProgressBar extends React.Component { +class ProgressBar extends Component { static propTypes = { - buffer: React.PropTypes.number, - className: React.PropTypes.string, - max: React.PropTypes.number, - min: React.PropTypes.number, - mode: React.PropTypes.oneOf(['determinate', 'indeterminate']), - multicolor: React.PropTypes.bool, - theme: React.PropTypes.shape({ - buffer: React.PropTypes.string, - circle: React.PropTypes.string, - circular: React.PropTypes.string, - indeterminate: React.PropTypes.string, - linear: React.PropTypes.string, - multicolor: React.PropTypes.string, - path: React.PropTypes.string, - value: React.PropTypes.string + buffer: PropTypes.number, + className: PropTypes.string, + max: PropTypes.number, + min: PropTypes.number, + mode: PropTypes.oneOf(['determinate', 'indeterminate']), + multicolor: PropTypes.bool, + theme: PropTypes.shape({ + buffer: PropTypes.string, + circle: PropTypes.string, + circular: PropTypes.string, + indeterminate: PropTypes.string, + linear: PropTypes.string, + multicolor: PropTypes.string, + path: PropTypes.string, + value: PropTypes.string }), - type: React.PropTypes.oneOf(['linear', 'circular']), - value: React.PropTypes.number + type: PropTypes.oneOf(['linear', 'circular']), + value: PropTypes.number }; static defaultProps = { @@ -98,5 +99,5 @@ class ProgressBar extends React.Component { } } -export default themr('ToolboxProgress')(ProgressBar); +export default themr(PROGRESS_BAR)(ProgressBar); export { ProgressBar }; diff --git a/components/progress_bar/index.js b/components/progress_bar/index.js index f9d75e8c..6c4a36d1 100644 --- a/components/progress_bar/index.js +++ b/components/progress_bar/index.js @@ -1 +1,9 @@ -export default from './ProgressBar'; +import { themr } from 'react-css-themr'; +import { PROGRESS_BAR } from '../identifiers.js'; +import { ProgressBar } from './ProgressBar.js'; +import theme from './theme.scss'; + +const ThemedProgressBar = themr(PROGRESS_BAR, theme)(ProgressBar); + +export default ThemedProgressBar; +export { ThemedProgressBar as ProgressBar }; diff --git a/components/progress_bar/readme.md b/components/progress_bar/readme.md index 864c859a..760af9f4 100644 --- a/components/progress_bar/readme.md +++ b/components/progress_bar/readme.md @@ -5,16 +5,17 @@ Minimize visual changes that occur while your app loads content by representing ```jsx import ProgressBar from 'react-toolbox/lib/progress_bar'; -import theme from 'react-toolbox/lib/progress_bar/theme'; const ProgressTest = () => (
- - + +
); ``` +If you want to provide a theme via context, the component key is `RTProgressBar`. + ## Properties | Name | Type | Default | Description| @@ -28,9 +29,7 @@ const ProgressTest = () => ( | `type` | `String` | `linear` | Type of the progress bar, it can be `circular` or `linear`.| | `value` | `Number` | `0` | Value of the current progress.| -## Theming - -You can take a look to the `_config.scss` variables. The themed key for this component is `ToolboxProgress`, it should implement the following interface: +## Theme | Name | Description| |:---------|:-----------|