Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: placement #228

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

react dropdown component

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependencies][david-image]][david-url]
[![DevDependencies][david-dev-image]][david-dev-url]
[![npm download][download-image]][download-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-dropdown.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-dropdown
Expand Down Expand Up @@ -95,7 +88,7 @@ var Dropdown = require('rc-dropdown');
<td>placement</td>
<td>String</td>
<td>bottomLeft</td>
<td>Position of menu item. There are: topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight </td>
<td>Position of menu item. There are: top, topCenter, topRight, bottomLeft, bottom, bottomRight </td>
</tr>
<tr>
<td>onVisibleChange</td>
Expand Down Expand Up @@ -166,7 +159,6 @@ npm run coverage

open coverage/ dir


## License

rc-dropdown is released under the MIT license.
12 changes: 6 additions & 6 deletions src/placements.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const autoAdjustOverflow = {
adjustX: 1,
adjustY: 1,
}
};

const targetOffset = [0, 0]
const targetOffset = [0, 0];

const placements = {
topLeft: {
Expand All @@ -12,7 +12,7 @@ const placements = {
offset: [0, -4],
targetOffset,
},
topCenter: {
top: {
points: ['bc', 'tc'],
overflow: autoAdjustOverflow,
offset: [0, -4],
Expand All @@ -30,7 +30,7 @@ const placements = {
offset: [0, 4],
targetOffset,
},
bottomCenter: {
bottom: {
points: ['tc', 'bc'],
overflow: autoAdjustOverflow,
offset: [0, 4],
Expand All @@ -42,6 +42,6 @@ const placements = {
offset: [0, 4],
targetOffset,
},
}
};

export default placements
export default placements;