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.
		
		
		
		
		
			
		
			
				
					31 lines
				
				799 B
			
		
		
			
		
	
	
					31 lines
				
				799 B
			| 
											3 years ago
										 | // @flow | ||
|  | import directionalProperty from '../helpers/directionalProperty' | ||
|  | 
 | ||
|  | import type { Styles } from '../types/style' | ||
|  | 
 | ||
|  | /** | ||
|  |  * 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 = { | ||
|  |  *   ...borderWidth('12px', '24px', '36px', '48px') | ||
|  |  * } | ||
|  |  * | ||
|  |  * // styled-components usage | ||
|  |  * const div = styled.div` | ||
|  |  *   ${borderWidth('12px', '24px', '36px', '48px')} | ||
|  |  * ` | ||
|  |  * | ||
|  |  * // CSS as JS Output | ||
|  |  * | ||
|  |  * div { | ||
|  |  *   'borderTopWidth': '12px', | ||
|  |  *   'borderRightWidth': '24px', | ||
|  |  *   'borderBottomWidth': '36px', | ||
|  |  *   'borderLeftWidth': '48px' | ||
|  |  * } | ||
|  |  */ | ||
|  | export default function borderWidth(...values: Array<?string | ?number>): Styles { | ||
|  |   return directionalProperty('borderWidth', ...values) | ||
|  | } |