-
Notifications
You must be signed in to change notification settings - Fork 0
/
switcher.html
95 lines (81 loc) · 2.47 KB
/
switcher.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Switcher</title>
<script type="module" src="./layouts.js"></script>
<style>
box-layout {
/* will make the box text centered, due to padding */
max-inline-size: min-content;
}
p {
/* will make the p text centered, due to padding */
max-inline-size: min-content;
border: 4px solid black;
padding: 2ch;
}
</style>
</head>
<body>
<switcher-layout threshold="30rem" space="1rem">
<box-layout>box one</box-layout>
<box-layout>box two</box-layout>
<box-layout>box three</box-layout>
<box-layout>box one</box-layout>
<box-layout>box two</box-layout>
<box-layout>box three</box-layout>
<box-layout>box one</box-layout>
<box-layout>box two</box-layout>
<box-layout>box three</box-layout>
</switcher-layout>
<hr />
<switcher-layout space="10ch">
<p>One</p>
<p>Two</p>
<p>Three</p>
<p>Four</p>
</switcher-layout>
<hr />
<switcher-layout space="2ch" limit="10">
<p>One</p>
<p>Two</p>
<p>Three</p>
<p>Four</p>
<p>Five</p>
<p>Six</p>
</switcher-layout>
<hr />
<switcher-layout>
<box-layout>One</box-layout>
<box-layout>Two</box-layout>
<box-layout>Three</box-layout>
<box-layout>Four</box-layout>
</switcher-layout>
<hr />
<switcher-layout limit="3">
<box-layout>One</box-layout>
<box-layout>Two</box-layout>
<box-layout>Three</box-layout>
<box-layout>Four</box-layout>
<box-layout>Five</box-layout>
<box-layout>Six</box-layout>
</switcher-layout>
</body>
</html>
<!--
Doesn't work: treats the center as a sinle object
<switcher-layout>
<center-layout>
<box-layout>One</box-layout>
<box-layout>Two</box-layout>
<box-layout>Three</box-layout>
<box-layout>Four</box-layout>
</center-layout>
</switcher-layout>
Demo
<switcher-layout threshold="30rem" space="1rem" data-i="Switcher-30rem1rem5">
<box-layout border="" data-i="Box-var(--s1)var(--border-thin)false"></box-layout>
<box-layout border="" data-i="Box-var(--s1)var(--border-thin)false"></box-layout>
<box-layout border="" data-i="Box-var(--s1)var(--border-thin)false"></box-layout>
</switcher-layout>
-->