Skip to content

Commit

Permalink
removing MediaObject from KitchenSink because it has problems, changi…
Browse files Browse the repository at this point in the history
…ng some example icons to work with icomoon too, fixing BrowserSupportWarning isomorphism issues
  • Loading branch information
jwietelmann committed Dec 15, 2016
1 parent 93f80a8 commit ce1ee05
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.node-version
node_modules/
docs/**/*
!docs/.keep
npm-debug.log
4 changes: 2 additions & 2 deletions src/Badge.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export class Icons extends Component {
render() {
return (
<div>
<Badge icon="x" />
<Badge warning icon="x">ERROR</Badge>
<Badge icon="home" />
<Badge warning icon="home">ERROR</Badge>
</div>
)
}
Expand Down
17 changes: 13 additions & 4 deletions src/BrowserSupportWarning.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import bowser from 'bowser'
import classNames from 'classnames'

export default class BrowserSupportWarning extends Component {
render() {
const {minVersions, className, children} = this.props

state = {isSupported: null}

componentDidMount() {
const {minVersions} = this.props
const userAgent = this.props.userAgent || (typeof(window) !== 'undefined' && window.navigator.userAgent) || null
const isSupported = userAgent ? bowser.check(this.props.minVersions, this.userAgent) : true
if(isSupported) {
this.setState({isSupported})
}

render() {
const {isSupported} = this.state
if(isSupported === null || isSupported) {
return null
}
const {className, children} = this.props
const divClassName = classNames(className, 'rev-BrowserSupportWarning')
return <div className={divClassName}>{this.props.children}</div>
return <div className={divClassName}>{children}</div>
}
}
2 changes: 1 addition & 1 deletion src/Icon.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Row, Col} from './grid'
export class Basic extends Component {
render() {
return (
<Icon className="stat" i="bitcoin" />
<Icon className="stat" i="home" />
)
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/KitchenSink.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ add('ButtonGroup', ButtonGroup)
import * as Icon from './Icon.example'
add('Icon', Icon)

import * as MediaObject from './MediaObject.example'
add('MediaObject', MediaObject)

import * as Menu from './Menu.example'
add('Menu', Menu)

Expand Down
4 changes: 2 additions & 2 deletions src/Label.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class Icons extends Component {
render() {
return (
<div>
<Label icon="x" />
<Label warning icon="x">ERROR</Label>
<Label icon="home" />
<Label warning icon="home">ERROR</Label>
</div>
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/Menu.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ export class IconsOnTop extends Component {
render() {
return (
<Menu iconTop>
<Menu.Item><a href="#"><Icon i="list" /> <span>One</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="list" /> <span>Two</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="list" /> <span>Three</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="list" /> <span>Four</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="home" /> <span>One</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="home" /> <span>Two</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="home" /> <span>Three</span></a></Menu.Item>
<Menu.Item><a href="#"><Icon i="home" /> <span>Four</span></a></Menu.Item>
</Menu>
)
}
Expand Down

0 comments on commit ce1ee05

Please sign in to comment.