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
760 B
28 lines
760 B
3 years ago
|
// @flow
|
||
|
import type { Styles } from '../types/style'
|
||
|
|
||
|
/**
|
||
|
* Shorthand that accepts any number of backgroundImage values as parameters for creating a single background statement.
|
||
|
* @example
|
||
|
* // Styles as object usage
|
||
|
* const styles = {
|
||
|
* ...backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')
|
||
|
* }
|
||
|
*
|
||
|
* // styled-components usage
|
||
|
* const div = styled.div`
|
||
|
* ${backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')}
|
||
|
* `
|
||
|
*
|
||
|
* // CSS as JS Output
|
||
|
*
|
||
|
* div {
|
||
|
* 'backgroundImage': 'url("/image/background.jpg"), linear-gradient(red, green)'
|
||
|
* }
|
||
|
*/
|
||
|
export default function backgroundImages(...properties: Array<string>): Styles {
|
||
|
return {
|
||
|
backgroundImage: properties.join(', '),
|
||
|
}
|
||
|
}
|