Skip to content

Commit ee0d43a

Browse files
authored
Merge pull request #339 from rackerlabs/surf-1383-hx-fence
surf-1383-hx-fence
2 parents 04fa2be + 993d77e commit ee0d43a

File tree

12 files changed

+167
-27
lines changed

12 files changed

+167
-27
lines changed

docs/_data/nav.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
{ label: '<hx-checkbox>', path: 'hx-checkbox' },
7676
{ label: '<hx-disclosure>', path: 'hx-disclosure' },
7777
{ label: '<hx-div>', path: 'hx-div' },
78+
{ label: '<hx-drop-fence>', path: 'hx-drop-fence' },
7879
{ label: '<hx-drop-zone>', path: 'hx-drop-zone' },
7980
{ label: '<hx-error>', path: 'hx-error' },
8081
{ label: '<hx-file-icon>', path: 'hx-file-icon' },

docs/components/files/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
title: Files
33
minver: 0.12.0
44
also:
5+
components/files/test-drop-fences.html: Testing - Drop Fences
56
components/files/test-drop-zones.html: Testing - Drop Zones
67
components/files/test-file-selectors.html: Testing - File Selectors
78
components/files/test-file-tiles.html: Testing - File Tiles
89
components/Icons: Icons
10+
elements/hx-drop-fence: <hx-drop-fence>
911
elements/hx-drop-zone: <hx-drop-zone>
1012
elements/hx-file-input: <hx-file-input>
1113
elements/hx-file-tile: <hx-file-tile>
@@ -26,8 +28,7 @@ <h2 id="drop-zone">Drop Zone</h2>
2628
<div class="example" id="vue-dropZoneDemo">
2729
<div>
2830
<hx-drop-zone @drop.prevent="onDrop">
29-
<div class="hxFence">
30-
<hx-file-icon type="paperclip"></hx-file-icon>
31+
<hx-drop-fence>
3132
<p>
3233
Drop files here or
3334
<hx-file-input
@@ -36,15 +37,14 @@ <h2 id="drop-zone">Drop Zone</h2>
3637
<input type="file" />
3738
</hx-file-input>.
3839
</p>
39-
</div>
40+
</hx-drop-fence>
4041
</hx-drop-zone>
4142
</div>
4243

