0.1.14 • Published 6 years ago

@nju33/react-modal v0.1.14

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-modal

@nju33/react-modal style: styled-components lerna code style: prettier

Install

yarn add @nju33/react-modal
# npm i @nju33/react-modal

By the way, pkg.types that d.ts files, is included in for the TypeScript.

VDom herarchy

<Modal ...>
  <Cover ...>
    <CloseIcon ... />
    <Box ...>
      <!-- this.props.children -->
    </Box>
  </Cover>
</Modal>

Interfaces

export type ModalTransitionType = 'simple' | 'slide' | 'slideFromOutside';

export interface ModalProps {
  // Any of the above, `ModalTransitionType`
  type?: ModalTransitionType;
  // Will be called on run the `close event` from somewhere
  // For example, Such when `<Cover/>` clicked, <`CloseIcon/>` clicked
  handleClose(): void;

  // It's used like that in `react-transition-group/Transition`
  // Please read https://reactcommunity.org/react-transition-group/#Transition
  // for more imformation
  in?: boolean;
  timeout?: number;

  // If they're, Each style of component extends in them
  styles?: {
    cover?: string;
    closeIcon?: string;
    box?: string;
  };
}

Example

// ... head of React

render() {
  return (
    <div>
      <Modal
        in={this.state.in}
        handleClose={() => this.setState({in: false})}
      >
        <div>{/* somehow */}</div>
      </Modal>
    </div>
  );

// ...
0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.0

6 years ago

0.0.12

6 years ago

0.0.10

6 years ago

0.0.5

6 years ago