Skip to content

Commit 75e5a0a

Browse files
committed
Fix styling of Progress. Add bar_style prop
1 parent 4b0fab7 commit 75e5a0a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/components/Progress.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@ import PropTypes from 'prop-types';
33
import {omit} from 'ramda';
44
import {Progress as RSProgress} from 'reactstrap';
55

6+
const CustomProgressTag = props => {
7+
// This is a little trick to enable us to pass styles to the outer div
8+
const {outer_style, style, ...otherProps} = props;
9+
return <div style={outer_style} {...otherProps} />;
10+
};
11+
612
/**
713
* A component for creating progress bars just with CSS. Control the current
814
* progress with a callback and the `value` prop.
915
*/
1016
const Progress = props => {
11-
const {children, loading_state, ...otherProps} = props;
17+
const {children, loading_state, bar_style, style, ...otherProps} = props;
1218
return (
1319
<RSProgress
1420
{...omit(['setProps'], otherProps)}
1521
data-dash-is-loading={
1622
(loading_state && loading_state.is_loading) || undefined
1723
}
24+
// reactstrap handles these inconsistently atm, have to swap around
25+
style={bar_style}
26+
outer_style={style}
27+
tag={CustomProgressTag}
1828
>
1929
{children}
2030
</RSProgress>
@@ -97,6 +107,11 @@ Progress.propTypes = {
97107
*/
98108
barClassName: PropTypes.string,
99109

110+
/**
111+
* Style arguments to pass to the bar.
112+
*/
113+
bar_style: PropTypes.object,
114+
100115
/**
101116
* Object that holds the loading state object coming from dash-renderer
102117
*/

0 commit comments

Comments
 (0)