radames commited on
Commit
95f19db
β€’
1 Parent(s): 7cdc782
Files changed (1) hide show
  1. frontend/src/routes/index.svelte +11 -4
frontend/src/routes/index.svelte CHANGED
@@ -19,10 +19,15 @@
19
  let completedPrompts: SuccessPrompt[] = [];
20
  let currPromptIndex: number;
21
  onMount(async () => {
 
22
  promptsData = await fetch(apiUrl).then((d) => d.json());
23
  restartBoard();
24
  window.addEventListener('keyup', onKeyup, true);
 
25
  });
 
 
 
26
 
27
  onDestroy(() => {
28
  if (browser) {
@@ -68,7 +73,7 @@
68
  answer = randomPrompt.replace(/_/g, ' ');
69
  imagePaths = promptsData[randomPrompt].slice(0, 6);
70
  const clue = [...answer].map((a) => (Math.random() > 0.5 ? '*' : a)).join('');
71
- console.log("%cCLUE: ","color: red;font-weight:bold", clue);
72
  cols = randomPrompt.length;
73
  timePerTile = totalTime / cols;
74
 
@@ -257,12 +262,14 @@
257
 
258
  <style lang="postcss">
259
  .board {
260
- @apply relative grid gap-1.5 grid-rows-[7] mx-0 my-auto;
261
- --height: min(150px, calc(var(--vh, 100vh) - 310px));
 
262
  height: var(--height);
 
263
  }
264
  .row {
265
- @apply relative grid gap-2;
266
  grid-template-columns: repeat(var(--cols), 1fr);
267
  }
268
 
 
19
  let completedPrompts: SuccessPrompt[] = [];
20
  let currPromptIndex: number;
21
  onMount(async () => {
22
+ onResize();
23
  promptsData = await fetch(apiUrl).then((d) => d.json());
24
  restartBoard();
25
  window.addEventListener('keyup', onKeyup, true);
26
+ window.addEventListener('resize', onResize);
27
  });
28
+ function onResize() {
29
+ document.body.style.setProperty('--vh', window.innerHeight + 'px');
30
+ }
31
 
32
  onDestroy(() => {
33
  if (browser) {
 
73
  answer = randomPrompt.replace(/_/g, ' ');
74
  imagePaths = promptsData[randomPrompt].slice(0, 6);
75
  const clue = [...answer].map((a) => (Math.random() > 0.5 ? '*' : a)).join('');
76
+ console.log('%cCLUE: ', 'color: red;font-weight:bold', clue);
77
  cols = randomPrompt.length;
78
  timePerTile = totalTime / cols;
79
 
 
262
 
263
  <style lang="postcss">
264
  .board {
265
+ @apply relative grid gap-1 mx-auto;
266
+ /* box-sizing: border-box; */
267
+ --height: min(200px, calc(var(--vh, 100vh) - 350px));
268
  height: var(--height);
269
+ width: min(90vw, calc(var(--height) / 7 * var(--cols)));
270
  }
271
  .row {
272
+ @apply relative grid gap-1;
273
  grid-template-columns: repeat(var(--cols), 1fr);
274
  }
275