@scripty/react-buttons
Advanced tools
+27
-3
@@ -8,3 +8,3 @@ "use strict"; | ||
| }); | ||
| exports.CancelButton = exports.OkButton = exports.CloseButton = exports.SaveButton = exports.EditButton = exports.MoveButton = exports.AddButton = exports.Button = void 0; | ||
| exports.DeleteButton = exports.CancelButton = exports.OkButton = exports.CloseButton = exports.SaveButton = exports.EditButton = exports.MoveButton = exports.AddButton = exports.Button = void 0; | ||
@@ -31,2 +31,4 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
| var _DeleteOutlined = _interopRequireDefault(require("@ant-design/icons/lib/icons/DeleteOutlined")); | ||
| var Button = function Button(props) { | ||
@@ -42,3 +44,4 @@ var onClick = props.onClick, | ||
| iconBtn = props.iconBtn, | ||
| restProps = (0, _objectWithoutProperties2["default"])(props, ["onClick", "children", "icon", "size", "color", "iconBtn"]); | ||
| rounded = props.rounded, | ||
| restProps = (0, _objectWithoutProperties2["default"])(props, ["onClick", "children", "icon", "size", "color", "iconBtn", "rounded"]); | ||
| var classes = "button button-default size-".concat(size, " color-").concat(color); | ||
@@ -51,2 +54,7 @@ | ||
| if (rounded) { | ||
| classes = classes + ' icon-btn rounded'; | ||
| children = ''; | ||
| } | ||
| return /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({}, restProps, { | ||
@@ -179,2 +187,18 @@ onClick: onClick, | ||
| exports.CancelButton = CancelButton; | ||
| exports.CancelButton = CancelButton; | ||
| var DeleteButton = function DeleteButton(props) { | ||
| var _props$size9 = props.size, | ||
| size = _props$size9 === void 0 ? 'small' : _props$size9, | ||
| onClick = props.onClick, | ||
| _props$label8 = props.label, | ||
| label = _props$label8 === void 0 ? 'Delete' : _props$label8, | ||
| restProps = (0, _objectWithoutProperties2["default"])(props, ["size", "onClick", "label"]); | ||
| return /*#__PURE__*/_react["default"].createElement(Button, (0, _extends2["default"])({}, restProps, { | ||
| size: size, | ||
| icon: /*#__PURE__*/_react["default"].createElement(_DeleteOutlined["default"], null), | ||
| onClick: onClick | ||
| }), label); | ||
| }; | ||
| exports.DeleteButton = DeleteButton; |
+7
-2
@@ -136,6 +136,11 @@ .button { | ||
| .icon-btn { | ||
| &.button { | ||
| min-width: 25px; | ||
| min-height: 25px; | ||
| } | ||
| border-radius: 50%; | ||
| padding: 0; | ||
| font-size: 12px; | ||
| width: 24px; | ||
| height: 24px; | ||
| width: 25px; | ||
| height: 25px; | ||
| .start-icon { | ||
@@ -142,0 +147,0 @@ margin: 0; |
+1
-1
| { | ||
| "name": "@scripty/react-buttons", | ||
| "version": "0.1.4", | ||
| "version": "0.1.5", | ||
| "author": "Danijel Garic", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+14
-0
@@ -9,2 +9,3 @@ import React from 'react'; | ||
| import CheckOutlined from '@ant-design/icons/lib/icons/CheckOutlined'; | ||
| import DeleteOutlined from '@ant-design/icons/lib/icons/DeleteOutlined'; | ||
@@ -19,2 +20,3 @@ export const Button = (props) => { | ||
| iconBtn, | ||
| rounded, | ||
| ...restProps | ||
@@ -30,2 +32,7 @@ } = props; | ||
| if (rounded) { | ||
| classes = classes + ' icon-btn rounded'; | ||
| children = ''; | ||
| } | ||
| return ( | ||
@@ -89,1 +96,8 @@ <button {...restProps} onClick={onClick} className={classes} type="submit"> | ||
| }; | ||
| export const DeleteButton = (props) => { | ||
| const { size = 'small', onClick, label = 'Delete', ...restProps } = props; | ||
| return ( | ||
| <Button {...restProps} size={size} icon={<DeleteOutlined/>} onClick={onClick}>{label}</Button> | ||
| ); | ||
| }; |
+7
-2
@@ -136,6 +136,11 @@ .button { | ||
| .icon-btn { | ||
| &.button { | ||
| min-width: 25px; | ||
| min-height: 25px; | ||
| } | ||
| border-radius: 50%; | ||
| padding: 0; | ||
| font-size: 12px; | ||
| width: 24px; | ||
| height: 24px; | ||
| width: 25px; | ||
| height: 25px; | ||
| .start-icon { | ||
@@ -142,0 +147,0 @@ margin: 0; |
36515
4.42%345
10.22%