Skip to content

Commit e627c6f

Browse files
committed
fix upload style
1 parent 86c25f1 commit e627c6f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

components/dash-core-components/src/fragments/Upload.react.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export default class Upload extends Component {
6464
style_reject,
6565
style_disabled,
6666
} = this.props;
67+
68+
const activeStyle = className_active ? undefined : style_active;
69+
const disabledStyle = className_disabled ? undefined : style_disabled;
70+
const rejectStyle = className_reject ? undefined : style_reject;
71+
6772
return (
6873
<LoadingElement id={id}>
6974
<Dropzone
@@ -79,9 +84,9 @@ export default class Upload extends Component {
7984
rejectClassName={className_reject}
8085
disabledClassName={className_disabled}
8186
style={style}
82-
activeStyle={style_active}
83-
rejectStyle={style_reject}
84-
disabledStyle={style_disabled}
87+
activeStyle={activeStyle}
88+
rejectStyle={rejectStyle}
89+
disabledStyle={disabledStyle}
8590
>
8691
{children}
8792
</Dropzone>

components/dash-core-components/tests/integration/upload/test_children_accept_any_component.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,23 @@ def test_upca001_upload_children_gallery(dash_dcc):
2828
"textAlign": "center",
2929
},
3030
),
31+
dcc.Upload("upload", disabled=True, className_disabled="upload-disabled", id="upload"),
32+
dcc.Upload("upload", disabled=True, id="upload-no-className")
3133
]
3234
)
3335
dash_dcc.start_server(app)
3436
time.sleep(0.5)
3537
dash_dcc.percy_snapshot("upca001 children gallery")
3638

39+
first_child = dash_dcc.find_element("#upload").find_element_by_css_selector(":first-child")
40+
# Check that there is no default style since className is specified
41+
style = first_child.get_attribute("style")
42+
assert "opacity: 0.5" not in style
43+
44+
first_child = dash_dcc.find_element("#upload-no-className").find_element_by_css_selector(":first-child")
45+
46+
# Check that there is default style since no className is specified
47+
style = first_child.get_attribute("style")
48+
assert "opacity: 0.5" in style
49+
3750
assert dash_dcc.get_logs() == []

0 commit comments

Comments
 (0)