1234567891011121314151617181920212223242526272829 |
- // @flow
- import type { Styles } from '../types/style'
- /**
- * Shorthand to set the height and width properties in a single statement.
- * @example
- * // Styles as object usage
- * const styles = {
- * ...size('300px', '250px')
- * }
- *
- * // styled-components usage
- * const div = styled.div`
- * ${size('300px', '250px')}
- * `
- *
- * // CSS as JS Output
- *
- * div {
- * 'height': '300px',
- * 'width': '250px',
- * }
- */
- export default function size(height: string | number, width?: string | number = height): Styles {
- return {
- height,
- width,
- }
- }
|