Skip to content

Commit

Permalink
feat: CSidebarNavItem: add possibility of passing icon as node
Browse files Browse the repository at this point in the history
  • Loading branch information
woothu committed Jul 17, 2020
1 parent 4de6508 commit 520dc49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/template/CSidebarNavItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { isValidElement } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import { CLink, CBadge } from '../index'
Expand Down Expand Up @@ -35,7 +35,7 @@ const CSidebarNavItem = props => {
addLinkClass
)

const routerLinkProps = rest.to && { exact: true, activeClassName: 'c-active'}
const routerLinkProps = rest.to && { exact: true, activeClassName: 'c-active' }
return (
<li className={classes} ref={innerRef}>
{ children ||
Expand All @@ -44,7 +44,7 @@ const CSidebarNavItem = props => {
{...routerLinkProps}
{...rest}
>
{ icon && <CIcon {...iconProps(icon)}/>}
{ icon && isValidElement(icon) ? icon : <CIcon {...iconProps(icon)}/> }
{ fontIcon && <i className={`c-sidebar-nav-icon ${fontIcon}`}/>}
{name}
{ badge && <CBadge {...{...badge, text: null}}>{badge.text}</CBadge>}
Expand Down

0 comments on commit 520dc49

Please sign in to comment.