@arcteryx/components-button
Advanced tools
Comparing version 1.33.0 to 1.33.1
@@ -83,3 +83,2 @@ 'use strict'; | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href"]; | ||
const SUBTLE = "Subtle"; | ||
@@ -91,2 +90,22 @@ const SECONDARY = "Secondary-cta"; | ||
const FINDINSTORE = "Find-In-Store"; | ||
const widthValue = _ref => { | ||
let { | ||
width, | ||
context | ||
} = _ref; | ||
if (width) { | ||
return `${width}`; | ||
} | ||
switch (context) { | ||
case ADDTOCART: | ||
case EMAIL: | ||
case SECURE: | ||
return "100%;"; | ||
default: | ||
return "auto"; | ||
} | ||
}; | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href", "width"]; | ||
const ButtonWrapper = styled__default["default"].div` | ||
@@ -97,3 +116,3 @@ position: relative; | ||
justify-content:center; | ||
width: ${props => props.context === ADDTOCART || props.context === EMAIL || props.context === SECURE ? "100%;" : "auto"}; | ||
width: ${props => widthValue(props)}; | ||
max-width: ${props => props.context === ADDTOCART && "400px" || props.context === SECURE && "100%"}; | ||
@@ -257,3 +276,4 @@ height: 45px; | ||
children, | ||
href = "" | ||
href = "", | ||
width | ||
} = _ref, | ||
@@ -283,3 +303,4 @@ otherProps = _objectWithoutProperties(_ref, _excluded); | ||
context: context, | ||
disabled: disabled | ||
disabled: disabled, | ||
width: width | ||
}, otherProps), isWaiting ? /*#__PURE__*/React__default["default"].createElement(LoadingIcon, null) : null, /*#__PURE__*/React__default["default"].createElement("span", null, children)); | ||
@@ -286,0 +307,0 @@ }; |
@@ -72,3 +72,2 @@ import React from 'react'; | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href"]; | ||
const SUBTLE = "Subtle"; | ||
@@ -80,2 +79,22 @@ const SECONDARY = "Secondary-cta"; | ||
const FINDINSTORE = "Find-In-Store"; | ||
const widthValue = _ref => { | ||
let { | ||
width, | ||
context | ||
} = _ref; | ||
if (width) { | ||
return `${width}`; | ||
} | ||
switch (context) { | ||
case ADDTOCART: | ||
case EMAIL: | ||
case SECURE: | ||
return "100%;"; | ||
default: | ||
return "auto"; | ||
} | ||
}; | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href", "width"]; | ||
const ButtonWrapper = styled.div` | ||
@@ -86,3 +105,3 @@ position: relative; | ||
justify-content:center; | ||
width: ${props => props.context === ADDTOCART || props.context === EMAIL || props.context === SECURE ? "100%;" : "auto"}; | ||
width: ${props => widthValue(props)}; | ||
max-width: ${props => props.context === ADDTOCART && "400px" || props.context === SECURE && "100%"}; | ||
@@ -246,3 +265,4 @@ height: 45px; | ||
children, | ||
href = "" | ||
href = "", | ||
width | ||
} = _ref, | ||
@@ -272,3 +292,4 @@ otherProps = _objectWithoutProperties(_ref, _excluded); | ||
context: context, | ||
disabled: disabled | ||
disabled: disabled, | ||
width: width | ||
}, otherProps), isWaiting ? /*#__PURE__*/React.createElement(LoadingIcon, null) : null, /*#__PURE__*/React.createElement("span", null, children)); | ||
@@ -275,0 +296,0 @@ }; |
@@ -85,3 +85,2 @@ (function (global, factory) { | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href"]; | ||
const SUBTLE = "Subtle"; | ||
@@ -93,2 +92,22 @@ const SECONDARY = "Secondary-cta"; | ||
const FINDINSTORE = "Find-In-Store"; | ||
const widthValue = _ref => { | ||
let { | ||
width, | ||
context | ||
} = _ref; | ||
if (width) { | ||
return `${width}`; | ||
} | ||
switch (context) { | ||
case ADDTOCART: | ||
case EMAIL: | ||
case SECURE: | ||
return "100%;"; | ||
default: | ||
return "auto"; | ||
} | ||
}; | ||
const _excluded = ["market", "context", "type", "size", "disabled", "isWaiting", "onClick", "className", "id", "style", "children", "href", "width"]; | ||
const ButtonWrapper = styled__default["default"].div` | ||
@@ -99,3 +118,3 @@ position: relative; | ||
justify-content:center; | ||
width: ${props => props.context === ADDTOCART || props.context === EMAIL || props.context === SECURE ? "100%;" : "auto"}; | ||
width: ${props => widthValue(props)}; | ||
max-width: ${props => props.context === ADDTOCART && "400px" || props.context === SECURE && "100%"}; | ||
@@ -259,3 +278,4 @@ height: 45px; | ||
children, | ||
href = "" | ||
href = "", | ||
width | ||
} = _ref, | ||
@@ -285,3 +305,4 @@ otherProps = _objectWithoutProperties(_ref, _excluded); | ||
context: context, | ||
disabled: disabled | ||
disabled: disabled, | ||
width: width | ||
}, otherProps), isWaiting ? /*#__PURE__*/React__default["default"].createElement(LoadingIcon, null) : null, /*#__PURE__*/React__default["default"].createElement("span", null, children)); | ||
@@ -288,0 +309,0 @@ }; |
{ | ||
"name": "@arcteryx/components-button", | ||
"version": "1.33.0", | ||
"version": "1.33.1", | ||
"description": "Arcteryx Button", | ||
@@ -18,3 +18,3 @@ "source": "src/index.js", | ||
"license": "ISC", | ||
"gitHead": "8af52b54a21d29cf1e0e2e70b94c5c656b3260f7", | ||
"gitHead": "538344637d1cf52dd13fbf2d447acedbe071c23e", | ||
"files": [ | ||
@@ -21,0 +21,0 @@ "dist", |
@@ -6,10 +6,5 @@ import React from "react"; | ||
import LoadingIcon from "./LoadingIcon"; | ||
import { ADDTOCART, EMAIL, SECURE, SUBTLE, FINDINSTORE, SECONDARY } from "../constants"; | ||
import { widthValue } from '../helpers'; | ||
const SUBTLE = "Subtle"; | ||
const SECONDARY = "Secondary-cta"; | ||
const SECURE = "Secure-Checkout"; | ||
const ADDTOCART = "Add-To-Cart"; | ||
const EMAIL = "Email"; | ||
const FINDINSTORE = "Find-In-Store"; | ||
const ButtonWrapper = styled.div` | ||
@@ -20,4 +15,3 @@ position: relative; | ||
justify-content:center; | ||
width: ${(props) => | ||
props.context === ADDTOCART || props.context === EMAIL || props.context === SECURE ? "100%;" : "auto"}; | ||
width: ${(props) => widthValue(props)}; | ||
max-width: ${(props) => (props.context === ADDTOCART && "400px") || (props.context === SECURE && "100%")}; | ||
@@ -196,2 +190,3 @@ height: 45px; | ||
href = "", | ||
width, | ||
...otherProps | ||
@@ -225,2 +220,3 @@ }) => { | ||
disabled={disabled} | ||
width={width} | ||
{...otherProps} | ||
@@ -227,0 +223,0 @@ > |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111278
17
1720