Skip to content
Permalink
Browse files

fix(Base): Allow width and height to be added to element for canvas

  • Loading branch information...
HHogg committed Feb 18, 2019
1 parent 973657d commit 674cd767eaad69913b51149134f33083a25ae82f
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/Base/Base.js
@@ -78,7 +78,10 @@ export default class Base extends Component {
/** Applies display styling */
display: PropTypes.oneOf(['block', 'inline-block']),
/** Fixed height applied through inline styling */
height: PropTypes.string,
height: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]),
/** Forwarded React ref function */
innerRef: PropTypes.func,
/** Margins applied for the global spacing variables */
@@ -105,7 +108,10 @@ export default class Base extends Component {
*/
theme: PropTypes.oneOf(['day', 'night']),
/** Fixed width applied through inline styling */
width: PropTypes.string,
width: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]),
/** z-index number for layering elements. */
zIndex: PropTypes.string,
};
@@ -164,6 +170,11 @@ export default class Base extends Component {
// refs for component compositions.
rest[typeof Component === 'string' ? 'ref' : 'innerRef'] = innerRef;

if (typeof Component === 'string' && Component === 'canvas') {
if (height) rest.height = height;
if (width) rest.width = width;
}

return (
<Component { ...rest }
className={ classes }

0 comments on commit 674cd76

Please sign in to comment.
You can’t perform that action at this time.