Skip to content

Commit 229019b

Browse files
committed
Cosmetics
1 parent bd28d49 commit 229019b

File tree

5 files changed

+37
-27
lines changed

5 files changed

+37
-27
lines changed

packages/component/src/BasicScrollToBottom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44

55
import Composer from './ScrollToBottom/Composer';
66
import Context from './ScrollToBottom/Context';
7-
import FollowButton from './ScrollToBottom/FollowButton';
7+
import AutoHideFollowButton from './ScrollToBottom/AutoHideFollowButton';
88
import Panel from './ScrollToBottom/Panel';
99

1010
const ROOT_CSS = css({
@@ -19,7 +19,7 @@ export default props =>
1919
<Panel>
2020
{ props.children }
2121
</Panel>
22-
{ !context.bottom && <FollowButton /> }
22+
<AutoHideFollowButton className={ props.followButtonClassName } />
2323
</div>
2424
}
2525
</Context>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { css } from 'glamor';
2+
import React from 'react';
3+
4+
import Context from './Context';
5+
6+
const ROOT_CSS = css({
7+
backgroundColor: 'rgba(0, 0, 0, .2)',
8+
borderRadius: 5,
9+
borderWidth: 0,
10+
bottom: 5,
11+
cursor: 'pointer',
12+
height: 10,
13+
outline: 0,
14+
position: 'absolute',
15+
right: 20,
16+
width: 60,
17+
18+
'&:hover': {
19+
backgroundColor: 'rgba(0, 0, 0, .4)'
20+
},
21+
22+
'&:active': {
23+
backgroundColor: 'rgba(0, 0, 0, .6)'
24+
}
25+
});
26+
27+
export default props =>
28+
<Context.Consumer>
29+
{ context => !context.bottom &&
30+
<button
31+
className={ ROOT_CSS + '' }
32+
onClick={ context.scrollToBottom }
33+
/>
34+
}
35+
</Context.Consumer>

packages/component/src/ScrollToBottom/Composer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default class ScrollToBottomComposer extends React.Component {
1616
bottom: true,
1717
handleUpdate: () => this.state.bottom && this.state.scrollToBottom(),
1818
scrollToBottom: () => this.setState(() => ({
19-
bottom: true,
2019
scrollTop: this.state.target && this.state.target.current && (this.state.target.current.scrollHeight - this.state.target.current.offsetHeight)
2120
})),
2221
scrollTop: null,

packages/component/src/ScrollToBottom/FollowButton.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/playground/src/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const SCROLL_VIEW_CSS = css({
1010
borderWidth: 1,
1111
height: 400,
1212
marginTop: 10,
13-
padding: 10,
1413
width: 600
1514
});
1615

0 commit comments

Comments
 (0)