{"id":21989028,"url":"https://github.com/imweb/redemo","last_synced_at":"2025-04-30T11:28:22.260Z","repository":{"id":57349597,"uuid":"89685460","full_name":"imweb/redemo","owner":"imweb","description":"react demo component","archived":false,"fork":false,"pushed_at":"2018-05-30T07:43:00.000Z","size":2821,"stargazers_count":60,"open_issues_count":1,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-18T02:05:20.380Z","etag":null,"topics":["component","demo","documentation","react"],"latest_commit_sha":null,"homepage":"https://imweb.github.io/redemo/","language":"JavaScript","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/imweb.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}},"created_at":"2017-04-28T08:28:57.000Z","updated_at":"2023-03-10T11:57:57.000Z","dependencies_parsed_at":"2022-09-15T15:23:08.693Z","dependency_job_id":null,"html_url":"https://github.com/imweb/redemo","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/imweb%2Fredemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fredemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fredemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fredemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imweb","download_url":"https://codeload.github.com/imweb/redemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251690343,"owners_count":21628092,"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":["component","demo","documentation","react"],"created_at":"2024-11-29T19:27:24.811Z","updated_at":"2025-04-30T11:28:22.209Z","avatar_url":"https://github.com/imweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Npm Package](https://img.shields.io/npm/v/redemo.svg?style=flat-square)](https://www.npmjs.com/package/redemo)\r\n[![Npm Downloads](http://img.shields.io/npm/dm/redemo.svg?style=flat-square)](https://www.npmjs.com/package/redemo)\r\n[![Dependency Status](https://david-dm.org/gwuhaolin/redemo.svg?style=flat-square)](https://npmjs.org/package/redemo)\r\n\r\n[中文文档](https://github.com/gwuhaolin/blog/issues/1)\r\n\r\n# redemo\r\nWhen you write a react component, you may need tell others how to use it by write some demos.\r\nRedemo is used to help write demo for react component in a easy way, is't pretty and simple to use.\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"https://gwuhaolin.github.io/redemo/\"\u003e\r\n    \u003cimg alt=\"redemo\" src=\"./src/doc/redemo.png\" width=\"600\"\u003e\r\n  \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## feature\r\n- doc: write doc in markdown for this demo\r\n- code: show source code for this demo\r\n- propTypes: auto list react component `propTypes` document form comment in your component source instead of write by yourself\r\n\r\n## install\r\nuse it from npm in webpack\r\n```bash\r\nnpm i redemo\r\n```\r\n\r\nthen install webpack dependencies\r\n```html\r\nnpm i raw-loader react-docgen@next docgen-loader --save-dev\r\n```\r\n\r\n## example\r\nLet's write a demo for a `Button` component\r\n\r\n```js\r\nimport ReDemo from 'redemo';\r\nimport Button from './button';\r\n\r\n// load propTypes by docgen-loader from button component source code\r\nconst docgen = require('!!docgen-loader!../button');\r\n\r\n// load source code by raw-loader from button component source code\r\nconst code = require('!!raw-loader!../button');\r\n\r\n// write doc for this demo in markdown\r\nconst doc = `\r\n### react component used to demonstrate react component\r\n#### structure\r\n- in top section is demo instance to play \r\n- circle button in right are toggle for **component propTypes** and **demo source code**\r\n- propTypes table show all prop's info for this component\r\n- in bottom is source code for this demo\r\n`\r\n\r\n\u003cReDemo\r\n  className=\"my-demo\"\r\n  docgen={docgen}\r\n  doc={doc}\r\n  code={code}\r\n  defaultCodeVisible\r\n  defaultPropTypeVisible\r\n\u003e\r\n  \u003cButton\u003edemo component instance\u003c/Button\u003e\r\n\u003c/ReDemo\u003e\r\n```\r\n\r\n## API\r\nsee `ReDemo`'s all props [here](https://imweb.github.io/redemo/)\r\n\r\n## In practice\r\n- [imuix](http://imweb.github.io/imuix/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Fredemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimweb%2Fredemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Fredemo/lists"}