Skip to content

Instantly share code, notes, and snippets.

@trevor-atlas
Created March 17, 2023 20:21
Show Gist options
  • Save trevor-atlas/5eea582ea68faf7a4aa68d1f6ee487bd to your computer and use it in GitHub Desktop.
Save trevor-atlas/5eea582ea68faf7a4aa68d1f6ee487bd to your computer and use it in GitHub Desktop.
// Menu: Icebreaker
// Description: Get a random icebreaker question
// Author: Trevor Atlas
// Twitter: @trevoratlas
import '@johnlindquist/kit';
const dbvalues = await db('icebreakers');
const icebreakers: string[] = dbvalues.data;
const getRandomElement = <T>(arr: T[]) => {
const index = Math.floor(Math.random() * arr.length);
return arr[index];
};
const item = getRandomElement(icebreakers);
await div(
`
<div class="w-full h-full text-center flex items-center justify-center">
<h1 :class="responseClass">${item}</h1>
<div>
`
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment