{"id":18895139,"url":"https://github.com/coffezilla/react-bhx-modal-custom","last_synced_at":"2025-07-28T23:08:34.268Z","repository":{"id":236564227,"uuid":"402189845","full_name":"coffezilla/react-bhx-modal-custom","owner":"coffezilla","description":"Simple custom modal in Typescript for ReactJS project - made with create-react-app","archived":false,"fork":false,"pushed_at":"2022-12-04T20:03:33.000Z","size":607,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T01:13:37.765Z","etag":null,"topics":["custom-modal","javascript-modal","modal","open-source","typescript-modal"],"latest_commit_sha":null,"homepage":"https://react-bhx-modal-custom.netlify.app/","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/coffezilla.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,"publiccode":null,"codemeta":null}},"created_at":"2021-09-01T20:09:09.000Z","updated_at":"2022-01-19T10:33:32.000Z","dependencies_parsed_at":"2024-04-27T20:24:32.642Z","dependency_job_id":"091b39a6-be17-4205-8b39-9460a03bdf69","html_url":"https://github.com/coffezilla/react-bhx-modal-custom","commit_stats":null,"previous_names":["coffezilla/react-bhx-modal-custom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coffezilla/react-bhx-modal-custom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffezilla%2Freact-bhx-modal-custom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffezilla%2Freact-bhx-modal-custom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffezilla%2Freact-bhx-modal-custom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffezilla%2Freact-bhx-modal-custom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coffezilla","download_url":"https://codeload.github.com/coffezilla/react-bhx-modal-custom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coffezilla%2Freact-bhx-modal-custom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267600298,"owners_count":24113755,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["custom-modal","javascript-modal","modal","open-source","typescript-modal"],"created_at":"2024-11-08T08:26:45.586Z","updated_at":"2025-07-28T23:08:34.236Z","avatar_url":"https://github.com/coffezilla.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-bhx-modal-custom\n\nThis modal is very useful for all kind of React projects. It's really simple and clean that make the basic modal behaviour for you.\n\n## Feat\n\n- Typescript\n- React ( sample is made using create-react-app )\n\n## How to use\n\nTo use this simple modal, add the **ModalCustom** folder inside the component's folder of your project.\n\nTo call your modal simple add a button:\n\n```tsx\n\u003cbutton type=\"button\" onClick={() =\u003e openModal('MY_MODAL')}\u003e\n\tOpen My Sample Modal\n\u003c/button\u003e\n```\n\nConfigure your type for Typescript purpose\n\n```tsx\n// type\ntype modalIndex = 'MY_MODAL';\n\nfunction App() {\n\n[...]\n\n\tconst [modalState, setModalState] = useState({\n\t\tMY_MODAL: { status: false },\n\t});\n\n\tconst openModal = (modalName: modalIndex) =\u003e {\n\t\tsetModalState({ ...modalState, [modalName]: { status: true } });\n\t};\n\n\tconst closeModal = (modalName: modalIndex) =\u003e {\n\t\tconst documentBody: HTMLBodyElement | null = document.querySelector('body');\n\t\tif (documentBody !== null) {\n\t\t\tdocumentBody.className = '';\n\t\t}\n\t\tsetModalState({ ...modalState, [modalName]: { status: false } });\n\t};\n\t\n[...]\n```\n\n## Configure the content of your modal\n\nPut the ModalCustom tag inside your component and add the modal property with a unique name.\n\n```tsx\n\u003cModalCustom status={modalState.MY_MODAL.status} closeModal={closeModal} modal=\"MY_MODAL\"\u003e\n\t\u003ch2\u003eThis is my Modal Custom\u003c/h2\u003e\n\t\u003cp\u003eYou can close this modal using the \"ESCAPE KEY\"\u003c/p\u003e\n\t\u003cp\u003eYou can close this modal clicking on the outside area\u003c/p\u003e\n\t\u003cp\u003eYou can close this clicking on the \"CLOSE BUTTON\"\u003c/p\u003e\n\t\u003cbutton type=\"button\" onClick={() =\u003e closeModal('MY_MODAL')}\u003e\n\t\tCLOSE BUTTON\n\t\u003c/button\u003e\n\u003c/ModalCustom\u003e\n```\n\nExample\n\n![custom-modal.gif](react-bhx-modal-custom%20b57a599b545341df9c7560db5f9d3354/custom-modal.gif)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoffezilla%2Freact-bhx-modal-custom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoffezilla%2Freact-bhx-modal-custom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoffezilla%2Freact-bhx-modal-custom/lists"}