Git Product home page Git Product logo

-woongs-modal's Introduction

@jaewoong2/modal

Description

Very Simple & Easy Modal For You

Version

  • 0.1.6
  • Be 1.0.0 When This Todo will Be Done.

Storybook


Installation

yarn

$ yarn add @jaewoong2/modal

npm

$ npm i @jaewoong2/modal

Prototype Image

  • useModal('normal', options)

  • useModal('button', options)

  • useModal('text', options)

  • You Can set Button Type by setting options { ...options, buttonType: 'primary' }

Usage

Declaration

import { ModalProvider, useModalButton, useModalNormal, useModalText} from "@jaewoong2/modal"

Provider

import { ModalProvider } from '@jaewoong2/modal'

const App = () => {
   return (
      <ModalProvider>
         <RootComponent />
      </ModalProvider>
   )
}

useModalNormal Call

import { useModal } from "@jaewoong2/modal"

const ChildComponent = ({ options }) => {
   const { show, hide } = useModal('normal', {  ...options })

   return (
      <button onClick={show}>SHOW</button>
      <button onClick={hide}>HIDE</button>
   )
}

useModalText Call

import { useModal } from "@jaewoong2/modal"

const ChildComponent = ({ options }) => {
   const { show, hide } = useModal('text', {  ...options })

   return (
      <button onClick={show}>SHOW</button>
      <button onClick={hide}>HIDE</button>
   )
}

useModalButton Call

import { useModal } from "@jaewoong2/modal"

const ChildComponent = ({ options }) => {
   const { show, hide } = useModal('button', {  ...options })

   return (
      <button onClick={show}>SHOW</button>
      <button onClick={hide}>HIDE</button>
   )
}

Modals Options

Modal Basic Options

type ModalBasicOptions = {
  isLoading?: boolean
  borderRadius?: string
  modalWidth?: string
  message?: React.ReactNode
  header?: React.ReactNode
}

useModalNormal Options

type ModalNormalOptions = {
  src?: string

  footerLeftText?: React.ReactNode
  footerRightText?: React.ReactNode

  onClickFooterLeft?: () => void
  onClickFooterRight?: () => void
} & ModalBasicOptions

useModalText Options

type ModalTextOptions = {
  buttonType?: ButtonType
  buttonText?: string
  description?: React.ReactNode

  onClickButton?: () => void
} & ModalBasicOptions

useModalButton Options

type ModalButtonOptions = {
  buttonType?: ButtonType
  src?: string
  buttonText?: string
  onClickButton?: () => void
} & ModalBasicOptions

UX / A11Y

Defferd Component

  • 스켈레톤 이미지가 200ms 보다 짧게 보여지게 된다면, 사용성이 떨어지기 때문에
  • 200ms 보다 길게 로딩이 되면, 스켈레톤 이미지가 보여지게 하는 Component
  • Reference - https://tech.kakaopay.com/post/skeleton-ui-idea/

Skeleton Component

  • Image Skeleton Component
  • Message Skeleton Component
  • Description Skeleton Component

For A11y Tags and Attributes

  • Image(Alt)
  • role="dialog"
  • aria-label="modal"
  • Modal Close Button
  • setting tabIndex

Documents


Next Todo

  1. Deployment / Publish
  2. StroyBook Hosting
  3. Document Writing
  4. Options (By Priority)

  • Patch

    • 코드 변경, 버그 수정
  • Minor

    • 기능 추가
  • Major

    • 정식 출시 및 업데이트 후, 기존 버전과 동일 하게 사용 할 수 없을 경우 Major 업데이트

Build by Rollup

Style by Emotion

Test by Storybook

Use For React

-woongs-modal's People

Contributors

jaewoong2 avatar

Watchers

 avatar

-woongs-modal's Issues

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.