Skip to content

Instantly share code, notes, and snippets.

@bersling
Last active May 25, 2023 21:29
Show Gist options
  • Save bersling/ebe95f7918b3169b3d36b0b13272daf9 to your computer and use it in GitHub Desktop.
Save bersling/ebe95f7918b3169b3d36b0b13272daf9 to your computer and use it in GitHub Desktop.
EmojiLetter for Mobile
<script lang="ts">
import { Capacitor } from '@capacitor/core';
let emojis = [
'πŸ˜€',
'πŸ˜ƒ',
'πŸ˜„',
'😁',
'πŸ˜†',
'πŸ˜…',
'πŸ˜‚',
'🀣',
'😊',
'πŸ˜‡',
'πŸ™‚',
'πŸ™ƒ',
'πŸ˜‰',
'😌',
'😍',
'😘',
'πŸ˜—',
'πŸ˜™',
'😚',
'πŸ˜‹',
'πŸ˜›',
'😜',
'😝',
'😎',
'🀩',
'πŸ₯³',
'πŸ€—',
'πŸ™ˆ',
'πŸ™‰',
'πŸ™Š',
'πŸ’‹',
'πŸ’Œ',
'πŸ’˜',
'πŸ’',
'πŸ’–',
'πŸ’—',
'πŸ’“',
'πŸ’ž',
'πŸ’•',
'πŸ’Ÿ',
'❣️',
'πŸ’”',
'❀️',
'🧑',
'πŸ’›',
'πŸ’š',
'πŸ’™',
'πŸ’œ',
'🀎',
'πŸ–€',
'🀍',
'πŸ’―',
'πŸ’’',
'πŸ’₯',
'πŸ’«',
'πŸ’¦',
'πŸ’¨',
'πŸ•³οΈ',
'πŸ’£',
'πŸ’¬',
'πŸ—¨οΈ',
'πŸ—―οΈ',
'πŸ’­',
'πŸ’€',
'πŸ‘‹',
'🀚',
'πŸ–οΈ',
'βœ‹',
'πŸ––',
'πŸ‘Œ',
'🀏',
'✌️',
'🀞',
'🀟',
'🀘',
'πŸ€™',
'πŸ‘ˆ',
'πŸ‘‰',
'πŸ‘†',
'πŸ–•',
'πŸ‘‡',
'☝️',
'πŸ‘',
'πŸ‘Ž',
'✊',
'πŸ‘Š',
'πŸ€›',
'🀜',
'πŸ‘',
'πŸ™Œ',
'πŸ‘',
'🀲',
'🀝',
'πŸ™',
'✍️',
'πŸ’…',
'🀳',
'πŸ’ͺ',
'🦾',
'🦿',
'🦡',
'🦢',
'πŸ‘‚',
'🦻',
'πŸ‘ƒ',
'🧠',
'🦷',
'🦴',
'πŸ‘€',
'πŸ‘οΈ',
'πŸ‘…',
'πŸ‘„',
'✨',
'🌟',
'πŸ’«',
'πŸ’₯',
'πŸ”₯',
'πŸŒͺ️',
'🌈',
'πŸ’˜'
];
let isIos = Capacitor.getPlatform() === 'ios';
let emojiRows = [
['❓', '❓', '❓'],
['❓', '❓', '❓'],
['❓', '❓', '❓']
];
const selectRandomEmoji = (row: number, col: number) => () => {
emojiRows[row][col] = emojis[Math.floor(Math.random() * emojis.length)];
};
</script>
<div class="container">
<div class="board">
{#each emojiRows as emojiRow, row}
{#each emojiRow as emoji, col}
<button on:click={selectRandomEmoji(row, col)} class="emoji-button {isIos ? 'ios' : ''}">
{emoji}
</button>
{/each}
{/each}
</div>
</div>
<style>
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
flex-direction: column;
}
.board {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
width: min(90vw, 90vh);
height: min(90vw, 90vh);
}
.emoji-button {
background: white;
border-radius: 3%;
border: none;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
cursor: pointer;
text-decoration: none;
outline: none;
width: 95%;
height: 95%;
font-size: min(20vw, 20vh);
}
.emoji-button.ios {
font-size: 35px;
}
.emoji-button:hover {
background: #fbfbfb;
}
.emoji-button:active {
background: #fbfbfb;
box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 3px;
outline: none;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment