// @flow
/**
* The backgrounds shorthand accepts any number of background values as parameters for creating a single background statement..
* @example
* // Styles as object usage
* const styles = {
* ...backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')
* }
*
* // styled-components usage
* const div = styled.div`
* ${...backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')}
* `
*
* // CSS as JS Output
*
* div {
* 'background': 'url("/image/background.jpg"), linear-gradient(red, green), center no-repeat'
* }
*/
function backgrounds(...properties: Array<string>) {
return {
'background': properties.join(', '),
}
}
export default backgrounds
|