How to use @crave/farmblocks-button - 10 common examples

To help you get started, we’ve selected a few @crave/farmblocks-button examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CraveFood / farmblocks / packages / input-text / src / protectedValue.js View on Github external
id="cancel-button"
                onClick={this.onCancel}
                size={buttonSizes.MEDIUM}
              >
                {cancelButtonText}
              
              <button id="save-button"> {
                  this.onReplace(this.state.editedValue);
                }}
                onMouseDown={e =&gt; {
                  // We do this in order to avoid onBlur event on input
                  e.preventDefault();
                }}
                type={buttonTypes.SECONDARY}
                size={buttonSizes.MEDIUM}
              &gt;
                {saveButtonText}
              </button>
            
          )}
        
      );
    }
  };
github CraveFood / farmblocks / packages / input-text / src / protectedValue.js View on Github external
onClick={this.onCancel}
                size={buttonSizes.MEDIUM}
              &gt;
                {cancelButtonText}
              
              <button id="save-button"> {
                  this.onReplace(this.state.editedValue);
                }}
                onMouseDown={e =&gt; {
                  // We do this in order to avoid onBlur event on input
                  e.preventDefault();
                }}
                type={buttonTypes.SECONDARY}
                size={buttonSizes.MEDIUM}
              &gt;
                {saveButtonText}
              </button>
            
          )}
        
      );
    }
  };
github CraveFood / farmblocks / packages / tooltip / src / TooltipContent.story.js View on Github external
.add("Top positioned", () =&gt; {
    const marginStyle = {
      margin: "40px",
      border: "none",
    };
    return (
      <div style="{{">
        <div style="{{">
          <div style="{marginStyle}">
            <button type="{buttonTypes.SECONDARY}">Trigger Ref</button>
            
          </div>

          <div style="{marginStyle}">
            <button type="{buttonTypes.SECONDARY}">Trigger Ref</button>

            </div></div></div>
github CraveFood / farmblocks / packages / amount-selectors / src / components / AmountSelectors.js View on Github external
maxAmountMessage,
      showBoundariesMessageOnlyOnFocus,
      size,
    } = this.props;
    const { focused, value } = this.state;
    const showMessage = !showBoundariesMessageOnlyOnFocus || focused;
    const showMaxMessage = value &gt; max &amp;&amp; showMessage;
    const showMinMessage = value &lt; min &amp;&amp; showMessage;
    const showTooltipMessage =
      (showMaxMessage &amp;&amp; maxAmountMessage) ||
      (showMinMessage &amp;&amp; minAmountMessage);
    return (
      
        <button size="{selectorSizeToButtonSize[size]}" type="{buttonTypes.SECONDARY}">}
          disabled={
            disabled || this.state.disableBoth || value &lt;= this.props.min
          }
          onClick={this.decrement}
          tooltipText={this.state.tooltipText}
        /&gt;
        <div>
          </div></button>
github CraveFood / farmblocks / packages / table / src / Table.story.js View on Github external
customCell={() =&gt; (
          <div>
            <button type="{buttonTypes.SECONDARY}" size="{buttonSizes.MEDIUM}">}
              onClick={action(`button clicked`)}
            &gt;
              Message
            </button>
          </div>
        )}
      /&gt;
github CraveFood / farmblocks / packages / empty-state / src / EmptyState.story.js View on Github external
import { action } from "@storybook/addon-actions";
import { storiesOf } from "@storybook/react";
import { buttonTypes } from "@crave/farmblocks-button";
import { MdOrders, MdAlert, MdFavoriteHeartFull } from "@crave/farmblocks-icon";

import EmptyState from "./EmptyState";

const twoLinesDescription =
  "Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Etiam porta sem malesuada magna mollis euismod.";

const imgSrc = "https://picsum.photos/200?image=0";

const primaryAction = {
  text: "Primary Action",
  onClick: action("onPrimaryActionClick"),
  type: buttonTypes.SECONDARY,
  icon: ,
};

const secondaryAction = {
  text: "Secondary Action",
  onClick: action("onSecondaryActionClick"),
  type: buttonTypes.NEUTRAL,
};

storiesOf("EmptyState", module)
  .add("Default", () =&gt; (
    
  ))
  .add("Long Title, inside a container", () =&gt; (
    <div style="{{">
      </div>
github CraveFood / farmblocks / packages / modal / src / DialogModal.story.js View on Github external
import React from "react";
import { action } from "@storybook/addon-actions";
import { storiesOf } from "@storybook/react";
import { buttonTypes } from "@crave/farmblocks-button";
import { MdAlert, MdQuestion } from "@crave/farmblocks-icon";

import { DialogModal, useModal } from ".";

const primaryAction = {
  text: "Primary Action",
  onClick: action("onPrimaryActionClick"),
  type: buttonTypes.SECONDARY,
};

const secondaryAction = {
  text: "Secondary Action",
  onClick: action("onSecondaryActionClick"),
  type: buttonTypes.NEUTRAL,
};

storiesOf("Modal/DialogModal", module)
  .add("Image + two actions", () =&gt; (
github CraveFood / farmblocks / packages / tooltip / src / Tooltip.story.js View on Github external
trigger={<button type="{buttonTypes.SECONDARY}">Hover me</button>}
              content="Bottom left aligned"
            /&gt;
          

          <div style="{marginStyle}">
            Hover me}
              content={<div>Bottom left aligned</div>}
              positionX={POSITIONS.X.CENTER}
            /&gt;
          </div>

          <div style="{marginStyle}">
            Hover me}
              content={<div>Bottom right aligned</div>}
              positionX={POSITIONS.X.RIGHT}
            /&gt;
          </div>
        

        <div style="{{">
          <div style="{marginStyle}">
            Hover me}</div></div>
github CraveFood / farmblocks / packages / form-wrapper / src / FormWrapper.js View on Github external
type={linkTypes.NEUTRAL}
          onClick={props.onCancel}
          className="cancel"
        &gt;
          {props.cancelLabel}
        
      

      {props.children}

      <footer>
        <button loading="{props.loading}" size="{buttonSizes.MEDIUM}" type="{buttonTypes.SECONDARY}" id="{`${id}-save`}">
          {props.saveLabel}
        </button>
      </footer>

      {extraContent}
    
  );
};
github CraveFood / farmblocks / packages / dropdown / src / components / Dropdown.js View on Github external
zIndex={props.zIndex}
          width={props.width}
          maxHeight={props.maxHeight}
        &gt;
          <ul>{props.children}</ul>
        
      
    
  
);

Dropdown.defaultProps = {
  handleSelection: () =&gt; false,
  text: "",
  align: "left",
  size: buttonSizes.MEDIUM,
};

Dropdown.propTypes = {
  handleSelection: PropTypes.func,
  children: PropTypes.node.isRequired,
  text: PropTypes.string,
  align: PropTypes.oneOf(["left", "right"]),
  zIndex: PropTypes.number,
  size: PropTypes.oneOf(values(buttonSizes)),
  width: PropTypes.string,
  innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
  maxHeight: PropTypes.string,
  className: PropTypes.string,
};

export default Dropdown;