@@ -4,6 +4,27 @@ import { css } from 'glamor';
44import loremIpsum from 'lorem-ipsum' ;
55import ScrollToBottom from 'component' ;
66
7+ const ROOT_CSS = css ( {
8+ '& > ul.button-bar' : {
9+ display : 'flex' ,
10+ listStyleType : 'none' ,
11+ margin : 0 ,
12+ padding : 0 ,
13+
14+ '& > li:not(:last-child)' : {
15+ marginRight : 10
16+ }
17+ } ,
18+
19+ '& > .panes' : {
20+ display : 'flex' ,
21+
22+ '& > *:not(:last-child)' : {
23+ marginRight : 10
24+ }
25+ }
26+ } ) ;
27+
728const SCROLL_VIEW_CSS = css ( {
829 borderColor : 'Black' ,
930 borderStyle : 'solid' ,
@@ -46,15 +67,30 @@ class App extends Component {
4667
4768 render ( ) {
4869 return (
49- < div className = "App" >
50- < button onClick = { this . handleAdd1 } > Add new paragraph</ button >
51- < button onClick = { this . handleAdd10 } > Add 10 new paragraphs</ button >
52- < button onClick = { this . handleClear } > Clear</ button >
53- < ScrollToBottom className = { SCROLL_VIEW_CSS + '' } >
54- < div className = { SCROLL_VIEW_PADDING_CSS + '' } >
55- { this . state . paragraphs . map ( ( paragraph , index ) => < p key = { index } > { paragraph } </ p > ) }
56- </ div >
57- </ ScrollToBottom >
70+ < div className = { ROOT_CSS + '' } >
71+ < ul className = "button-bar" >
72+ < li >
73+ < button onClick = { this . handleAdd1 } > Add new paragraph</ button >
74+ </ li >
75+ < li >
76+ < button onClick = { this . handleAdd10 } > Add 10 new paragraphs</ button >
77+ </ li >
78+ < li >
79+ < button onClick = { this . handleClear } > Clear</ button >
80+ </ li >
81+ </ ul >
82+ < div className = "panes" >
83+ < ScrollToBottom className = { SCROLL_VIEW_CSS + '' } >
84+ < div className = { SCROLL_VIEW_PADDING_CSS + '' } >
85+ { this . state . paragraphs . map ( paragraph => < p key = { paragraph } > { paragraph } </ p > ) }
86+ </ div >
87+ </ ScrollToBottom >
88+ < ScrollToBottom className = { SCROLL_VIEW_CSS + '' } mode = "top" >
89+ < div className = { SCROLL_VIEW_PADDING_CSS + '' } >
90+ { [ ...this . state . paragraphs ] . reverse ( ) . map ( paragraph => < p key = { paragraph } > { paragraph } </ p > ) }
91+ </ div >
92+ </ ScrollToBottom >
93+ </ div >
5894 </ div >
5995 ) ;
6096 }
0 commit comments