Coder Social home page Coder Social logo

vito-mohagheghian / react-customizable-emojibox Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 13.59 MB

Easy customizable emojibox component for react applications created by vito.mohagheghian

License: GNU General Public License v3.0

JavaScript 86.15% CSS 7.39% SCSS 6.46%
npm-package react eslint prettier styled-components webpack yarn emtions material-ui

react-customizable-emojibox's Introduction

react-customizable-emojibox

easy customizable emojibox component for react applications created by vito.mohagheghian

Demo

Preview

Live Demo

Install

npm install react-customizable-emojibox

or

yarn add react-customizable-emojibox

Usage

import React, { useState, useRef } from 'react'

import EmojiBox from 'react-customizable-emojibox'
import 'react-customizable-emojibox/dist/index.css'

const Example = () => {
  const [emoji, setEmoji] = useState(false)

  const emojiHandler = () => {
    setEmoji((prevValue) => !prevValue)
  }

  const inputRef = useRef(null)

  const EmojiClickedHandler = (char) => {
    inputRef.current.value += char
  }

  return (
    <div>
      <input type='text' placeholder='type a messege' ref={inputRef} />
      <div className='emoji-container'>
        <button onClick={emojiHandler} className='emoji_button'>
          emoji
        </button>
        <EmojiBox
          visibility={emoji}
          setVisibility={setEmoji}
          EmojiClickedHandler={EmojiClickedHandler}
        />
      </div>
    </div>
  )
}

export default Example

Accepted props

Name Type Default Value Required? Description
className className undefined No Help you to customize it easily.
theme Object GlassTheme No some predesigned themes which I explained in next part
visibility Boolean false Yes state that manage package display
setVisibility Function undefined Yes function of visibility useState
EmojiClickedHandler Function undefined Yes run on clicking emoji
style Object undefined No like regular style

Theme Prop useage

First, you have to import you intended theme from package.

import { DarkTheme } from 'react-customizable-emojibox'

themes you import are: DarkTheme - LightTheme - GlassTheme - MaterialTheme

after that you just have set theme prop with the value of imported theme.

Preview

Responsive

for make package responsive you have use className prop which is like regular className, and with @media make it resposive.

FAQ

How to change emojibox position?

use className prop and use transform: transalte(X%, Y%) in your css file.

can I have new theme?

yes, as its name you can customize it, or email me to make new theme.

License

MIT © vito-mohagheghian

react-customizable-emojibox's People

Contributors

vito-mohagheghian avatar

Stargazers

Shalaahuddien Daffa Dienul Adel avatar  avatar Glitch avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.