You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					40 lines
				
				1.1 KiB
			
		
		
			
		
	
	
					40 lines
				
				1.1 KiB
			| 
											3 years ago
										 | "use strict"; | ||
|  | 
 | ||
|  | exports.__esModule = true; | ||
|  | exports["default"] = margin; | ||
|  | 
 | ||
|  | var _directionalProperty = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("../helpers/directionalProperty")); | ||
|  | 
 | ||
|  | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
|  | 
 | ||
|  | /** | ||
|  |  * Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions. | ||
|  |  * @example | ||
|  |  * // Styles as object usage
 | ||
|  |  * const styles = { | ||
|  |  *   ...margin('12px', '24px', '36px', '48px') | ||
|  |  * } | ||
|  |  * | ||
|  |  * // styled-components usage
 | ||
|  |  * const div = styled.div`
 | ||
|  |  *   ${margin('12px', '24px', '36px', '48px')} | ||
|  |  * `
 | ||
|  |  * | ||
|  |  * // CSS as JS Output
 | ||
|  |  * | ||
|  |  * div { | ||
|  |  *   'marginTop': '12px', | ||
|  |  *   'marginRight': '24px', | ||
|  |  *   'marginBottom': '36px', | ||
|  |  *   'marginLeft': '48px' | ||
|  |  * } | ||
|  |  */ | ||
|  | function margin() { | ||
|  |   for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
|  |     values[_key] = arguments[_key]; | ||
|  |   } | ||
|  | 
 | ||
|  |   return _directionalProperty["default"].apply(void 0, ['margin'].concat(values)); | ||
|  | } | ||
|  | 
 | ||
|  | module.exports = exports.default; |