Skip to content

Commit

Permalink
1.4.0 [Feauture] Change the scrollbar size relative to the content of…
Browse files Browse the repository at this point in the history
… the picker
  • Loading branch information
ealush committed Aug 25, 2017
1 parent 5e48c91 commit 82cbea1
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="root"></div>
<div id="error-display"></div>
<script src="static/preview.1153246074b22a3b7602.bundle.js"></script>
<script src="static/preview.22fbecbe07f7941da267.bundle.js"></script>
</body>
</html>

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</head>
<body style="margin: 0;">
<div id="root"></div>
<script src="static/manager.ef6fecb46e3c429d06e2.bundle.js"></script>
<script src="static/manager.56cfe3116ef4dfe0e5a9.bundle.js"></script>
</body>
</html>

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/static/preview.1153246074b22a3b7602.bundle.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/static/preview.22fbecbe07f7941da267.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emoji-picker-react",
"version": "1.3.2",
"version": "1.4.0",
"description": "React emoji-picker component",
"main": "./dist/index.js",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/EmojiPicker/helpers/adjust_scrollbar/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { MIN_SCROLLBAR_HEIGHT_PADDED } from '../../../constants';

export default function adjustScrollbar(scrollHeight, scrollTop, listHeight, _scroller) {

const scrollbarHeight = Math.floor((listHeight/(scrollHeight/listHeight)) * 0.8);

const wholeRange = scrollHeight - listHeight,
visibleRange = (listHeight - 15),
visibleRange = (listHeight - (scrollbarHeight < MIN_SCROLLBAR_HEIGHT_PADDED ? MIN_SCROLLBAR_HEIGHT_PADDED : scrollbarHeight)),
newPos = (scrollTop * visibleRange) / (wholeRange);

_scroller.setAttribute('style', `transform: translateY(${newPos}px)`);
_scroller.children[0].setAttribute('style', `height: ${scrollbarHeight}px`);
}
3 changes: 1 addition & 2 deletions src/EmojiPicker/picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
position: absolute;
width: 5px;
padding-top: 5px;
height: 20px;
z-index: 2;
right: 3px;
box-sizing: border-box;
Expand All @@ -83,7 +82,7 @@
div {
background-color: $md-grey-400;
width: 100%;
height: 10px;
min-height: 10px;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const HEADER_HEIGHT = 25;
export const PICKER_WIDTH = 240;
export const PICKER_HEIGHT = 240;
export const EMOJI_SIZE = 34;
export const MIN_SCROLLBAR_HEIGHT_PADDED = 15;

// timers
export const OPEN_DIVERSITIES_TIMEOUT = 1000;
Expand Down

0 comments on commit 82cbea1

Please sign in to comment.