4344
<footer>
4445
{% code 'html' %}
4546
<hx-drop-zone>
46-
<div class="hxFence">
47-
<hx-file-icon type="paperclip"></hx-file-icon>
47+
<hx-drop-fence>
4848
<p>
4949
Drop files here or
5050
<hx-file-input
@@ -53,7 +53,7 @@ <h2 id="drop-zone">Drop Zone</h2>
5353
<input type="file" />
5454
</hx-file-input>.
5555
</p>
56-
</div>
56+
</hx-drop-fence>
5757
</hx-drop-zone>
5858
{% endcode %}
5959
</footer>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Testing - Drop Fences
3+
---
4+
{% extends 'test.njk' %}
5+
{% 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+
14+
<section>
15+
<h2>Drop Fence (Empty)</h2>
16+
<hx-drop-fence>
17+
</hx-drop-fence>
18+
</section>
19+
20+
<section>
21+
<h2>Drop Fence with Short Plain Text</h2>
22+
<hx-drop-fence>
23+
Test text here
24+
</hx-drop-fence>
25+
</section>
26+
27+
<section>
28+
<h2>Drop Fence with Short Text</h2>
29+
<hx-drop-fence>
30+
<p>Test text here</p>
31+
</hx-drop-fence>
32+
</section>
33+
34+
<section>
35+
<h2>Drop Fence with Short Text and File Selector</h2>
36+
<hx-drop-fence>
37+
<p>
38+
Test text here and
39+
<hx-file-input
40+
class="hxTertiary"
41+
label="file selector here">
42+
<input type="file" />
43+
</hx-file-input>.
44+
</p>
45+
</hx-drop-fence>
46+
</section>
47+
48+
<section>
49+
<h2>Drop Fence with Long Plain Text</h2>
50+
<hx-drop-fence>
51+
Sugar plum cupcake cheesecake jelly-o. Halvah jelly-o sweet roll
52+
topping cotton candy bear claw. Sweet sesame snaps jelly-o cotton
53+
candy carrot cake chocolate bar dragee.
54+
</hx-drop-fence>
55+
</section>
56+
57+
<section>
58+
<h2>Drop Fence with Long Text</h2>
59+
<hx-drop-fence>
60+
<p>
61+
Sugar plum cupcake cheesecake jelly-o. Halvah jelly-o sweet roll
62+
topping cotton candy bear claw. Sweet sesame snaps jelly-o cotton
63+
candy carrot cake chocolate bar dragee.
64+
</p>
65+
</hx-drop-fence>
66+
</section>
67+
{% endblock %}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ <h2>Visible Drop Zone (file over element)</h2>
3535
<section>
3636
<h2>Drop Zone with Child Fence</h2>
3737
<hx-drop-zone>
38-
<div class="hxFence hxBox hxMd">
38+
<hx-drop-fence>
3939
<p>Invisible Drop Zone</p>
40-
</div>
40+
</hx-drop-fence>
4141
</hx-drop-zone>
4242
</section>
4343

4444
<section>
4545
<h2>Visible Drop Zone with Child Fence (file not over element)</h2>
4646
<hx-drop-zone drag="away">
47-
<div class="hxFence hxBox hxMd">
47+
<hx-drop-fence>
4848
<p>Visible Drop Zone (file not over element)</p>
49-
</div>
49+
</hx-drop-fence>
5050
</hx-drop-zone>
5151
</section>
5252

5353
<section>
5454
<h2>Visible Drop Zone with Child Fence (file over element)</h2>
5555
<hx-drop-zone drag="over">
56-
<div class="hxFence hxBox hxMd">
56+
<hx-drop-fence>
5757
<p>Visible Drop Zone (file over element)</p>
58-
</div>
58+
</hx-drop-fence>
5959
</hx-drop-zone>
6060
</section>
6161
{% endblock %}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: <hx-drop-fence>
3+
minver: 0.14.0
4+
also:
5+
components/files: Files
6+
---
7+
{% extends 'element.njk' %}
8+
{% block content %}
9+
<section>
10+
<p>
11+
The custom <code>{{page.title}}</code> element provides a visual
12+
indication to the user that they can drag a file into an area.
13+
</p>
14+
15+
<dl class="hxBox-md metadata hxList">
16+
<div>
17+
<dt>Display</dt>
18+
<dd>block</dd>
19+
</div>
20+
<div>
21+
<dt>Permitted Parents</dt>
22+
<dd>any</dd>
23+
</div>
24+
<div>
25+
<dt>Permitted Children</dt>
26+
<dd>flow content</dd>
27+
</div>
28+
<div>
29+
<dt>Events</dt>
30+
<dd><em>none</em></dd>
31+
</div>
32+
</dl>
33+
</section>
34+
{% endblock %}
35+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div id="hxDropFence">
2+
<hx-file-icon type="paperclip"></hx-file-icon>
3+
<div>
4+
<slot></slot>
5+
</div>
6+
</div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { HXElement } from './HXElement';
2+
import shadowStyles from './HXDropFenceElement.less';
3+
import shadowMarkup from './HXDropFenceElement.html';
4+
5+
/**
6+
* Defines behavior for the `<hx-drop-fence>` element.
7+
*
8+
* @extends HXElement
9+
* @hideconstructor
10+
* @since 0.14.0
11+
*/
12+
export class HXDropFenceElement extends HXElement {
13+
static get is () {
14+
return 'hx-drop-fence';
15+
}
16+
17+
static get template () {
18+
return `<style>${shadowStyles}</style>${shadowMarkup}`;
19+
}
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import "./HXElement";
2+
3+
#hxDropFence {
4+
align-items: center;
5+
display: flex;
6+
flex-direction: column;
7+
height: 100%;
8+
justify-content: center;
9+
width: 100%;
10+
11+
> div {
12+
margin-top: 0.5rem;
13+
max-width: 30rem; // 480px
14+
}
15+
}

src/helix-ui/elements/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export { HXBusyElement } from './HXBusyElement';
55
export { HXCheckboxElement } from './HXCheckboxElement';
66
export { HXDisclosureElement } from './HXDisclosureElement';
77
export { HXDivElement } from './HXDivElement';
8+
export { HXDropFenceElement } from './HXDropFenceElement';
89
export { HXDropZoneElement } from './HXDropZoneElement';
910
export { HXElement } from './HXElement';
1011
export { HXErrorElement } from './HXErrorElement';

src/helix-ui/styles/elements.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@import 'elements/hx-disclosure';
1616
@import 'elements/hx-div';
1717
@import 'elements/hx-dl';
18+
@import 'elements/hx-drop-fence';
1819
@import 'elements/hx-drop-zone';
1920
@import 'elements/hx-error';
2021
@import 'elements/hx-file-icon';

0 commit comments

Comments
 (0)