about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/components/column_link.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-01-21 13:20:20 +0100
committerGitHub <noreply@github.com>2018-01-21 13:20:20 +0100
commit31d148588737e5e5dc8aada7913884f226831fd1 (patch)
tree9ea1536536aecefb7946cfd0e3bbc128d07da46b /app/javascript/mastodon/features/ui/components/column_link.js
parent1287de1b83c45a972248a1375078f63f61009109 (diff)
Display number of follow requests in getting started menu, and (#6313)
if notifications column is not mounted, also display number of
unread notifications there.
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/column_link.js')
-rw-r--r--app/javascript/mastodon/features/ui/components/column_link.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/ui/components/column_link.js b/app/javascript/mastodon/features/ui/components/column_link.js
index a90616213..25c2d1cf8 100644
--- a/app/javascript/mastodon/features/ui/components/column_link.js
+++ b/app/javascript/mastodon/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, href, method }) => {
+const ColumnLink = ({ icon, text, to, 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 {
@@ -15,6 +18,7 @@ const ColumnLink = ({ icon, text, to, href, method }) => {
       <Link to={to} className='column-link'>
         <i className={`fa fa-fw fa-${icon} column-link__icon`} />
         {text}
+        {badgeElement}
       </Link>
     );
   }
@@ -26,6 +30,7 @@ ColumnLink.propTypes = {
   to: PropTypes.string,
   href: PropTypes.string,
   method: PropTypes.string,
+  badge: PropTypes.node,
 };
 
 export default ColumnLink;