├── .prettierrc ├── styles ├── _colors.scss └── globals.scss ├── .eslintrc.json ├── components ├── Grid.module.scss ├── Grid.jsx ├── Intro.module.scss ├── Intro.jsx ├── SettingsBar.module.scss ├── SearchBox.module.scss ├── EmojiCard.module.scss ├── Button.module.scss ├── Button.jsx ├── Header.module.scss ├── EmojiCard.jsx ├── Header.jsx ├── SearchBox.jsx ├── Dropdown.module.scss ├── Dropdown.jsx ├── SelectedEmoji.jsx ├── SelectedEmoji.module.scss └── SettingsBar.jsx ├── next.config.js ├── utils ├── store.js └── getEmojiUrl.js ├── README.md ├── lib └── gtag.js ├── .gitignore ├── package.json └── pages ├── _app.js └── index.js /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /styles/_colors.scss: -------------------------------------------------------------------------------- 1 | $dark-yellow: #ce9223; 2 | $yellow: #ffcc4d; -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /components/Grid.module.scss: -------------------------------------------------------------------------------- 1 | .grid { 2 | display: flex; 3 | flex-wrap: wrap; 4 | align-items: center; 5 | justify-content: center; 6 | gap: 8px; 7 | } -------------------------------------------------------------------------------- /components/Grid.jsx: -------------------------------------------------------------------------------- 1 | import css from './Grid.module.scss' 2 | 3 | export default function Grid({ children }) { 4 | return ( 5 |
6 | {children} 7 |
8 | ) 9 | } -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | images: { 5 | domains: ['cdn.jsdelivr.net'], 6 | }, 7 | } 8 | 9 | module.exports = nextConfig 10 | -------------------------------------------------------------------------------- /components/Intro.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .intro { 4 | text-align: center; 5 | font-weight: 600; 6 | margin: 24px; 7 | 8 | h1 { 9 | font-size: 3em; 10 | color: var(--text); 11 | } 12 | } -------------------------------------------------------------------------------- /components/Intro.jsx: -------------------------------------------------------------------------------- 1 | import css from "./Intro.module.scss"; 2 | 3 | export default function Intro(params) { 4 | return ( 5 |
6 |

Twemoji Cheatsheet

7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /utils/store.js: -------------------------------------------------------------------------------- 1 | import { create } from "zustand"; 2 | 3 | export const useAppSettings = create((set) => ({ 4 | theme: "black", 5 | skinTone: "", 6 | emojiSize: "32", 7 | setTheme: (color) => set({ theme: color }), 8 | setSkinTone: (skin) => set({ skinTone: skin }), 9 | setEmojiSize: (size) => set({ emojiSize: size }), 10 | })); 11 | -------------------------------------------------------------------------------- /components/SettingsBar.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .bar { 4 | display: flex; 5 | flex-direction: column; 6 | margin: 12px 0 32px; 7 | } 8 | 9 | .buttons { 10 | display: flex; 11 | align-items: flex-start; 12 | justify-content: center; 13 | column-gap: 24px; 14 | padding: 16px 24px; 15 | flex-wrap: wrap; 16 | 17 | input { 18 | margin-top: 10px; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /components/SearchBox.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .input { 4 | background-color: var(--input); 5 | color: var(--text); 6 | border: none; 7 | padding: 8px; 8 | outline: solid 2px transparent; 9 | border-radius: 12px; 10 | text-align: center; 11 | max-width: 736px; 12 | width: 100%; 13 | margin: auto; 14 | font-size: 1em; 15 | 16 | &:focus { 17 | outline-color: var(--yellow); 18 | } 19 | } -------------------------------------------------------------------------------- /components/EmojiCard.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .card { 4 | padding: 16px; 5 | border-radius: 40%; 6 | cursor: pointer; 7 | background-color: var(--box); 8 | display: flex; 9 | flex-direction: column; 10 | align-items: center; 11 | justify-content: center; 12 | outline: solid 2px transparent; 13 | 14 | &:hover { 15 | transform: scale(1.1); 16 | } 17 | 18 | &:focus { 19 | outline-color: var(--yellow); 20 | } 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![twemoji](https://user-images.githubusercontent.com/31452340/159780805-2e2b146d-5c50-4245-ba6b-9cc7dcdd9a18.png) 2 | 3 | **Select An Emoji & Copy the Unicode, Download the PNG, SVG or Copy the HEX Code!** 4 | 5 | 6 | ## Have an Idea for Improvement? 🤔 7 | Visit the [Discussions](https://github.com/ShahriarKh/twemoji-cheatsheet/discussions) 8 | Wanna contribute? Fine! PRs are welcome. 9 | 10 | 11 | ## License 📜 12 | Emojis By Twitter's [Twemoji](https://github.com/twitter/twemoji), Licensed Under CC-BY 4.0 13 | -------------------------------------------------------------------------------- /lib/gtag.js: -------------------------------------------------------------------------------- 1 | export const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_ID 2 | 3 | // https://developers.google.com/analytics/devguides/collection/gtagjs/pages 4 | export const pageview = (url) => { 5 | window.gtag('config', GA_TRACKING_ID, { 6 | page_path: url, 7 | }) 8 | } 9 | 10 | // https://developers.google.com/analytics/devguides/collection/gtagjs/events 11 | export const event = ({ action, category, label, value }) => { 12 | window.gtag('event', action, { 13 | event_category: category, 14 | event_label: label, 15 | value: value, 16 | }) 17 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env.local 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # vercel 35 | .vercel 36 | 37 | /emojis 38 | /.vscode -------------------------------------------------------------------------------- /components/Button.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .button { 4 | width: 100%; 5 | height: 2.5em; 6 | border-radius: 8px; 7 | outline: solid 2px transparent; 8 | 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | 13 | 14 | color: black; 15 | background-color: $yellow; 16 | cursor: pointer; 17 | font-size: 0.8em; 18 | font-weight: 700; 19 | text-transform: capitalize; 20 | 21 | &:hover { 22 | opacity: 0.6; 23 | } 24 | 25 | &:focus { 26 | outline-color: $dark-yellow; 27 | } 28 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "twemoji-cheatsheet", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "downshift": "^6.1.12", 13 | "emojibase-data": "^7.0.1", 14 | "fuse.js": "^6.6.2", 15 | "next": "12.1.0", 16 | "react": "17.0.2", 17 | "react-dom": "17.0.2", 18 | "sass": "^1.57.1", 19 | "twemoji": "^14.0.2", 20 | "zustand": "^4.3.7" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.31.0", 24 | "eslint-config-next": "12.1.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /components/Button.jsx: -------------------------------------------------------------------------------- 1 | import css from "./Button.module.scss"; 2 | 3 | export default function Button({ onClick, label, url, className }) { 4 | return ( 5 | <> 6 | {onClick ? ( 7 | 14 | ) : ( 15 | 21 | {label} 22 | 23 | )} 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /components/Header.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .header { 4 | background-color: var(--nav); 5 | padding: 6px 10%; 6 | gap: 8px; 7 | display: flex; 8 | justify-content: space-between; 9 | flex-wrap: wrap; 10 | 11 | color: var(--text); 12 | 13 | p { 14 | text-align: center; 15 | flex: 1 1 240px; 16 | padding: 6px; 17 | font-weight: 600; 18 | font-size: 0.8em; 19 | 20 | &:not(:last-of-type) { 21 | border-right: solid 2px var(--bg); 22 | } 23 | } 24 | 25 | p > a { 26 | transition: all 0.1s; 27 | color: var(--yellow); 28 | outline: none; 29 | border-bottom: solid 2px transparent; 30 | 31 | &:hover, 32 | &:focus { 33 | border-bottom-color: var(--yellow); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /components/EmojiCard.jsx: -------------------------------------------------------------------------------- 1 | import css from "./EmojiCard.module.scss"; 2 | import React, { memo } from "react"; 3 | import Image from "next/image"; 4 | import { getEmojiUrl } from "../utils/getEmojiUrl"; 5 | 6 | // https://gist.github.com/chibicode/fe195d792270910226c928b69a468206?permalink_comment_id=3650172#gistcomment-3650172 7 | 8 | const Twemoji = ({ emoji, size = 24, onClick, skinTone }) => { 9 | return ( 10 |
{ 15 | e.preventDefault(); 16 | if (e.key === "Enter") { 17 | onClick(); 18 | } 19 | }} 20 | > 21 | {emoji.emoji} 22 |
23 | ); 24 | }; 25 | 26 | export default memo(Twemoji); 27 | -------------------------------------------------------------------------------- /utils/getEmojiUrl.js: -------------------------------------------------------------------------------- 1 | export function getEmojiUrl(emoji, skinTone, format = "svg") { 2 | let url; 3 | let folder = "svg"; 4 | let hex = emoji.hexcode; 5 | 6 | if (skinTone && emoji.skins) { 7 | hex = emoji.skins.filter((skin) => skin.hexcode.includes(skinTone))[0] 8 | .hexcode; 9 | } 10 | 11 | let code = hex.toLowerCase(); 12 | 13 | // Fix for "copyright" and "trademark" emojis 14 | if (code.substring(0, 2) == "00") { 15 | code = code.substring(2); 16 | 17 | // Fix for keycap emojis 18 | const regex = /-fe0f/i; 19 | code = code.replace(regex, ""); 20 | } 21 | 22 | // Fix for "Eye in Speech Bubble" emoji 23 | if (code.includes("1f441")) { 24 | const regex = /-fe0f/gi; 25 | code = code.replace(regex, ""); 26 | } 27 | 28 | if (format == "png") { 29 | folder = "72x72"; 30 | } 31 | 32 | url = `https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/${folder}/${code}.${format}`; 33 | 34 | return url; 35 | } 36 | -------------------------------------------------------------------------------- /components/Header.jsx: -------------------------------------------------------------------------------- 1 | import css from "./Header.module.scss"; 2 | 3 | export default function Header() { 4 | return ( 5 |
6 |

7 | 12 | GitHub 13 | {" "} 14 | Repo 15 |

16 |

17 | Created by{" "} 18 | 23 | {" "} 24 | Shahriar Khalvati 25 | 26 |

27 |

28 | Emojis by Twitter's{" "} 29 | 34 | Twemoji 35 | 36 |

37 |
38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /components/SearchBox.jsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import css from "./SearchBox.module.scss"; 3 | import Fuse from "fuse.js"; 4 | 5 | export default function SearchBox({ setAvailabeEmojis, emojis }) { 6 | const fuse = new Fuse(emojis, { 7 | threshold: 0.1, 8 | keys: ["label", "tags", "emoji", "hexcode", "emoticon"], 9 | }); 10 | 11 | const [query, setQuery] = useState(""); 12 | 13 | function handleSearch(query) { 14 | if (query == "") { 15 | setAvailabeEmojis(emojis); 16 | return; 17 | } 18 | let results = fuse.search(query); 19 | let flatResults = Object.keys(results).reduce(function (r, k) { 20 | return r.concat(results[k].item); 21 | }, []); 22 | setAvailabeEmojis(flatResults); 23 | } 24 | 25 | useEffect(() => { 26 | const timeout = setTimeout(() => handleSearch(query), 200); 27 | return () => clearTimeout(timeout); 28 | }, [query, handleSearch]); 29 | 30 | return ( 31 | setQuery(e.target.value)} 35 | placeholder="search by name, emoticon, tags, hexcode..." 36 | /> 37 | ); 38 | } 39 | -------------------------------------------------------------------------------- /components/Dropdown.module.scss: -------------------------------------------------------------------------------- 1 | @use "styles/colors" as *; 2 | 3 | .box { 4 | position: relative; 5 | width: 120px; 6 | } 7 | 8 | $rad: 8px; 9 | 10 | .selector { 11 | composes: button from "./Button.module.scss"; 12 | margin-bottom: 8px; 13 | display: grid; 14 | grid-template-columns: 1fr auto; 15 | align-items: center; 16 | padding: 8px; 17 | height: 3em; 18 | } 19 | 20 | .reset { 21 | background-color: var(--button); 22 | color: var(--text); 23 | } 24 | 25 | .menu { 26 | position: absolute; 27 | min-width: 100%; 28 | width: max-content; 29 | display: flex; 30 | flex-direction: column; 31 | z-index: 1000; 32 | cursor: pointer; 33 | border-radius: $rad; 34 | box-shadow: 0px 1px 4px 2px var(--shadow); 35 | left: 50%; 36 | transform: translate(-50%, 0); 37 | } 38 | 39 | .menu__item { 40 | cursor: pointer; 41 | text-transform: capitalize; 42 | padding: 8px 16px; 43 | font-weight: 600; 44 | border-bottom: solid 1px rgba(0,0,0,0.1); 45 | background-color: var(--box); 46 | color: var(--text); 47 | 48 | &:first-child { 49 | border-radius: $rad $rad 0 0; 50 | } 51 | 52 | &:last-child { 53 | border-radius: 0 0 $rad $rad; 54 | } 55 | 56 | &:hover, &:focus { 57 | background-color: $yellow; 58 | color: black; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /pages/_app.js: -------------------------------------------------------------------------------- 1 | import "../styles/globals.scss"; 2 | import { useEffect } from "react"; 3 | import Script from "next/script"; 4 | import { useRouter } from "next/router"; 5 | import * as gtag from "../lib/gtag"; 6 | 7 | function App({ Component, pageProps }) { 8 | const router = useRouter(); 9 | useEffect(() => { 10 | const handleRouteChange = (url) => { 11 | gtag.pageview(url); 12 | }; 13 | router.events.on("routeChangeComplete", handleRouteChange); 14 | return () => { 15 | router.events.off("routeChangeComplete", handleRouteChange); 16 | }; 17 | }, [router.events]); 18 | 19 | return ( 20 | <> 21 | {/* Global Site Tag (gtag.js) - Google Analytics */} 22 |