primer-react
Version:
Primer react components
21 lines (17 loc) • 632 B
JavaScript
import React from 'react'
import {withSystemProps, LAYOUT, POSITION} from './system-props'
export const Position = withSystemProps('div', LAYOUT.concat(POSITION))
function withPosition(position) {
const WithPosition = props => <Position {...props} position={position} />
WithPosition.propTypes = Position.propTypes
WithPosition.displayName = `Position.${position}`
return WithPosition
}
export const Absolute = withPosition('absolute')
export const Fixed = withPosition('fixed')
export const Relative = withPosition('relative')
export const Sticky = withPosition('sticky')
Sticky.defaultProps = {
top: 0,
zIndex: 1
}