diff --git a/.babelrc b/.babelrc index 4ef551af..42017378 100644 --- a/.babelrc +++ b/.babelrc @@ -16,4 +16,4 @@ ] } } -} \ No newline at end of file +} diff --git a/components/app_bar/AppBar.js b/components/app_bar/AppBar.js index c17d2d46..fe625368 100644 --- a/components/app_bar/AppBar.js +++ b/components/app_bar/AppBar.js @@ -1,11 +1,11 @@ import React from 'react'; -import ClassNames from 'classnames'; -import style from './style'; +import { themr } from 'react-css-themr'; +import classnames from 'classnames'; -const AppBar = (props) => { - const className = ClassNames(style.root, { - [style.fixed]: props.fixed, - [style.flat]: props.flat +const AppBar = ({ theme, ...props }) => { + const className = classnames(theme.appBar, { + [theme.fixed]: props.fixed, + [theme.flat]: props.flat }, props.className); return ( @@ -19,7 +19,12 @@ AppBar.propTypes = { children: React.PropTypes.node, className: React.PropTypes.string, fixed: React.PropTypes.bool, - flat: React.PropTypes.bool + flat: React.PropTypes.bool, + theme: React.PropTypes.shape({ + appBar: React.PropTypes.string.isRequired, + fixed: React.PropTypes.string.isRequired, + flat: React.PropTypes.string.isRequired + }) }; AppBar.defaultProps = { @@ -28,4 +33,4 @@ AppBar.defaultProps = { flat: false }; -export default AppBar; +export default themr('ToolboxAppBar')(AppBar); diff --git a/components/app_bar/readme.md b/components/app_bar/readme.md index 6e41073c..706c72e7 100644 --- a/components/app_bar/readme.md +++ b/components/app_bar/readme.md @@ -4,17 +4,16 @@ The app bar is a special kind of toolbar that’s used for branding, navigation, ```jsx import AppBar from 'react-toolbox/lib/app_bar'; +import theme from 'react-toolbox/lib/app_bar/style'; const AppBarTest = () => ( - + React Toolbox Docs ); ``` -Coming soon, the `AppBar` component will support arbitrary content attributes for left and right content and a title, for now it's just a wrapper. - ## Properties | Name | Type | Default | Description| @@ -22,3 +21,12 @@ Coming soon, the `AppBar` component will support arbitrary content attributes fo | `className` | `String` | `''` | Set a class for the root component.| | `fixed` | `Bool` | `false` | Determine if the bar should have position `fixed` or `relative`.| | `flat` | `Bool` | `false` | If true, the AppBar shows a shadow.| +| `theme` | `Object` | `null` | Classnames object defining the component style.| + +## Theme interface + +| Name | Description| +|:---------|:-----------| +| `appBar` | Root class.| +| `fixed` | Implemented when the app bar is fixed.| +| `flat` | Implemented when the app bar is flat.| diff --git a/components/app_bar/style.scss b/components/app_bar/theme.scss similarity index 97% rename from components/app_bar/style.scss rename to components/app_bar/theme.scss index 762232af..50ad328b 100644 --- a/components/app_bar/style.scss +++ b/components/app_bar/theme.scss @@ -1,7 +1,7 @@ @import "../base"; @import "./config"; -.root { +.appBar { display: flex; height: $appbar-height; align-items: center; diff --git a/package.json b/package.json index 45446e00..ba10456f 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "toolkit" ], "dependencies": { - "classnames": "^2.2.5" + "classnames": "^2.2.5", + "react-css-themr": "^1.0.0" }, "devDependencies": { "autoprefixer": "^6.3.6", diff --git a/spec/root.js b/spec/root.js index 9757351d..ac2d4a30 100644 --- a/spec/root.js +++ b/spec/root.js @@ -1,5 +1,8 @@ /* global VERSION */ import React from 'react'; +import { ThemeProvider } from 'react-css-themr'; +import theme from './theme'; + import AppBarToolbox from '../components/app_bar'; import Avatar from './components/avatar'; import ButtonToolbox from '../components/button'; @@ -27,47 +30,45 @@ import Tabs from './components/tabs'; import Tooltip from './components/tooltip'; import style from './style'; -const _hrefProject = () => { - window.href = 'http://react-toolbox'; -}; - const Root = () => ( -
- -

React Toolbox Spec {VERSION}

- -
+ +
+ +

React Toolbox Spec {VERSION}

+ {window.href = 'http://react-toolbox';}} + /> +
- - -