JSFiddle - React, Tailwind, and code Playground

by uiwwnw

CSS

.layer-popup .bottom-check-area {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 5px 10px;
}

JavaScript

var Popup = (function(Popup, i) {
  'use strict';

  var popupId = id();


  function opt(argument, _opt) {
    var type = {
      width: [ 'number', 'string' ],
      height: [ 'number', 'string' ],
      header: [ 'string' ],
      container: [ 'string' ],
      bottomCheckArea: [ 'string' ],
      close: [ 'boolean' ],
      cancel: [ 'string', 'boolean' ],
      fnCancel: [ 'function' ],
      confirm: [ 'string', 'boolean' ],
      fnConfirm: [ 'function' ],
      sto: [ 'boolean', 'number' ],
      id: [ 'string' ],
    };
    var opt = {
      width: 'auto',
      height: 'auto',
      header: '알림',
      container: '알림 내용을 입력해 주세요.',
      bottomCheckArea: '',
      close: true,
      cancel: false,
      confirm: false,
      sto: false,
      //
      id: '',
    };
    if (argument) {
      if (argument.isTrusted) {
        throw 'open시 옵션을 넣어주세요. 없으면 빈값{}을 넣어주세요';
      }
      $.map(argument, function(value, key) {
        var _type = type[ key ];
        if (!_type) {
          throw key + '은 없는 속성입니다. 다시 확인해주세요.\n https://wisebirds.atlassian.net/wiki/spaces/snsad/pages/804814849/Popup';
        }
        if (_type.indexOf(typeof value) === -1) {
          throw `${key} 의 타입이 잘못되었습니다. 타입은 ${_type} 를 지원합니다.`;
        }
      });
    }
    return $.extend(true, _opt ? _opt : opt, argument);
  }

  function id() {
    return '_' + Math.random().toString(36).substr(2, 9);
  };

  function Popup(argument) {
    this.id = id();
    this.idHeader = id();
    this.idProgress = id();
    this.idContainer = id();
    this.idClose = id();
    this.idFooter = id();
    this.idCancel = id();
    this.idConfirm = id();
    this.template(argument);
    this.element = document.querySelector(`[data-id="${this.id}"]`);
    this.idStyle = document.querySelector(`[data-id="${popupId}"]`);
  }

  Popup.prototype.template = function(argument) {
    var options;
    if (!this.options) {
      this.container = null;
      this.options = opt(argument);
      options =...