import * as React from 'react'; import * as classnames from 'classnames'; import style from './FloatingHelperContent.st.css'; import { Text } from '../../../components/Text'; import { DataHooks } from './DataHooks'; import { ButtonProps, ButtonSkin, ButtonPriority, ButtonSize } from '../../Button'; import { ButtonNext } from 'wix-ui-core/button-next'; import { button } from 'wix-ui-core/themes/backoffice'; import { ActionButtonTheme } from './constants'; import { Appearance } from '../constants'; export interface FloatingHelperContentProps { /** Adds text as the title */ title?: string; /** Adds text as the body */ body: string; /** Sets the text of the action button. Needs to be a non-empty string (and onActionClick prop has to be passed) in order for the action button to appear */ actionText?: string; /** Sets the theme of the action button */ actionTheme?: ActionButtonTheme; /** Custom footer node */ footer?: React.ReactNode; /** When both onActionClick & actionText are provided, will make an action button appear and invoke onActionClick() upon click */ onActionClick?: () => void; /** Adds an image */ image?: React.ReactNode; /* Appearance : `dark` or `light`. */ appearance?: Appearance; } const themeToButtonProps: { [key in ActionButtonTheme]: Pick; } = { [ActionButtonTheme.white]: { skin: ButtonSkin.white, priority: ButtonPriority.secondary }, [ActionButtonTheme.standard]: { skin: ButtonSkin.standard, priority: ButtonPriority.secondary }, [ActionButtonTheme.premium]: { skin: ButtonSkin.premium, priority: ButtonPriority.primary }, [ActionButtonTheme.lightPrimary]: { skin: ButtonSkin.white, priority: ButtonPriority.primary } }; export const FloatingHelperContent: React.SFC = ( props: FloatingHelperContentProps ) => { const { title, body, actionText, onActionClick, actionTheme, image, appearance, footer } = props; return (
{title && (
{title}
)} {body && (
{body}
)} {actionText && onActionClick && actionText.length > 0 && ( {actionText} )} {footer && (
{footer}
)}
{image && (
{image}
)}
); }; FloatingHelperContent.defaultProps = { actionTheme: ActionButtonTheme.white, appearance: Appearance.dark };