import * as React from 'react'; import { ButtonProps } from 'react-bootstrap'; import { Icon, IconSize } from 'react-fa'; import { CommandButton, CommandButtonProps, } from '../CommandButton/CommandButton'; export interface NavButtonProps extends CommandButtonProps { iconSize?: IconSize; iconName?: string; componentProps?: any; compact?: boolean; } export interface NavButtonComponentProps extends ButtonProps, NavButtonProps {} export class NavButton extends React.Component { public static displayName = 'NavButton'; static defaultProps: Partial = { bsStyle: 'link', iconSize: 'lg', iconName: 'chevron-right', }; render() { const { compact, componentProps } = this.props; if (compact) { return (
{this.renderButton()}
); } return (
{this.renderContent()} {this.renderButton()}
); } protected renderContent() { return
{this.props.children}
; } protected renderButton() { const { className, props, rest } = this.restProps(x => { const { iconSize, iconName, componentProps, compact } = x; return { iconSize, iconName, componentProps, compact }; }); return ( ); } }