// @flow import type { Node } from 'react'; import React, { forwardRef, useRef } from 'react'; import Icon from 'component/common/icon'; import classnames from 'classnames'; import { NavLink } from 'react-router-dom'; import { formatLbryUrlForWeb } from 'util/url'; import * as PAGES from 'constants/pages'; import useCombinedRefs from 'effects/use-combined-refs'; type Props = { id: ?string, href: ?string, title: ?string, label: ?string, largestLabel: ?string, icon: ?string, iconRight: ?string, disabled: ?boolean, children: ?Node, navigate: ?string, className: ?string, description: ?string, type: string, button: ?string, // primary, secondary, alt, link iconSize?: number, iconColor?: string, activeClass?: string, innerRef: ?any, authSrc?: string, // Events onClick: ?(any) => any, onMouseEnter: ?(any) => any, onMouseLeave: ?(any) => any, pathname: string, emailVerified: boolean, requiresAuth: ?boolean, myref: any, dispatch: any, 'aria-label'?: string, user: ?User, disableOnFatal?: boolean, fatal: boolean, }; // use forwardRef to allow consumers to pass refs to the button content if they want to // flow requires forwardRef have default type arguments passed to it const Button = forwardRef((props: Props, ref: any) => { const { type = 'button', onClick, href, title, label, largestLabel, icon, // This should rarely be used. Regular buttons should just use `icon` // `iconRight` is used for the header (home) button with the LBRY icon and external links that are displayed inline iconRight, disabled, children, navigate, className, description, button, iconSize, iconColor, activeClass, emailVerified, requiresAuth, myref, dispatch, // ); }); export default Button;