forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(loading): update to 7.x (carbon-design-system#559)
* refactor(loading): update to 7.x * fix(interior-left-nav): removed unused variable
- Loading branch information
1 parent
c9f0445
commit 3a0471a
Showing
3 changed files
with
83 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
/* global window */ | ||
|
||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
const propTypes = { | ||
active: React.PropTypes.bool, | ||
className: React.PropTypes.string, | ||
}; | ||
|
||
const defaultProps = { | ||
active: true, | ||
}; | ||
|
||
const Loading = ({ className, active, ...other }) => { | ||
const isIe = window.ActiveXObject || 'ActiveXObject' in window; | ||
|
||
const loadingClasses = classNames( | ||
'bx--loading', | ||
className, | ||
{ | ||
'bx--loading--ie': isIe, | ||
class Loading extends React.Component { | ||
static propTypes = { | ||
active: React.PropTypes.bool, | ||
className: React.PropTypes.string, | ||
withOverlay: React.PropTypes.bool, | ||
small: React.PropTypes.bool, | ||
}; | ||
|
||
static defaultProps = { | ||
active: true, | ||
withOverlay: true, | ||
small: false, | ||
}; | ||
|
||
render() { | ||
const { | ||
active, | ||
className, | ||
withOverlay, | ||
small, | ||
...other | ||
} = this.props; | ||
|
||
const loadingClasses = classNames('bx--loading', className, { | ||
'bx--loading--small': small, | ||
'bx--loading--stop': !active, | ||
'bx--loading--stop--ie': !active && isIe, | ||
}, | ||
); | ||
|
||
return ( | ||
<div {...other} className={loadingClasses}> | ||
<svg className="bx--loading__svg" viewBox="-75 -75 150 150"> | ||
<circle cx="0" cy="0" r="37.5" /> | ||
</svg> | ||
</div> | ||
); | ||
}; | ||
|
||
Loading.propTypes = propTypes; | ||
Loading.defaultProps = defaultProps; | ||
}); | ||
|
||
const loading = ( | ||
<div {...other} className={loadingClasses}> | ||
<svg className="bx--loading__svg" viewBox="-75 -75 150 150"> | ||
<circle cx="0" cy="0" r="37.5" /> | ||
</svg> | ||
</div> | ||
); | ||
|
||
return withOverlay | ||
? <div className="bx--loading-overlay"> | ||
{loading} | ||
</div> | ||
: loading; | ||
} | ||
} | ||
|
||
export default Loading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters