1.1.11 • Published 2 years ago

izymodals v1.1.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

izymodals

A Wizard library that creats React Modals

NPM JavaScript Style Guide

Install

npm install --save izymodals

Usage

TabModal Hook Example

import { TabModal } from "izymodals";
import { useState } from "react";

const TabExample = (props) => {
  const [activeIndex, setActiveIndex] = useState(0);
  const footerButtons = () => (
    <button onClick={() => setActiveIndex(activeIndex + 1)}>
      Footer {activeIndex}
    </button>
  );

  const Container = ({ children }) => {
    return <div style={{ width: "100%" }}>{children}</div>;
  };

  const steps = [
    {
      label: "Step 1",
      content: Container,
      params: { children: "Do you like this modal?" }
    },
    {
      label: "Step 2",
      content: Container,
      params: {
        children: "Do you recommend it to your friend?"
      }
    }
  ];

  return (
    <TabModal
      status
      steps={steps}
      tabIndex={activeIndex}
      footer={footerButtons}
    >
      {({ tabList, tabPanels }) => {
        return (
          <div className="col-12 flex">
            <div className="col-2">
              <div className="card">
                <div className="flex align-items-center flex-column ">
                  {tabList}
                </div>
              </div>
            </div>
            <div className="col-10">
              <div className="flex flex-column">{tabPanels}</div>
            </div>
          </div>
        );
      }}
    </TabModal>
  );
};

export default TabExample;

PromptModal Hook Example

import { useState } from "react";
import { PromptModal } from "izymodals";

const PropmtExample = (props) => {
  const [status, setStatus] = useState(false);

  return (
    <div>
      <PromptModal
        status
        promptConfig={{
          labelYes: "yes",
          labelNo: "no",
          onYes: () => setStatus("yes"),
          onNo: () => setStatus("no")
        }}
      >
        Test {status}
      </PromptModal>
    </div>
  );
};

export default PropmtExample;

License

MIT © uuur86

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago