UNPKG

fk-react-ui-components

Version:

Step 1 : Create a file in [ Seeds / Plants / Trees ] <br> Step 2 : It should export an Object with component name and story Component [Refer other components] <br> Step 3 : Story Component should return a react component <br> Step 3 : Created file should

91 lines (86 loc) 2.71 kB
import React from "react"; import styled from "styled-components"; import {colors} from "../../colorCodes" const ButtonStyled = styled.button` position: ${(props) => props.position}; right: ${(props) => props.right || "0"}; bottom: ${(props) => props.bottom || "0"}; min-width: 70px; width: ${(props) => props.width}; border-radius: 2px; display: inline-block; margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; background-color: ${(props) => props.bgColor || colors.whiteText}; color: ${(props) => props.color || colors.brandBlue}; border: 1px solid ${(props) => props.border || colors.brandBlue}; white-space: nowrap; padding: ${(props) => props.padding || "6px 12px"}; font-size: ${(props) => props.fontSize || "12px"}; line-height: 1.42857143; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; float: ${(props) => props.float || "none"}; margin: ${(props) => props.margin || "0"}; outline: none; &:disabled{ background-color: rgb(192,192,192); color: rgb(51, 51, 51); border: 1px solid transparent; } `; const AnchorStyled = styled.a` position: ${(props) => props.position}; right: ${(props) => props.right || "0"}; bottom: ${(props) => props.bottom || "0"}; min-width: 70px; width: ${(props) => props.width}; border-radius: 2px; display: inline-block; margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; background-color: ${(props) => props.bgColor || colors.whiteText}; color: ${(props) => props.color}; border: 1px solid ${(props) => props.border|| "transparent"}; white-space: nowrap; padding: ${(props) => props.padding || "6px 12px"}; font-size: 12px; line-height: 1.42857143; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; float: ${(props) => props.float || "none"}; margin: ${(props) => props.margin || "0"}; outline: none; `; class Button extends React.Component { constructor(props) { super(props); // FOR NOW ITS A WRAPPER FOR STYLES ONLY } render() { {return this.props.isAnchor ? <AnchorStyled {...this.props}> {this.props.children} </AnchorStyled> : <ButtonStyled {...this.props}> {this.props.children} </ButtonStyled>} } } export default Button