A library of AI2 themed React components.
- Custom theme provider for both Material-UI and Styled-Components.
- Common AI2 Styled-Components, components, and utilities.
- @material-ui/core
- @material-ui/icons
- @material-ui/lab
- lodash
- react
- react-dom
- styled-components
-
NPM:
npm install @allenai/varnish
-
or Yarn:
yarn add @allenai/varnish
-
Basic
import React from 'react'; import ReactDOM from 'react-dom'; // Import the parts of Varnish you want. At minimum, you need to import the ThemeProvider import { ThemeProvider } from '@allenai/varnish'; // Wrap your App with the Varnish ThemeProvider const VarnishApp = () => ( <ThemeProvider> <App /> </ThemeProvider> ) // Render ReactDOM.render(<VarnishApp />, document.getElementById('root'));
-
Extended theme
import React from 'react'; import ReactDOM from 'react-dom'; // Import ThemeProvider and getVarnishTheme import { ThemeProvider, getVarnishTheme } from '@allenai/varnish'; // Customize the theme const updatedTheme = getVarnishTheme( { palette: { primary: { main: '#00ff00' // setting primary buttons to be green } }, testColorLocal: 'darkGreen' // add whatever other styles we want } // Wrap your App with the Varnish ThemeProvider const VarnishApp = () => ( <ThemeProvider theme={updatedTheme}> <App /> </ThemeProvider> ) // Render ReactDOM.render(<VarnishApp />, document.getElementById('root'));
-
Clone the repository
git clone git@github.com:allenai/varnish.git cd varnish
-
Running the demo
yarn start
-
Testing the lib
yarn test
-
For contributors external to AI2, make a fork and request a pr from that fork
-
For contributors internal to AI2, please request access rights by contacting REVIZ, then make a pr for your updated branch
-
Build and publish NPM (will be done via google soon, but for now)
-
Update the package.json version field appropriately and create a git commit and tag for the version
npm version major|minor|patch
-
Publish the tag to github
git push --tags
-
Build the lib
yarn build
-
Publish to npm from the dist folder
npm publish --access public ./dist
-