diff options
author | Gô Shoemake <marrus-sh@users.noreply.github.com> | 2018-03-12 13:07:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-12 13:07:59 -0700 |
commit | 2395a4c31323e5c1433fbf232cd6c52e516a72f5 (patch) | |
tree | a03242a97bae1b1accaf596abeb0caa5322001f3 /app/javascript/flavours/glitch/features/ui/components | |
parent | a0724cd7426dec36b7966c86a1708f62e6e5fd4c (diff) | |
parent | 0ddeed9377d69de8398973c253cc1a7c9f8d5a80 (diff) |
Merge pull request #344 from chriswmartin/getting-started-badge-merge
merge tootsuite pr #6313 into glitch & move getting_started dispatch stuff to mapDispatchToProps
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components')
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/column_link.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/column_link.js b/app/javascript/flavours/glitch/features/ui/components/column_link.js index b845d1895..b058aa963 100644 --- a/app/javascript/flavours/glitch/features/ui/components/column_link.js +++ b/app/javascript/flavours/glitch/features/ui/components/column_link.js @@ -2,12 +2,15 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; -const ColumnLink = ({ icon, text, to, onClick, href, method }) => { +const ColumnLink = ({ icon, text, to, onClick, href, method, badge }) => { + const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null; + if (href) { return ( <a href={href} className='column-link' data-method={method}> <i className={`fa fa-fw fa-${icon} column-link__icon`} /> {text} + {badgeElement} </a> ); } else if (to) { @@ -15,6 +18,7 @@ const ColumnLink = ({ icon, text, to, onClick, href, method }) => { <Link to={to} className='column-link'> <i className={`fa fa-fw fa-${icon} column-link__icon`} /> {text} + {badgeElement} </Link> ); } else { @@ -22,6 +26,7 @@ const ColumnLink = ({ icon, text, to, onClick, href, method }) => { <a onClick={onClick} className='column-link' role='button' tabIndex='0' data-method={method}> <i className={`fa fa-fw fa-${icon} column-link__icon`} /> {text} + {badgeElement} </a> ); } @@ -34,6 +39,7 @@ ColumnLink.propTypes = { onClick: PropTypes.func, href: PropTypes.string, method: PropTypes.string, + badge: PropTypes.node, }; export default ColumnLink; |