Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
feat(Logo): Add iconOnly prop to only get icon
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Icon API changed: now takes `height` instead of `width`
  • Loading branch information
Andreas Broström authored and bstream committed May 18, 2017
1 parent 04c80c2 commit 339e513
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 177 deletions.
28 changes: 15 additions & 13 deletions src/components/logo/logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@ import PropTypes from 'prop-types';
import React from 'react';
import NordnetLogo from './nordnetLogo';

function Logo(props) {
return (
<NordnetLogo
className={props.className}
style={props.style}
height={props.width * 0.204}
width={props.width}
fill={props.iconColor}
stroke={props.textColor}
/>
);
function Logo({ onlyIcon, height, iconColor, textColor, ...rest }) {
const logoProps = {
height,
width: onlyIcon ? height : height * 4.89,
fill: iconColor,
stroke: textColor,
viewBox: onlyIcon ? '0 0 64 64' : undefined,
...rest,
};

return <NordnetLogo {...logoProps} />;
}

Logo.defaultProps = {
iconColor: '#00A9EC',
textColor: '#222222',
width: 130,
onlyIcon: false,
height: 27,
};

Logo.propTypes = {
className: PropTypes.string,
onlyIcon: PropTypes.bool,
style: PropTypes.object,
iconColor: PropTypes.string,
textColor: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number,
};

export default Logo;
8 changes: 6 additions & 2 deletions src/components/logo/logo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Simple logo with default size.

<Logo />

Change size with the `width` prop.
Change size with the `height` prop.

<Logo width={50} />
<Logo height={14} />

Set `onlyIcon` prop to only show the icon.

<Logo onlyIcon />
Loading

0 comments on commit 339e513

Please sign in to comment.