This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Coding guide
Jonny edited this page Oct 10, 2019
·
8 revisions
- Use rems except for...
- border-width
border-radius- outline
- outline-offset
- @media queries (until we discuss)
- Typecheck (propTypes) every component's props, whether it's a simple style component (in src/styled.js) or a child component that receives props from a parent. Check all.
- Provide simple concise description (comment) for each propType declaration
- Supplement with any further helpful usage details as appropriate
- Don't mention default values within these comments, these are automatically rendered in a props table within dev docs
- Style all elements inline, unless there is some level of complexity and it all gets a bit too hard to work with
- Props can accept an array value to set values per breakpoint, as appropriate (e.g. size, block etc.)
- Provide a
tag
prop to set the component’s outer element if beneficial - Use the Context API to share parent props, rather than deep ‘prop drilling’, as appropriate
- It's acceptable to use cloneElement() to add first and last props when iterating children
- Set a 'static prop' on any child components and check against this when iterating/cloning