learningtribes-studio-frontend 1.4.2-alpha.2 → 1.4.2-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common.min.css +1 -1
- package/dist/common.min.js +1 -1
- package/dist/common.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AssetsDropZone/AssetsDropZone.scss +8 -17
- package/src/components/AssetsDropZone/AssetsDropZone.test.jsx +2 -2
- package/src/components/AssetsDropZone/index.jsx +18 -15
package/package.json
CHANGED
|
@@ -44,9 +44,16 @@ $upload-icon: #4c4c8e;
|
|
|
44
44
|
font-size: 32px;
|
|
45
45
|
width: 32px;
|
|
46
46
|
height: 32px;
|
|
47
|
-
line-height: 32px;
|
|
48
47
|
color: $upload-icon;
|
|
49
48
|
margin-bottom: 8px;
|
|
49
|
+
line-height: 1;
|
|
50
|
+
|
|
51
|
+
i {
|
|
52
|
+
font-size: 32px;
|
|
53
|
+
line-height: 1;
|
|
54
|
+
display: block;
|
|
55
|
+
font-style: normal;
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
.upload-prompt {
|
|
@@ -56,24 +63,8 @@ $upload-icon: #4c4c8e;
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
.upload-prompt-primary {
|
|
59
|
-
background: none;
|
|
60
|
-
border: none;
|
|
61
66
|
color: $upload-prompt-primary;
|
|
62
|
-
font-size: 16px;
|
|
63
|
-
font-weight: 600;
|
|
64
67
|
cursor: pointer;
|
|
65
|
-
padding: 0;
|
|
66
|
-
|
|
67
|
-
&:hover,
|
|
68
|
-
&:focus {
|
|
69
|
-
color: $upload-prompt-primary;
|
|
70
|
-
text-decoration: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&:focus {
|
|
74
|
-
outline: 2px solid rgba(89, 89, 235, 0.5);
|
|
75
|
-
outline-offset: 2px;
|
|
76
|
-
}
|
|
77
68
|
}
|
|
78
69
|
|
|
79
70
|
.upload-prompt-secondary {
|
|
@@ -27,7 +27,7 @@ describe('<AssetsDropZone />', () => {
|
|
|
27
27
|
|
|
28
28
|
describe('renders', () => {
|
|
29
29
|
it('contains file browser button', () => {
|
|
30
|
-
expect(wrapper.find('button').text()).toEqual('Click to upload');
|
|
30
|
+
expect(wrapper.find('[data-identifier="asset-drop-zone-browse-button"]').text()).toEqual('Click to upload');
|
|
31
31
|
});
|
|
32
32
|
it('hides the icon & upload file size from screen readers', () => {
|
|
33
33
|
expect(wrapper.find('[aria-hidden=true]').length).toBe(2);
|
|
@@ -85,7 +85,7 @@ describe('<AssetsDropZone />', () => {
|
|
|
85
85
|
const mockDropZoneOpen = jest.fn();
|
|
86
86
|
wrapper.instance().dropZoneRef.open = mockDropZoneOpen;
|
|
87
87
|
|
|
88
|
-
const button = wrapper.find('
|
|
88
|
+
const button = wrapper.find('[data-identifier="asset-drop-zone"]');
|
|
89
89
|
button.simulate('click');
|
|
90
90
|
expect(mockDropZoneOpen).toBeCalled();
|
|
91
91
|
});
|
|
@@ -32,11 +32,15 @@ export default class AssetsDropZone extends React.Component {
|
|
|
32
32
|
|
|
33
33
|
setDropZoneRef = (ref) => {
|
|
34
34
|
this.dropZoneRef = ref;
|
|
35
|
+
if (this.props.buttonRef) {
|
|
36
|
+
this.props.buttonRef(ref ? ref.node : null);
|
|
37
|
+
}
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
+
handleKeyDown = (event) => {
|
|
41
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
this.handleClick();
|
|
40
44
|
}
|
|
41
45
|
};
|
|
42
46
|
|
|
@@ -53,35 +57,34 @@ export default class AssetsDropZone extends React.Component {
|
|
|
53
57
|
<Dropzone
|
|
54
58
|
accept={this.props.acceptedFileTypes}
|
|
55
59
|
activeClassName={styles['drop-active']}
|
|
60
|
+
aria-describedby="asset-drop-zone-max-file-size-label"
|
|
56
61
|
className={classNames([
|
|
57
62
|
this.props.compactStyle ? styles['drop-zone-compact'] : styles['drop-zone'],
|
|
58
63
|
])}
|
|
59
64
|
data-identifier="asset-drop-zone"
|
|
60
65
|
maxSize={this.dropZoneMaxFileSizeBytes}
|
|
61
66
|
onDrop={this.onDrop}
|
|
67
|
+
onKeyDown={this.handleKeyDown}
|
|
62
68
|
ref={this.setDropZoneRef}
|
|
69
|
+
role="button"
|
|
70
|
+
tabIndex="0"
|
|
63
71
|
>
|
|
64
|
-
<
|
|
72
|
+
<div
|
|
65
73
|
aria-hidden="true"
|
|
66
|
-
className={
|
|
74
|
+
className={styles['upload-icon']}
|
|
67
75
|
data-identifier="asset-drop-zone-icon"
|
|
68
|
-
|
|
76
|
+
>
|
|
77
|
+
<i className="far fa-images" />
|
|
78
|
+
</div>
|
|
69
79
|
<div className={styles['upload-prompt']}>
|
|
70
80
|
<WrappedMessage message={messages.assetsDropZoneBrowseLabel} >
|
|
71
81
|
{ displayText => (
|
|
72
|
-
<
|
|
73
|
-
type="button"
|
|
74
|
-
aria-describedby="asset-drop-zone-max-file-size-label"
|
|
82
|
+
<span
|
|
75
83
|
className={styles['upload-prompt-primary']}
|
|
76
84
|
data-identifier="asset-drop-zone-browse-button"
|
|
77
|
-
onClick={(event) => {
|
|
78
|
-
event.stopPropagation();
|
|
79
|
-
this.handleClick();
|
|
80
|
-
}}
|
|
81
|
-
ref={this.setUploadButtonRef}
|
|
82
85
|
>
|
|
83
86
|
{displayText}
|
|
84
|
-
</
|
|
87
|
+
</span>
|
|
85
88
|
)}
|
|
86
89
|
</WrappedMessage>
|
|
87
90
|
<WrappedMessage message={messages.assetsDropZoneHeader}>
|