1.1.15 • Published 11 months ago

@jswork/react-dialog v1.1.15

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

react-dialog

A react dialog based on HTML dialog.

version license size download

installation

npm install -S @jswork/react-dialog

usage

  1. import css

    @import "~@jswork/react-dialog/dist/style.css";
    
    // or use sass
    @import "~@jswork/react-dialog/dist/style.scss";
    
    // customize your styles:
    $react-dialog-options: ()
  2. import js

    import React from 'react';
    import ReactDialog from '../../src/main';
    import styled from 'styled-components';
    import '@jswork/react-backdrop/dist/style.css';
    
    const Container = styled.div`
        width: 80%;
        height: 80vh;
        border: 1px solid #ccc;
        position: relative;
        margin: 30px auto 0;
    
        nav {
            position: fixed;
            z-index: 100;
        }
    `;
    
    export default () => {
      const [visible, setVisible] = React.useState(true);
    
      const handleOpen = () => {
        setVisible(true);
      };
    
      const handleClose = () => {
        setVisible(false);
      };
    
      return (
        <Container>
          <button onClick={handleOpen}>Open</button>
          <ReactDialog visible={visible} withBackdrop keepMounted closeOnBackdropClick onClose={handleClose}>
            <ul>
              <li>道可道,非常道;名可名,非常名。</li>
              <li>无名,天地之始,有名,万物之母。</li>
              <li>故常无欲,以观其妙,常有欲,以观其徼。</li>
              <li>此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。</li>
            </ul>
            <nav>
              <button onClick={handleClose}>Close</button>
            </nav>
          </ReactDialog>
        </Container>
      );
    };

preview

license

Code released under the MIT license.

1.1.12

1 year ago

1.1.11

1 year ago

1.1.15

11 months ago

1.1.14

11 months ago

1.1.13

1 year ago

1.1.9

1 year ago

1.1.10

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.10

1 year ago

1.0.0

4 years ago