{"id":15007764,"url":"https://github.com/mathhetru/simplemathmodal","last_synced_at":"2026-03-15T12:14:29.043Z","repository":{"id":254411138,"uuid":"845943492","full_name":"mathhetru/simpleMathModal","owner":"mathhetru","description":"Create a npm package modal for reactJS","archived":false,"fork":false,"pushed_at":"2024-09-27T09:22:58.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T06:15:15.768Z","etag":null,"topics":["npm","npm-package","package","react","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/simple-modal-math","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/mathhetru.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":"2024-08-22T08:27:50.000Z","updated_at":"2024-09-27T09:23:02.000Z","dependencies_parsed_at":"2024-08-23T10:06:57.167Z","dependency_job_id":null,"html_url":"https://github.com/mathhetru/simpleMathModal","commit_stats":null,"previous_names":["mathhetru/simplemathmodal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathhetru%2FsimpleMathModal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathhetru%2FsimpleMathModal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathhetru%2FsimpleMathModal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathhetru%2FsimpleMathModal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathhetru","download_url":"https://codeload.github.com/mathhetru/simpleMathModal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243165538,"owners_count":20246725,"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":["npm","npm-package","package","react","typescript"],"created_at":"2024-09-24T19:13:39.601Z","updated_at":"2025-12-24T12:20:17.345Z","avatar_url":"https://github.com/mathhetru.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modal Component\n\nThis is a reusable Modal component built with React. It displays a modal dialog with customizable options, including a header, main content area, and footer with an optional close button.\nIt was made for the 14th Openclassrooms project of Front-end Web Developper training by OpenClassrooms \"Switch a jQuery library to React\".\n\n## Installation\n\n### Install\n\n```bash\nnpm i simple-modal-math\n```\n\n### Install depencies\n\nTo use the Modal component in your project, you need to have the following dependencies installed:\n\n```bash\nnpm install react@^18.2.55 react-dom@^18.2.19 @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons\n```\n\n## Usage\n\n### Javascript\n\nHere's how you can use the Modal component in your React application:\n\n```javascript\nimport React, { useState } from \"react\";\nimport { Modal } from \"simple-modal-math\";\n\nfunction App() {\n  const [isOpen, setIsOpen] = useState(false);\n\n  const handleClick = () =\u003e {\n    setIsOpen(!isOpen);\n  };\n\n  const handleClose = () =\u003e {\n    setIsOpen(false);\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={handleClick}\u003eOpen Modal\u003c/button\u003e\n      \u003cModal\n        isOpen={isOpen}\n        closable={true}\n        headerTitle=\"Modal Header\"\n        mainContent=\"This is the main content of the modal.\"\n        hasFooter={true}\n        buttonFooter=\"Close\"\n        modalSize=\"medium\"\n        onClose={handleClose}\n      /\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\n### Props\n\nThe Modal component accepts the following props:\n\n- isOpen (boolean, required): Controls whether the modal is open or not.\n- closable (boolean, optional): Determines if the modal has a close button in the header. Defaults to false.\n- headerTitle (string, optional): Text to display in the modal's header. If not provided, the header will be empty.\n- mainContent (string, optional): The main content text to display in the modal. Defaults to an empty string if not provided.\n- hasFooter (boolean, optional): Determines if the modal should have a footer. Defaults to false.\n- buttonFooter (string, optional): Text for the footer button. Defaults to \"Close\" if not provided.\n- modalSize (\"small\" | \"medium\" | \"large\", optional): Sets the size of the modal. Defaults to \"medium\".\n- onClose (function, required): Callback function to handle the closing of the modal.\n\n### Styling\n\nThe modal component requires a CSS file (modal.css) for styling. Below is a basic example of the CSS classes used:\n\n```css\n.m-modal {\n  /* Modal background and positioning styles */\n}\n\n.m-modal-content {\n  /* Modal content container styles */\n}\n\n.small {\n  max-width: 30vw;\n}\n\n.medium {\n  max-width: 50vw;\n}\n\n.large {\n  max-width: 70vw;\n}\n\n.m-modal-header {\n  /* Modal header styles */\n}\n\n.m-modal-header__text {\n  /* Header text styles */\n}\n\n.m-modal-header__button {\n  /* Close button styles */\n}\n\n.m-modal-main {\n  /* Main content area styles */\n}\n\n.m-modal-main__text {\n  /* Main content text styles */\n}\n\n.m-modal-footer {\n  /* Footer container styles */\n}\n\n.m-modal-footer__button {\n  /* Footer button styles */\n}\n```\n\nYou can customize the styles by modifying the provided CSS or adding your own.\n\n## Example\n\n```javascript\nimport React, { useState } from \"react\";\nimport { Modal } from \"simple-modal-math\";\n\nfunction App() {\n  const [isModalOpen, setModalOpen] = useState(false);\n\n  const toggleModal = () =\u003e {\n    setModalOpen(!isModalOpen);\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={toggleModal}\u003eToggle Modal\u003c/button\u003e\n      \u003cModal\n        isOpen={isModalOpen}\n        closable={true}\n        headerTitle=\"Example Modal\"\n        mainContent=\"This is an example modal component.\"\n        hasFooter={true}\n        buttonFooter=\"Close\"\n        modalSize=\"medium\"\n        onClose={toggleModal}\n      /\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\nThis will render a modal with a header, main content area, and a footer with a close button. The modal can be closed by clicking the close button or by triggering the onClose function passed as a prop.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue to discuss any changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathhetru%2Fsimplemathmodal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathhetru%2Fsimplemathmodal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathhetru%2Fsimplemathmodal/lists"}