{"id":19794634,"url":"https://github.com/code-crash/react-modal","last_synced_at":"2025-10-25T20:07:39.528Z","repository":{"id":97043179,"uuid":"242208875","full_name":"Code-Crash/react-modal","owner":"Code-Crash","description":"This project contains the source code for @code/react-modal npm module","archived":false,"fork":false,"pushed_at":"2024-04-23T01:43:45.000Z","size":660,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T08:04:43.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Code-Crash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-02-21T18:50:59.000Z","updated_at":"2022-04-19T03:58:31.000Z","dependencies_parsed_at":"2024-03-09T05:46:02.328Z","dependency_job_id":null,"html_url":"https://github.com/Code-Crash/react-modal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Crash%2Freact-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Crash%2Freact-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Crash%2Freact-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Crash%2Freact-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Code-Crash","download_url":"https://codeload.github.com/Code-Crash/react-modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812322,"owners_count":21647885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T07:13:46.695Z","updated_at":"2025-10-25T20:07:39.441Z","avatar_url":"https://github.com/Code-Crash.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @code/react-modal\n\n\u003e This library will hold the code for modal and it\u0026#x27;s examples \n\n[![NPM](https://img.shields.io/npm/v/@code/react-modal.svg)](https://www.npmjs.com/package/@code/react-modal) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm i github:code-crash/react-modal --save\n```\n\n## Usage\n\n### Full Example\n\n```jsx\n\nimport React, { Component } from 'react'\nimport ModalComponent from '@code/react-modal'\n\nconst styles = {\n  area: {\n    width: '100%',\n  },\n};\n\nexport default class App extends Component {\n\n  constructor(props) {\n    super(props);\n    this.toggle = this.toggle.bind(this);\n    this.ccModalContent = this.ccModalContent.bind(this);\n    this.ccModalCancel = this.ccModalCancel.bind(this);\n    this.ccModalContinue = this.ccModalContinue.bind(this);\n  }\n\n  /**\n   * @description This function will toggle your modal.\n   */\n  toggle() {\n    if (this.modal \u0026\u0026 this.modal.state \u0026\u0026 this.modal.state.open) {\n      this.modal.close();\n    } else {\n      this.modal.open();\n    }\n  }\n\n  /**\n   * @description This function will handle the cancel button\n   */\n  ccModalCancel() {\n    console.log('modal action Cancel and Close Modal!');\n    this.toggle();\n  }\n\n  /**\n   * @description This function will handle the continue button or save button\n   */\n  ccModalContinue() {\n    console.log('modal action Continue!');\n  }\n\n  /**\n   * @description This function will return the content which you\n   *              need to put into the modal as content\n   */\n  ccModalContent() {\n    return (\n      \u003cdiv\u003e\n         Your Component is Here!!\n      \u003c/div\u003e\n    );\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cdiv\u003e\n          \u003cbutton onClick={this.toggle}\u003eBasic Modal\u003c/button\u003e\n          \u003cdiv\u003e\n            \u003cModalComponent ref={(component) =\u003e { this.modal = component; }}\n              content={this.ccModalContent()}\n              toggle={this.toggle}\n              styles={styles}\n              cancel={this.ccModalCancel}\n              continue={this.ccModalContinue}\n              action={{ cancel: { label: 'Close', hide: false } }}\n            /\u003e\n          \u003c/div\u003e\n        \u003c/div\u003e\n\n      \u003c/div \u003e\n    )\n  }\n}\n```\n\n### Input Properties along with Functions\n\n```tsx\n\nexport type Props = {\n  hTitle?: string, // 'Header Title',\n  fTitle?: string, // 'Footer Title',\n  content?: JSX.Element, // \u003cdiv\u003eThis is your Component\u003c/div \u003e,\n  toggle?: Function, // 'Your function which will manage the open|close the modal',\n  cancel?: Function, // 'Your function which will manage the cancel the modal',\n  continue?: Function, // 'Your function which will manage the continue the modal',\n  action?: {\n    cancel?: {\n      hide?: boolean, // default: false,\n      label?: string, // default: 'Cancel'\n    },\n    continue?: {\n      hide?: boolean, // default: false,\n      label?: string, // default: 'Continue'\n    },\n  },\n  styles?: {\n    area?: object, // { width: '100%', background: 'red', },\n    cancel?: object,\n    continue?: object,\n  },\n};\n\n```\n\n## To Do\n\n* Add more styles support for each section of modal\n* Add examples with different modals\n* Update ```README.md``` with proper explanation\n* Add support for fade-in and fade-out\n* \n\n\n## License\n\nMIT © [Code-Crash](https://github.com/Code-Crash)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-crash%2Freact-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-crash%2Freact-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-crash%2Freact-modal/lists"}