Sha256: f9b8b818b10bb36aa885c5c2bb0a28cf7ccf101030a72b517f731b87c32daa50

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

const UIPageActions = ({ label, disabled, secondaryButtons, secondaryHref, secondaryLabel }) => {

  const buttonClassName = classNames({
    'btn': true,
    'btn-primary': !disabled,
    'disabled': disabled
  });

  let secondaryElement = null;
  if(secondaryButtons) {
    secondaryElement = (
      <div className="ui-page-actions__secondary">
        <div className="button-group">
          {secondaryButtons}
        </div>
      </div>
    );
  } else if(secondaryHref) {
    secondaryElement = (
      <div className="ui-page-actions__secondary">
        <div className="button-group">
          <a className="btn" href={secondaryHref}>{secondaryLabel}</a>
        </div>
      </div>
    );
  }

  return (
    <div className="ui-page-actions">
      {secondaryElement}
      <div className="ui-page-actions__primary">
        <div className="button-group button-group--right-aligned">
          <button name="button" type="submit" className={buttonClassName} disabled={disabled}>
            {label}
          </button>
        </div>
      </div>
    </div>
  );
};

UIPageActions.propTypes = {
  label: React.PropTypes.string.isRequired,
  disabled: React.PropTypes.bool,
  secondaryButtons: React.PropTypes.node,
  secondaryHref: React.PropTypes.string,
  secondaryLabel: React.PropTypes.string
};

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
disco_app-0.9.6 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.9.7 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.9.8 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.9.9 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.9.10 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.9.11 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.10.0 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.10.1 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.10.2 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx
disco_app-0.10.3 app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx