borderStyle.js.flow 810 B

123456789101112131415161718192021222324252627282930
  1. // @flow
  2. import directionalProperty from '../helpers/directionalProperty'
  3. import type { Styles } from '../types/style'
  4. /**
  5. * Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
  6. * @example
  7. * // Styles as object usage
  8. * const styles = {
  9. * ...borderStyle('solid', 'dashed', 'dotted', 'double')
  10. * }
  11. *
  12. * // styled-components usage
  13. * const div = styled.div`
  14. * ${borderStyle('solid', 'dashed', 'dotted', 'double')}
  15. * `
  16. *
  17. * // CSS as JS Output
  18. *
  19. * div {
  20. * 'borderTopStyle': 'solid',
  21. * 'borderRightStyle': 'dashed',
  22. * 'borderBottomStyle': 'dotted',
  23. * 'borderLeftStyle': 'double'
  24. * }
  25. */
  26. export default function borderStyle(...values: Array<?string>): Styles {
  27. return directionalProperty('borderStyle', ...values)
  28. }