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.
28 lines
788 B
28 lines
788 B
// @flow
|
|
import type { Styles } from '../types/style'
|
|
|
|
/**
|
|
* Shorthand that 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'
|
|
* }
|
|
*/
|
|
export default function backgrounds(...properties: Array<string>): Styles {
|
|
return {
|
|
background: properties.join(', '),
|
|
}
|
|
}
|