-
Notifications
You must be signed in to change notification settings - Fork 0
/
example1.html
111 lines (106 loc) · 2.35 KB
/
example1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html>
<head>
<title>Example 1: Kanban UI</title>
<style>
/**
* Generic styles
*/
* {
box-sizing: border-box;
}
.center-contents {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
/**
* Make sure the elements are seen.
*/
dragdrop-container {
min-height: 2em;
}
dragdrop-child {
width: 100%;
aspect-ratio: 1/1;
background-color: #eee;
}
/**
* Layout code
*/
.grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 10px;
width: 900px;
}
/**
* Look and feel styles
*/
dragdrop-container {
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
gap: 10px;
padding: 10px;
}
dragdrop-container {
border: 1px solid rgba(0, 0, 0, 0.1);
}
dragdrop-container:nth-child(5n+1) {
background-color: red;
}
dragdrop-container:nth-child(5n+2) {
background-color: blue;
}
dragdrop-container:nth-child(5n+3) {
background-color: green;
}
dragdrop-container:nth-child(5n+4) {
background-color: yellow;
}
dragdrop-container:nth-child(5n+5 ) {
background-color: purple;
}
.hint {
background-color: rgba(216, 112, 147, 0.3);
font-size: 0.6em;
width: 100%;
padding: 1em;
min-height: 60px;
text-align: right;
aspect-ratio: none;
}
/**
* Make the nested dragdrop-container fills the parent (dragdrop-child).
*/
dragdrop-child {
display: flex;
flex-direction: column;
}
dragdrop-child > dragdrop-container {
min-height: 100px;
}
</style>
<script type="module" src="../dist/dragdrop-components.js" defer></script>
</head>
<body>
<div class="grid">
<dragdrop-container>
<dragdrop-child class="center-contents">Child 1</dragdrop-child>
<dragdrop-child handle="top-right" class="center-contents">Child 2</dragdrop-child>
<dragdrop-child class="center-contents">Child 3</dragdrop-child>
</dragdrop-container>
<dragdrop-container>
<dragdrop-child handle="top-left">
<div class="hint">↓ Can drop here ↓</div>
<dragdrop-container style="background-color: palevioletred"></dragdrop-container>
</dragdrop-child>
</dragdrop-container>
<dragdrop-container></dragdrop-container>
<dragdrop-container></dragdrop-container>
</div>
</body>
</html>