Created
March 17, 2023 20:19
-
-
Save trevor-atlas/d6046979557d87924a7d082eb7cd8638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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