Skip to content

Latest commit

 

History

History
121 lines (82 loc) · 5.01 KB

CONTRIBUTING.md

File metadata and controls

121 lines (82 loc) · 5.01 KB

Contributing

If you're reading this, you're awesome! Thank you for helping us make this project great and being a part of the Material-UI community. Here are a few guidelines that will help you along the way.

Submitting a Pull Request

Material-UI is a community project, so pull requests are always welcome, but before working on a large change, it is best to open an issue first to discuss it with the maintainers.

When in doubt, keep your pull requests small. To give a PR the best chance of getting accepted, don't bundle more than one feature or bug fix per pull request. It's always best to create two smaller PRs than one big one.

As with issues, please begin the title with [ComponentName].

When adding new features or modifying existing, please attempt to include tests to confirm the new behaviour. You can read more about our test setup here.

Branch Structure

All stable releases are tagged (view tags). At any given time, v1-beta represents the latest development version of the library. Patches or hotfix releases are prepared on an independent branch.

v1-beta is unsafe

We will do our best to keep v1-beta in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with.

Getting started

Please create a new branch from an up to date v1-beta on your fork. (Note, urgent hotfixes should be branched off the latest stable release rather than v1-beta)

  1. Fork the Material-UI repository on Github
  2. Clone your fork to your local machine git clone git@github.com:<yourname>/material-ui.git
  3. Create a branch git checkout -b my-topic-branch
  4. Make your changes, lint, then push to to GitHub with git push --set-upstream origin my-topic-branch.
  5. Visit GitHub and make your pull request.

If you have an existing local repository, please update it before you start, to minimise the chance of merge conflicts.

git remote add upstream git@github.com:mui-org/material-ui.git
git checkout v1-beta
git pull upstream v1-beta
git checkout -b my-topic-branch
yarn

Testing the documentation site

The documentation site is built with Material-UI and contains examples of all the components. To get started:

yarn
yarn docs:dev

You can now access the documentation site locally.

Test coverage is limited at present, but where possible, please add tests for any changes you make. Tests can be run with yarn test.

Coding style

Please follow the coding style of the current code base. Material-UI uses eslint, so if possible, enable linting in your editor to get real-time feedback. The linting rules are also run when Webpack recompiles your changes, and can be run manually with yarn lint.

You can also run yarn prettier to reformat the code.

Finally, when you submit a pull request, they are run again by Circle CI, but hopefully by then your code is already clean!

How do I add new a demo in the documentation?

Let's get started.

It's simple. You just need to create a new file and modify two files. For example, let say you want to add new demos for buttons component, then you have to go through the following steps:

1. Add a new React component file under the related directory.

In this case, I'm gonna add the new file to the following directory:

docs/src/pages/demos/buttons/

And let's give it a name: SuperButtons.js.

2. Edit the page Markdown file.

The Markdown file is the source for the website documentation. So, whatever you wrote there will be reflected on the website. In this case, the file you need to edit is docs/src/pages/demos/buttons/buttons.md, and I'm gonna add some description about SuperButtons.

+ ### Super buttons
+
+ Sometimes, you need a super button to make your app looks **superb**. Yea ...
+
+ {{"demo": "pages/demos/buttons/SuperButtons.js"}}

3. Edit the Next.js page.

The Next.js page is saved under the following page. There is a direct mapping between the filename in the repository and the pathname in the documentation.

pages/demos/buttons.js

Then, you will need to add the following code:

+ 'pages/demos/buttons/SuperButtons.js': {
+          js: require('docs/src/pages/demos/buttons/SuperButtons').default,
+          raw: preval`
+ module.exports = require('fs')
+  .readFileSync(require.resolve('docs/src/pages/demos/buttons/SuperButtons'), 'utf8')
+`,
+        },

4. You are done 🎉!

In case you missed something, we have a real example that can be used as a summary report.

Roadmap

To get a sense of where Material-UI is heading, or for ideas on where you could contribute, take a look at the ROADMAP.

License

By contributing your code to the mui-org/material-ui GitHub repository, you agree to license your contribution under the MIT license.