{"id":16439966,"url":"https://github.com/waynecz/react-bem-classname","last_synced_at":"2025-10-10T14:02:43.544Z","repository":{"id":92541695,"uuid":"159130278","full_name":"waynecz/react-bem-classname","owner":"waynecz","description":"BEM classname generator for react, state friendly","archived":false,"fork":false,"pushed_at":"2019-02-17T13:54:14.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-01T02:47:22.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/waynecz.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":"2018-11-26T07:47:00.000Z","updated_at":"2019-02-17T13:54:15.000Z","dependencies_parsed_at":"2023-06-07T21:45:21.269Z","dependency_job_id":null,"html_url":"https://github.com/waynecz/react-bem-classname","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"6be21584adf2900a3953dea4b1f925ce370bf966"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/waynecz/react-bem-classname","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Freact-bem-classname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Freact-bem-classname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Freact-bem-classname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Freact-bem-classname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waynecz","download_url":"https://codeload.github.com/waynecz/react-bem-classname/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Freact-bem-classname/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004062,"owners_count":26083669,"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-10-10T02:00:06.843Z","response_time":62,"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":[],"created_at":"2024-10-11T09:10:50.534Z","updated_at":"2025-10-10T14:02:43.506Z","avatar_url":"https://github.com/waynecz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React BEM className generator\n\n### Supporting facilities\n1. [watson-scss](https://github.com/waynecz/Watson) for writing nested BEM  fastly and furiously.\n2. [watson-snippet](https://github.com/waynecz/watson-snippet) vscode extension for coding faster.\n\n\u003cbr\u003e\n\n### Install\n\n```bash\nnpm i react-bem-classname -S\n```\n\n\u003cbr\u003e\n\n### Example\n```javascript\nimport BEMProvider from 'react-bem-classname'\n\nfunction Human() {\n  // recommend use bem as variable name cuz \n  const bem = BEMProvider('human')\n  const [isHurt, setHurtState] = useState('false')\n\n  return (\n    \u003csection {...bem()}\u003e\n      \u003cdiv {...bem('::head')} /\u003e\n      \u003cdiv {...bem('::body')} \u003e\n        \u003cdiv {...bem('::arm :left')} /\u003e \n        \u003cdiv {...bem('::arm :right', { hurt: isHurt })} /\u003e \n      \u003c/div\u003e\n      \u003cdiv {...bem('::footer')} \u003e\n        \u003cdiv {...bem('::leg :left')} /\u003e \n        \u003cdiv {...bem('::leg :right')} /\u003e \n      \u003c/div\u003e\n    \u003c/section\u003e\n  )\n}\n```\n\ncode above is exactly equal to this:\n\n```jsx\nfunction Human() {\n  const [isHurt, setHurtState] = useState('false')\n\n  return (\n    \u003csection className=\"human\"\u003e\n      \u003cdiv className=\"human_head\" /\u003e\n      \u003cdiv className=\"human_body\" \u003e\n        \u003cdiv className=\"human_arm human_arm--left\" /\u003e \n        \u003cdiv className={`human_arm human_arm--right ${isHurt ? 'is-hurt' : ''}`} /\u003e \n      \u003c/div\u003e\n      \u003cdiv className=\"human_footer\" \u003e\n        \u003cdiv className=\"human_leg human_leg--left\" /\u003e \n        \u003cdiv className=\"human_leg human_leg--left\" /\u003e \n      \u003c/div\u003e\n    \u003c/section\u003e\n  )\n}\n```\n\n\n### Basic concept\n\n+ Use `::pseudo element` as Block's Element\n+ Use `:pseudo class` as Modifier\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynecz%2Freact-bem-classname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaynecz%2Freact-bem-classname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynecz%2Freact-bem-classname/lists"}