Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit c9a491b

Browse files
author
steven.roulleau
committed
fix(examples): update for mobile
1 parent f461c0c commit c9a491b

File tree

4 files changed

+107
-17
lines changed

4 files changed

+107
-17
lines changed

build/docs/src/demo-app/examples/non-version-specific/customize_style.html

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
}
3030

3131
#prompter-css {
32-
height: 110px;
3332
width: 70%;
3433
margin-left: 36px;
3534
padding: 24px;
@@ -38,25 +37,48 @@
3837
z-index: 30;
3938
border-radius: 6px;
4039
background: rgba(240, 240, 240, 0.9);
40+
opacity: 1;
41+
transition: opacity .2s ease-out;
42+
}
43+
44+
#prompter-css.hide {
45+
opacity: 0;
4146
}
4247

4348
.hidden {
4449
display: none;
4550
}
4651

4752
myscript-math-web {
48-
height: calc(100% - 60px);
53+
height: calc(100% - 64px);
4954
}
5055

51-
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
52-
myscript-math-web {
53-
height: calc(100vh - 200px);
54-
}
56+
.toggle-opt {
57+
display: none;
58+
}
5559

60+
.show {
61+
color: #90A4AE;
62+
cursor: pointer;
63+
position: absolute;
64+
right: 1vh;
65+
top: 1vw;
66+
}
67+
68+
@media only screen and (min-width: 320px) and (max-width: 820px){
5669
#prompter-css {
5770
position: fixed;
5871
bottom: 12px;
5972
}
73+
.toggle-opt {
74+
display: flex;
75+
justify-content: center;
76+
}
77+
.nav-style {
78+
overflow: hidden;
79+
max-height: 0;
80+
transition: max-height .2s ease-out;
81+
}
6082
}
6183
</style>
6284

@@ -65,8 +87,11 @@
6587
<script type="module" src="../../../../node_modules/@polymer/paper-toggle-button/paper-toggle-button.js"></script>
6688
<script type="module" src="../../../../node_modules/@polymer/paper-swatch-picker/paper-swatch-picker.js"></script>
6789
<script type="module" src="../../../../node_modules/@polymer/paper-slider/paper-slider.js"></script>
90+
<script type="module" src="../../../../node_modules/@polymer/iron-icon/iron-icon.js"></script>
91+
<script type="module" src="../../../../node_modules/@polymer/iron-icons/iron-icons.js"></script>
6892
<script type="module" src="../../../../myscript-math-web.js"></script>
6993

94+
7095
</head><custom-style>
7196
<style>
7297
myscript-math-web {
@@ -91,6 +116,9 @@
91116

92117

93118

119+
<div class="toggle-opt">
120+
<iron-icon class="show" icon="icons:settings"></iron-icon>
121+
</div>
94122
<nav class="nav-style">
95123
<paper-toggle-button class="flex-item" id="penstyleclasses" checked="">Apply pen style classes (greenThickPen)
96124
</paper-toggle-button>
@@ -139,9 +167,14 @@
139167
const penColor = document.querySelector('#pencolor');
140168
const penWidth = document.querySelector('#penwidth');
141169
const penStyleClasses = document.querySelector('#penstyleclasses');
170+
const prompterCss = document.getElementById('prompter-css');
142171
const prompterText = document.getElementById('prompter-css-text');
143172

144173
function updatePrompter(values) {
174+
if (prompterCss.classList.contains('hide')) {
175+
prompterCss.classList.toggle('hide');
176+
}
177+
145178
prompterText.innerText = '';
146179
values.forEach(function (value) {
147180
prompterText.innerText += `${value[0]} = ${JSON.stringify(value[1])} \n`;
@@ -187,6 +220,20 @@
187220
component.penstyleclasses = '';
188221
updatePrompter([['component.penstyleclasses', '']]);
189222
}
223+
});
224+
document.querySelector('.show').addEventListener('click', () => {
225+
const content = document.querySelector('.nav-style');
226+
227+
if (content.style.maxHeight) {
228+
content.style.maxHeight = null;
229+
} else {
230+
content.style.maxHeight = content.scrollHeight + "px";
231+
}
232+
});
233+
window.addEventListener('load', () => {
234+
setTimeout(() => {
235+
prompterCss.classList.toggle('hide');
236+
}, 1500);
190237
});</script>
191238

192239

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"license": "Apache-2.0",
2323
"homepage": "https://myscript.github.io/myscript-math-web/components/myscript-math-web/",
2424
"dependencies": {
25+
"@polymer/iron-icons": "^3.0.1",
2526
"@polymer/polymer": "^3.1.0",
2627
"@webcomponents/webcomponentsjs": "^2.2.1",
2728
"katex": "^0.8.3",

src/demo-app/examples/non-version-specific/customize_style.html

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
}
3333

3434
#prompter-css {
35-
height: 110px;
3635
width: 70%;
3736
margin-left: 36px;
3837
padding: 24px;
@@ -41,25 +40,48 @@
4140
z-index: 30;
4241
border-radius: 6px;
4342
background: rgba(240, 240, 240, 0.9);
43+
opacity: 1;
44+
transition: opacity .2s ease-out;
45+
}
46+
47+
#prompter-css.hide {
48+
opacity: 0;
4449
}
4550

