Open Collective Frontend components
This project is an extract of the Open Collective Frontend components. It is meant to be used as a library of React components for Open Collective projects such as our Frontend Template.
How to add this to your project
Requirements: You React to be set up on your project.
- Add the dependency and its peer dependencies to your project:
npm install --save-exact @opencollective/frontend-components
- Plug the Open Collective theme in your project (usually in _app.js):
import { ThemeProvider } from 'styled-components';
import theme from '@opencollective/frontend-component/lib/theme';
const App = () => (
<ThemeProvider theme={theme}>
<Component />
</ThemeProvider>
);
- Use components from the library
import StyledButton from '@opencollective/frontend-components/StyledButton';
const MyComponent = () => <StyledButton buttonStyle="primary">Hello<StyledButton>;
ESM caveat
This library is distributed as ESM. If you are using Next.js, you'll need to feed this package into https://www.npmjs.com/package/next-transpile-modules to make it work.