{"id":27535667,"url":"https://github.com/lyef/lyef-react-component","last_synced_at":"2025-04-18T19:10:00.633Z","repository":{"id":57306307,"uuid":"63992900","full_name":"lyef/lyef-react-component","owner":"lyef","description":"An opinionated boilerplate for reusable and decoupled react components.","archived":false,"fork":false,"pushed_at":"2017-10-02T16:37:01.000Z","size":1631,"stargazers_count":153,"open_issues_count":3,"forks_count":158,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-18T13:07:52.643Z","etag":null,"topics":["decoupled-components","javascript","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-23T01:22:31.000Z","updated_at":"2023-06-15T09:16:18.000Z","dependencies_parsed_at":"2022-09-20T22:54:54.538Z","dependency_job_id":null,"html_url":"https://github.com/lyef/lyef-react-component","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyef%2Flyef-react-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyef%2Flyef-react-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyef%2Flyef-react-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyef%2Flyef-react-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyef","download_url":"https://codeload.github.com/lyef/lyef-react-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249491225,"owners_count":21281121,"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":["decoupled-components","javascript","react"],"created_at":"2025-04-18T19:09:59.308Z","updated_at":"2025-04-18T19:10:00.620Z","avatar_url":"https://github.com/lyef.png","language":"JavaScript","readme":"# Lyef React Component\n[![Build Status](https://travis-ci.org/lyef/lyef-react-component.svg)](https://travis-ci.org/lyef/lyef-react-component/)\n![Minified component file size](https://badge-size.herokuapp.com/lyef/lyef-react-component/master/dist/Main.min.js.svg)\n![Gziped component file size](https://badge-size.herokuapp.com/lyef/lyef-react-component/master/dist/Main.min.js.svg?compression=gzip)\n[![NPM version](https://badge-me.herokuapp.com/api/npm/lyef-react-component.png)](http://badges.enytc.com/for/npm/lyef-react-component)\n\n\u003e An opinionated boilerplate for reusable and declouped react components.\n\nThe main idea of this project was based on develop decoupled components in a isolated environment. We don't need to use an entire application to build our components, we just need some place to run and test them.\n\n## Getting Started\n\n### Installation\n\nFor now, you can clone this repo or use the [slush generator](https://github.com/lyef/slush-lyef-react). We are creating a [CLI](https://github.com/lyef/lyef-react-cli) also.\n\n**You’ll need to have Node \u003e= 4 on your machine.** We recommend to use Node \u003e= 6 and npm \u003e= 3 for faster installation speed and better disk usage.\n\n### Folders and Files\n\n```sh\n├── css\n│   └── main.css\n├── src\n│   └── Main.js\n├── stories\n│   └── Main.js\n├── storybook\n│   ├── config.js\n│   └── webpack.config.js\n├── tests\n│   ├── helpers\n│   │   └── setup.js\n│   └── specs\n│       └── Main.spec.js\n├── .babelrc\n├── .editorconfig\n├── .eslintrc\n├── .gitignore\n├── .npmignore\n├── .travis.yml\n├── CONTRIBUTING.md\n├── LICENSE.md\n├── Readme.md\n└── package.json\n```\n\n## Creating your Component\n\n### Writing your code\n\nWrite your component code on `src/Main.js`, you can create another files for composable components also.\n\n```js\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nconst Component = ({ name }) =\u003e (\n    \u003ch1\u003eHello {name}!\u003c/h1\u003e\n);\n\nComponent.propTypes = {\n    name: PropTypes.string.isRequired,\n};\n\nexport default Component;\n```\n\n### Writing Stories\n\n![React Storybook Example Image](images/storybook-example.gif)\n\nStories are like behavior or states that our components should have. Such as an activated button, labels, whatever your component can change by props/states.\n\nYou can also see them as user stories for the agile development.\n\nTo understand more about that, I suggest you to read the [storybook stories guide](https://storybook.js.org/basics/guide-react/). Follow the example above:\n\n```js\nstoriesOf('Component', module)\n    .add('with lyef name', () =\u003e (\n        \u003cComponent name=\"lyef\" /\u003e\n    ))\n    .add('with another name', () =\u003e (\n        \u003cComponent name=\"another\" /\u003e\n    ))\n```\n\nEvery new story will be available on the left side panel of React Storybook to see different cases.\n\n### Running your code\n\n![Terminal running the code](images/storybook-run.gif)\n\nJust use `npm start`, Runs the app in development mode.\nOpen [http://localhost:9001](http://localhost:9001) to view it in the browser.\n\nThe page will reload if you make edits and you will see the build errors and lint warnings in the console.\n\n### Running tests\n\n![Terminal running tests](images/tests.gif)\n\nWe encourage everyone to write tests to your components, this can help us to create a more maintainable and free of bugs component. To do that, we create 3 tasks:\n\n- `npm test`: run your tests in a single-run mode.\n- `npm run test:tdd`: run and keep watching your test files.\n- `npm run test:coverage`: prints and create html files by istanbul coverage.\n\n### Linting your code\n\nIn order to keep your code clean and consistent we use [eslint](http://eslint.org/) with [Airbnb preset](https://github.com/airbnb/javascript/tree/master/react). We have 2 tasks for this:\n\n- `npm run lint`: lint all files searching for errors.\n- `npm run lint:fix`: fix automaticaly some lint errors.\n\n### Deploy your component\n\n![Terminal running deploy](images/deploy.png)\n\nYou can deploy your component (inside Storybook) to `github pages` running the command `npm run deploy-storybook`.\n\n## Why use this?\n\nWe believe that start to code shouldn't be hard, so you don't need to concern about configurations and tools, just create your pretty stuff. With this structure, your environment will have everything you need to build a modern React Component:\n\n- React, JSX and ES6 support with Babel.\n- A dev server with live reload\n- Stack for tests\n- Linters\n- A build script to compile and minify for production\n\n## What we use?\n\n#### Environment\n\n[React Storybook](https://github.com/kadirahq/react-storybook) - *to tell stories with different behaviors of the component and provide an example page.*\n\n#### Style Guide\n\n- [EditorConfig](http://editorconfig.org/) - *standardize some general settings among multiple editors*\n- [ESLint](http://eslint.org/) - *for reporting the patterns of code*\n  - [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)\n  - **Plugins**\n    - [React](https://github.com/yannickcr/eslint-plugin-react)\n    - [A11y](https://github.com/evcohen/eslint-plugin-jsx-a11y)\n    - [Import](https://github.com/benmosher/eslint-plugin-import)\n\n#### Tests\n- [Mocha](https://github.com/mochajs/mocha) - *test framework*\n- [Chai](https://github.com/chaijs/chai) - *assertions*\n- [Enzyme](https://github.com/airbnb/enzyme) - *shallow component*\n- [Jsdom](https://github.com/tmpvar/jsdom) - *mock the browser*\n\n#### Compiler\n\n- [babel](https://babeljs.io/)\n  - **Plugins**\n    - [Airbnb](https://github.com/airbnb/babel-preset-airbnb)\n    - [ES2015](https://www.npmjs.com/package/babel-preset-es2015)\n    - [React](https://www.npmjs.com/package/babel-preset-react)\n\n## Code Standarts\n\nThis project uses [eslint](http://eslint.org/) and [.editorconfig](http://editorconfig.org/) is defined to have indent_size of **4 spaces**. You can change that on [.eslintrc](https://github.com/lyef/lyef-react-component/blob/master/.eslintrc#L16) file.\n\nThis project also uses [Husky](https://github.com/typicode/husky) to prevent to push code with lint errors or broken tests. If you don't want this, you can uninstall running `npm uninstall --save-dev husky` and deleting the [prepush command](https://github.com/lyef/lyef-react-component/blob/master/package.json#L21) on `package.json`.\n\n## Contributing\n\nWe'd love to have your helping hand on our lyef-react-component! See [CONTRIBUTING.md](https://github.com/lyef/lyef-react-component/blob/master/CONTRIBUTING.md) for more information on what we're looking for and how to get started.\n\n## License\n\n[MIT License](https://github.com/lyef/lyef-react-component/blob/master/LICENSE.md) @ [lyef](https://lyef.github.io)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyef%2Flyef-react-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyef%2Flyef-react-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyef%2Flyef-react-component/lists"}