├── src ├── styles.css ├── components │ ├── App.jsx │ └── Finder.jsx └── index.js ├── README.md ├── public ├── favicon.ico ├── manifest.json └── index.html ├── .gitignore └── package.json /src/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Emoji Finder 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranesh239/emoji-finder/master/public/favicon.ico -------------------------------------------------------------------------------- /src/components/App.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Finder from "./Finder"; 3 | 4 | const App = () => { 5 | return ; 6 | }; 7 | 8 | export default App; 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | 4 | import "./styles.css"; 5 | import App from "./components/App"; 6 | 7 | ReactDOM.render(, document.querySelector("#root")); 8 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.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 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smiley-finder", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "axios": "^0.18.0", 7 | "react": "^16.8.6", 8 | "react-dom": "^16.8.6", 9 | "react-scripts": "3.0.1" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build", 14 | "test": "react-scripts test", 15 | "eject": "react-scripts eject" 16 | }, 17 | "eslintConfig": { 18 | "extends": "react-app" 19 | }, 20 | "browserslist": { 21 | "production": [ 22 | ">0.2%", 23 | "not dead", 24 | "not op_mini all" 25 | ], 26 | "development": [ 27 | "last 1 chrome version", 28 | "last 1 firefox version", 29 | "last 1 safari version" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/components/Finder.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useMemo, useRef } from "react"; 2 | import axios from "axios"; 3 | 4 | const Finder = () => { 5 | const [state, setState] = useState({}); 6 | const ref = useRef(); 7 | 8 | function handleSubmit(e) { 9 | e.preventDefault(); 10 | 11 | setState({ ...state, searchText: ref.current.value }); 12 | } 13 | 14 | function fetchEmoji() { 15 | if (state.searchText) { 16 | const response = axios.get( 17 | `https://www.emojidex.com/api/v1/emoji/${state.searchText}` 18 | ); 19 | return response; 20 | } 21 | } 22 | 23 | useMemo(async () => { 24 | const data = await fetchEmoji(); 25 | setState({ ...state, data: data && data.data }); 26 | }, [state.searchText]); 27 | 28 | return ( 29 | <> 30 |
31 | 32 |
33 | {/* {emoji ? {emoji} : "Enter emoji to search"} */} 34 |
{state.data && state.data.moji}
35 | 36 | ); 37 | }; 38 | 39 | export default Finder; 40 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 22 | React App 23 | 24 | 25 | 26 |
27 | 37 | 38 | 39 | --------------------------------------------------------------------------------