@adriansteffan/reactive 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{mod-BqHlEEiK.js → mod-fBXh2yt0.js} +119 -112
- package/dist/reactive.es.js +1 -1
- package/dist/reactive.umd.js +15 -15
- package/dist/{web-Dg20aI02.js → web-B1R-GYWu.js} +1 -1
- package/dist/{web-DUk2Ckc5.js → web-DEK1IMF9.js} +1 -1
- package/package.json +1 -1
- package/src/components/quest.tsx +4 -2
- package/src/components/text.tsx +7 -0
- package/src/components/tutorial.tsx +2 -2
package/package.json
CHANGED
package/src/components/quest.tsx
CHANGED
|
@@ -146,9 +146,11 @@ function Quest({
|
|
|
146
146
|
survey.onComplete.add(saveResults);
|
|
147
147
|
|
|
148
148
|
return (
|
|
149
|
-
<div className={`
|
|
149
|
+
<div className={`min-h-screen ${containerClass ?? ''}`}>
|
|
150
150
|
{!containerClass && <div className='absolute inset-0 -z-10 h-full w-full bg-white bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:16px_16px]' />}
|
|
151
|
-
<
|
|
151
|
+
<div className='max-w-4xl mx-auto px-4'>
|
|
152
|
+
<Survey model={survey} />
|
|
153
|
+
</div>
|
|
152
154
|
</div>
|
|
153
155
|
);
|
|
154
156
|
}
|
package/src/components/text.tsx
CHANGED
|
@@ -35,6 +35,10 @@ function Text({
|
|
|
35
35
|
} & BaseComponentProps) {
|
|
36
36
|
const startTimeRef = useRef<number>(0);
|
|
37
37
|
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
window.scrollTo(0, 0);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
38
42
|
useEffect(() => {
|
|
39
43
|
startTimeRef.current = now();
|
|
40
44
|
|
|
@@ -45,6 +49,7 @@ function Text({
|
|
|
45
49
|
allowedKeys === true || (Array.isArray(allowedKeys) && allowedKeys.includes(event.key));
|
|
46
50
|
|
|
47
51
|
if (isKeyAllowed) {
|
|
52
|
+
event.preventDefault();
|
|
48
53
|
const reactionTime = keypressTime - startTimeRef.current;
|
|
49
54
|
|
|
50
55
|
next({
|
|
@@ -95,6 +100,8 @@ function Text({
|
|
|
95
100
|
>
|
|
96
101
|
<button
|
|
97
102
|
onClick={handleClick}
|
|
103
|
+
tabIndex={-1}
|
|
104
|
+
onKeyDown={(e) => { if (e.key === ' ' || e.key === 'Enter') e.preventDefault(); }}
|
|
98
105
|
className='bg-white cursor-pointer px-8 py-3 border-2 border-black font-bold text-black text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none'
|
|
99
106
|
>
|
|
100
107
|
{buttonText}
|
|
@@ -152,8 +152,8 @@ export const Tutorial = ({
|
|
|
152
152
|
useEffect(() => {
|
|
153
153
|
if (nextKey === false && backKey === false) return;
|
|
154
154
|
const onKey = (e: KeyboardEvent) => {
|
|
155
|
-
if (nextKey && e.key === nextKey) goNextIfCan();
|
|
156
|
-
if (backKey && e.key === backKey) goBack();
|
|
155
|
+
if (nextKey && e.key === nextKey) { e.preventDefault(); goNextIfCan(); }
|
|
156
|
+
if (backKey && e.key === backKey) { e.preventDefault(); goBack(); }
|
|
157
157
|
};
|
|
158
158
|
window.addEventListener('keydown', onKey);
|
|
159
159
|
return () => window.removeEventListener('keydown', onKey);
|