Skip to content

Commit 0670748

Browse files
author
Cathy Siller
committed
chore(wip): style changes and demo work
1 parent d816116 commit 0670748

File tree

8 files changed

+90
-116
lines changed

8 files changed

+90
-116
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if (document.getElementById('vue-dropZoneDemo')) {
2+
new Vue({
3+
el: '#vue-dropZoneDemo',
4+
methods: {
5+
onDrop: function () {
6+
alert('Unicorn pigeon puppy pop rainbows delight social pop!');
7+
},
8+
},
9+
});
10+
}

docs/components/files/index.html

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,78 @@
66
components/files/test-file-selectors.html: Testing - File Selectors
77
components/files/test-file-tiles.html: Testing - File Tiles
88
components/Icons: Icons
9+
elements/hx-drop-zone: <hx-drop-zone>
910
elements/hx-file-input: <hx-file-input>
1011
elements/hx-file-tile: <hx-file-tile>
1112
---
1213
{% extends 'component.njk' %}
1314
{% block content %}
1415
<section>
15-
<h2 id="basic-drop-zone">Basic Drop Zone</h2>
16+
<h2 id="drop-fence">Drop Fence</h2>
17+
<p class="hxSubBody">Added: v0.14.0</p>
1618
<div class="example">
1719
<div>
18-
<hx-drop-zone>
20+
<div class="hxFence">
21+
<hx-file-icon type="paperclip"></hx-file-icon>
22+
Drop a file here or
23+
<hx-file-input
24+
class="hxTertiary"
25+
label="browse your files">
26+
<input type="file" />
27+
</hx-file-input>
28+
</div>
29+
</div>
30+
31+
<footer>
32+
{% code 'text' %}
1933
<div class="hxFence">
2034
<hx-file-icon type="paperclip"></hx-file-icon>
21-
Drop any .png, .pdf, csv, or
35+
Drop a file here or
2236
<hx-file-input
2337
class="hxTertiary"
2438
label="browse your files">
2539
<input type="file" />
2640
</hx-file-input>
2741
</div>
28-
</hx-drop-zone>
29-
</div>
42+
{% endcode %}
43+
</footer>
3044
</div>
3145
</section>
3246

3347
<section>
34-
<h2 id="fenced-drop-zone">Fenced Drop Zone</h2>
35-
<div class="example">
48+
<h2 id="drop-zone">Drop Zone</h2>
49+
<p class="hxSubBody">Added: v0.14.0</p>
50+
<div class="example" id="vue-dropZoneDemo">
3651
<div>
37-
<hx-drop-zone class="hxFence">
38-
<hx-file-icon type="paperclip"></hx-file-icon>
39-
Drop any .png, .pdf, csv, or
40-
<hx-file-input
41-
class="hxTertiary"
42-
label="browse your files">
43-
<input type="file" />
44-
</hx-file-input>
52+
<hx-drop-zone
53+
@drop="onDrop">
54+
<div class="hxFence">
55+
<hx-file-icon type="paperclip"></hx-file-icon>
56+
Drop a file here or
57+
<hx-file-input
58+
class="hxTertiary"
59+
label="browse your files">
60+
<input type="file" />
61+
</hx-file-input>
62+
</div>
4563
</hx-drop-zone>
4664
</div>
65+
66+
<footer>
67+
{% code 'text' %}
68+
<hx-drop-zone>
69+
<div class="hxFence">
70+
<hx-file-icon type="paperclip"></hx-file-icon>
71+
Drop a file here or
72+
<hx-file-input
73+
class="hxTertiary"
74+
label="browse your files">
75+
<input type="file" />
76+
</hx-file-input>
77+
</div>
78+
</hx-drop-zone>
79+
{% endcode %}
80+
</footer>
4781
</div>
4882
</section>
4983

docs/components/files/test-drop-zone.html

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
---
44
{% extends 'test.njk' %}
55
{% block content %}
6+
<section>
7+
<nav class="hxBreadcrumb">
8+
<a href="components/files">Files</a>
9+
<hx-icon class="delimiter" type="angle-right"></hx-icon>
10+
<a href="#">{{page.title}}</a>
11+
</nav>
12+
</section>
13+
614
<section>
715
<h2>Invisible Drop Zone</h2>
816
<hx-drop-zone>
9-
Invisible Drop Zone
17+
<p>Invisible Drop Zone</p>
1018
</hx-drop-zone>
1119
</section>
1220

@@ -24,27 +32,6 @@ <h2>Visible Drop Zone (file over element)</h2>
2432
</hx-drop-zone>
2533
</section>
2634

