zent
Version:
一套前端设计语言和基于React的实现
37 lines (31 loc) • 628 B
JavaScript
import createPlacement from './create';
/**
* ---------------
* | anchor |
* | |
* ---------------
* |popover|
* ---------
*/
function locate(
anchorBoundingBox,
containerBoundingBox,
contentDimension,
options
) {
const { left, bottom } = anchorBoundingBox;
const x = left;
const y = bottom + options.cushion;
return {
getCSSStyle() {
return {
position: 'absolute',
left: `${Math.round(x)}px`,
top: `${Math.round(y)}px`
};
},
name: 'position-bottom-left'
};
}
const BottomLeft = createPlacement(locate);
export default BottomLeft;