4651
.hidden {
4752
display: none;
4853
}
4954

5055
myscript-math-web {
51-
height: calc(100% - 60px);
56+
height: calc(100% - 64px);
5257
}
5358

54-
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
55-
myscript-math-web {
56-
height: calc(100vh - 200px);
57-
}
59+
.toggle-opt {
60+
display: none;
61+
}
5862

63+
.show {
64+
color: #90A4AE;
65+
cursor: pointer;
66+
position: absolute;
67+
right: 1vh;
68+
top: 1vw;
69+
}
70+
71+
@media only screen and (min-width: 320px) and (max-width: 820px){
5972
#prompter-css {
6073
position: fixed;
6174
bottom: 12px;
6275
}
76+
.toggle-opt {
77+
display: flex;
78+
justify-content: center;
79+
}
80+
.nav-style {
81+
overflow: hidden;
82+
max-height: 0;
83+
transition: max-height .2s ease-out;
84+
}
6385
}
6486
</style>
6587

@@ -68,8 +90,11 @@
6890
<script type="module" src="../../../../node_modules/@polymer/paper-toggle-button/paper-toggle-button.js"></script>
6991
<script type="module" src="../../../../node_modules/@polymer/paper-swatch-picker/paper-swatch-picker.js"></script>
7092
<script type="module" src="../../../../node_modules/@polymer/paper-slider/paper-slider.js"></script>
93+
<script type="module" src="../../../../node_modules/@polymer/iron-icon/iron-icon.js"></script>
94+
<script type="module" src="../../../../node_modules/@polymer/iron-icons/iron-icons.js"></script>
7195
<script type="module" src="../../../../myscript-math-web.js"></script>
7296

97+
7398
<custom-style>
7499
<style>
75100
myscript-math-web {
@@ -94,6 +119,9 @@
94119
</head>
95120

96121
<body>
122+
<div class="toggle-opt">
123+
<iron-icon class="show" icon="icons:settings"></iron-icon>
124+
</div>
97125
<nav class="nav-style">
98126
<paper-toggle-button class="flex-item" id="penstyleclasses" checked>Apply pen style classes (greenThickPen)
99127
</paper-toggle-button>
@@ -153,9 +181,13 @@
153181
const penColor = document.querySelector('#pencolor');
154182
const penWidth = document.querySelector('#penwidth');
155183
const penStyleClasses = document.querySelector('#penstyleclasses');
184+
const prompterCss = document.getElementById('prompter-css');
156185
const prompterText = document.getElementById('prompter-css-text');
157186

158187
function updatePrompter(values) {
188+
if(prompterCss.classList.contains('hide')) {
189+
prompterCss.classList.toggle('hide');
190+
}
159191
prompterText.innerText = '';
160192
values.forEach(function (value) {
161193
prompterText.innerText += `${value[0]} = ${JSON.stringify(value[1])} \n`;
@@ -205,6 +237,21 @@
205237
updatePrompter([['component.penstyleclasses', '']]);
206238
}
207239
});
240+
241+
document.querySelector('.show').addEventListener('click', () => {
242+
const content = document.querySelector('.nav-style');
243+
if (content.style.maxHeight){
244+
content.style.maxHeight = null;
245+
} else {
246+
content.style.maxHeight = content.scrollHeight + "px";
247+
}
248+
});
249+
250+
window.addEventListener('load', () => {
251+
setTimeout(() => {
252+
prompterCss.classList.toggle('hide');
253+
}, 1500);
254+
});
208255
</script>
209256
</body>
210257

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy