Skip to content

Commit

Permalink
feat: placement (#228)
Browse files Browse the repository at this point in the history
* refactor: rename topCenter/bottomCenter with top/bottom

* docs: update readme
  • Loading branch information
MadCcc authored Apr 26, 2023
1 parent ee7be6d commit 9b6a1f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
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;

0 comments on commit 9b6a1f2

Please sign in to comment.