Skip to content

Instantly share code, notes, and snippets.

@trevor-atlas
Created March 17, 2023 20:19
Show Gist options
  • Save trevor-atlas/d6046979557d87924a7d082eb7cd8638 to your computer and use it in GitHub Desktop.
Save trevor-atlas/d6046979557d87924a7d082eb7cd8638 to your computer and use it in GitHub Desktop.
// Menu: Icebreaker
// Description: Get a random icebreaker question
// Author: Trevor Atlas
// Twitter: @trevor-atlas
import '@johnlindquist/kit';
const dbvalues = await db('icebreakers');
const icebreakers: string[] = dbvalues.data;
const getRandomElement = (arr) => {
const index = Math.floor(Math.random() * arr.length);
const item = arr[index];
return [index, item];
};
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