27-
<section>
28-
<h2>Fenced Drop Zone</h2>
29-
<hx-drop-zone class="hxFence hxBox hxMd">
30-
Invisible Drop Zone
31-
</hx-drop-zone>
32-
</section>
33-
34-
<section>
35-
<h2>Visible Drop Zone (file not over element)</h2>
36-
<hx-drop-zone class="hxFence hxBox hxMd" drag="away">
37-
Visible Drop Zone (file not over element)
38-
</hx-drop-zone>
39-
</section>
40-
41-
<section>
42-
<h2>Visible Drop Zone (file over element)</h2>
43-
<hx-drop-zone class="hxFence hxBox hxMd" drag="over">
44-
Visible Drop Zone (file over element)
45-
</hx-drop-zone>
46-
</section>
47-
4835
<section>
4936
<h2>Drop Zone with Child Fence</h2>
5037
<hx-drop-zone>

docs/docs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import './components/box/box-demo';
88
import './components/buttons/button-demo';
99
import './components/checkboxes/checkbox-demo';
1010
import './components/choice-tiles/choice-tile-demo';
11+
import './components/files/drop-zone-demo';
1112
import './components/files/file-input-demo';
1213
import './components/files/file-tile-demo';
1314
import './components/icons/icon-demo';

src/helix-ui/elements/HXDropZoneElement.html

Whitespace-only changes.

src/helix-ui/elements/HXDropZoneElement.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ export class HXDropZoneElement extends HXElement {
3535
return this.getAttribute('drag');
3636
}
3737

38+
/** @private */
3839
_isFileDrag (evt) {
3940
return (evt.dataTransfer.types.indexOf('Files') !== -1);
4041
}
4142

4243
// #2 this gets called when the dragged item leaves the document (leaves to a child element or window altogether)
44+
/** @private */
4345
_onDocDragLeave () {
4446
// callback must be an arrow function to preserve "this"
4547
this._docDragLeaveTimeout = window.setTimeout(() => {
@@ -49,6 +51,7 @@ export class HXDropZoneElement extends HXElement {
4951
}
5052

5153
// #1 this handler fires continuously as long as the user is dragging on the page
54+
/** @private */
5255
_onDocDragOver (evt) {
5356
if (!this._isDragging) {
5457
this._isDragging = true;
@@ -60,6 +63,7 @@ export class HXDropZoneElement extends HXElement {
6063
}
6164

6265
// #4 this gets called when the dragged item leaves the zone (leaves to a child element or zone altogether)
66+
/** @private */
6367
_onDragLeave (evt) {
6468
evt.preventDefault();
6569
// callback must be an arrow function to preserve "this"
@@ -70,6 +74,7 @@ export class HXDropZoneElement extends HXElement {
7074
}
7175

7276
// #3 this handler fires continuously as long as the user is dragging on the zone
77+
/** @private */
7378
_onDragOver (evt) {
7479
evt.preventDefault();
7580
if (!this._isZoneDragging) {
@@ -81,10 +86,18 @@ export class HXDropZoneElement extends HXElement {
8186
window.clearTimeout(this._zoneDragLeaveTimeout);
8287
}
8388

89+
drop () {
90+
if (this.$emit('drop')) {
91+
this.remove();
92+
}
93+
}
94+
95+
/** @private */
8496
_onDrop (evt) {
85-
evt.preventDefault();
97+
//evt.preventDefault();
8698
this.removeAttribute('drag');
8799
this._isDragging = false;
88100
this._isZoneDragging = false;
101+
this.drop();
89102
}
90103
}

src/helix-ui/elements/HXDropZoneElement.less

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/helix-ui/styles/elements/hx-drop-zone.less

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1+
@import (reference) 'components/box';
2+
13
hx-drop-zone {
24
display: block;
35
position: relative;
46

5-
/*
6-
// look into how we can do this, bowling?
7-
hx-file-icon {
8-
display: block;
9-
}
10-
*/
11-
127
&::after {
138
border: 4px dashed @cyan-500;
149
content: '';
@@ -33,22 +28,18 @@ hx-drop-zone {
3328
}
3429
}
3530

36-
// move up?
3731
&:not(.hxFence) {
3832
padding: 0 !important;
3933
}
40-
41-
// if drop zone is ALSO a fence
42-
&.hxFence {
43-
&[drag]{
44-
border-color: transparent;
45-
}
46-
}
4734
}
4835

4936
.hxFence {
37+
#Box.md();
5038
border: 1px dashed @gray-600;
5139
font-size: 0.875rem;
52-
//min-height: 6.25rem; //100px
5340
text-align: center;
41+
42+
hx-file-icon {
43+
display: block;
44+
}
5445
}

0 commit comments

Comments
 (0)