import React from "react";
import { connect } from "redux-bundler-react";

const DefaultsToggle = (props) => {
  const { doToggleUserDefaultLayersAdd, layer } = props;
  const btnTxt = layer.userDefaultLayer ? "Remove From Defaults" : "Add to Defaults";

  return (
    <div>
      <button
        onClick={() => {
          doToggleUserDefaultLayersAdd(layer, !layer.defaultLayer);
        }}
        type="button"
        className="cm-btn cm-btn-xs cm-btn-default"
        title={btnTxt}
      >
        {btnTxt}
      </button>
    </div>
  );
};
export default connect("doToggleUserDefaultLayersAdd", DefaultsToggle);