import * as React from 'react'; import { Button as CoreButton, ButtonProps as CoreButtonProps } from 'wix-ui-core/dist/src/components/deprecated/button'; import { enumValues } from '../../utils'; import style from './Button.st.css'; import { Skin, Priority, Size } from './constants'; import { Text, TextProps, TextSkin, TextSize } from '../Text'; export interface ButtonOwnProps extends CoreButtonProps { /**Skin of the Button (Styling)*/ skin?: Skin; /** Priority of the Button (Styling)*/ priority?: Priority; /** Size of the button (Styling) */ size?: Size; /** The button's text */ children?: string; } export type ButtonProps = ButtonOwnProps & CoreButtonProps; const toTextColorProps: { [k in Priority]: { [y in Skin]: Pick } } = { [Priority.primary]: { [Skin.standard]: { skin: TextSkin.standard, light: true }, [Skin.white]: { skin: TextSkin.standard, light: false }, [Skin.destructive]: { skin: TextSkin.standard, light: true }, [Skin.premium]: { skin: TextSkin.standard, light: true } }, [Priority.secondary]: { [Skin.standard]: { skin: TextSkin.standard, light: false }, [Skin.white]: { skin: TextSkin.standard, light: true }, [Skin.destructive]: { skin: TextSkin.error, light: false }, [Skin.premium]: { skin: TextSkin.premium, light: false } } }; export const Button: React.SFC = props => { const { children, skin, priority, size, ...rest } = props; const textColorProps = toTextColorProps[priority][skin]; const textSize = size === Size.large || size === Size.medium ? TextSize.medium : TextSize.small; return ( {children} ); }; Button.displayName = 'Button'; Button.defaultProps = { skin: Skin.standard, priority: Priority.primary, size: Size.medium };