File tree Expand file tree Collapse file tree 6 files changed +23
-11
lines changed Expand file tree Collapse file tree 6 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 1.1.0] - 2018-06-22
8+ ### Added
9+ - Container class name
10+
711## [ 1.0.0] - 2018-06-17
812### Added
913- Initial release
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ export default props =>
3535
3636| Name | Default | Description |
3737| - | - | - |
38- | ` mode ` | ` "bottom" ` | Set it to ` "bottom" ` for scroll-to-bottom, ` "top" ` for scroll-to-top. |
38+ | ` className ` | | Set the class name for the root element |
39+ | ` followButtonClassName ` | | Set the class name for the follow button |
40+ | ` mode ` | ` "bottom" ` | Set it to ` "bottom" ` for scroll-to-bottom, ` "top" ` for scroll-to-top |
41+ | ` scrollViewClassName ` | | Set the class name for the container element that house all ` props.children ` |
3942
4043## Context
4144
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ const ROOT_CSS = css({
1212
1313export default props =>
1414 < Composer mode = { props . mode === 'top' ? 'top' : 'bottom' } >
15- < div className = { classNames ( ROOT_CSS + '' , props . className ) } >
16- < Panel >
15+ < div className = { classNames ( ROOT_CSS + '' , ( props . className || '' ) + '' ) } >
16+ < Panel className = { props . scrollViewClassName } >
1717 { props . children }
1818 </ Panel >
1919 < AutoHideFollowButton className = { props . followButtonClassName } />
Original file line number Diff line number Diff line change 11import { css } from 'glamor' ;
2+ import classNames from 'classnames' ;
23import React from 'react' ;
34
45import Context from './Context' ;
@@ -24,11 +25,11 @@ const ROOT_CSS = css({
2425 }
2526} ) ;
2627
27- export default props =>
28+ export default ( { className } ) =>
2829 < Context . Consumer >
2930 { context => ! context . atEnd &&
3031 < button
31- className = { ROOT_CSS + '' }
32+ className = { classNames ( ROOT_CSS + '' , ( className || '' ) + '' ) }
3233 onClick = { context . scrollToEnd }
3334 />
3435 }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default class Panel extends React.PureComponent {
2525
2626 return (
2727 < div
28- className = { classNames ( ROOT_CSS + '' , props . className ) }
28+ className = { classNames ( ROOT_CSS + '' , ( props . className || '' ) + '' ) }
2929 ref = { context . _setTarget }
3030 >
3131 { props . children }
Original file line number Diff line number Diff line change @@ -34,14 +34,18 @@ const ROOT_CSS = css({
3434 }
3535} ) ;
3636
37- const SCROLL_VIEW_CSS = css ( {
37+ const CONTAINER_CSS = css ( {
3838 borderColor : 'Black' ,
3939 borderStyle : 'solid' ,
4040 borderWidth : 1 ,
4141 height : 400 ,
4242 marginTop : 10
4343} ) ;
4444
45+ const SCROLL_VIEW_CSS = css ( {
46+ backgroundColor : '#EEE'
47+ } ) ;
48+
4549const SCROLL_VIEW_PADDING_CSS = css ( {
4650 paddingLeft : 10 ,
4751 paddingRight : 10 ,
@@ -117,13 +121,13 @@ class App extends React.Component {
117121 </ li >
118122 </ ul >
119123 < div className = "panes" >
120- < ScrollToEnd className = { SCROLL_VIEW_CSS + '' } >
121- < div className = { SCROLL_VIEW_PADDING_CSS + '' } >
124+ < ScrollToEnd className = { CONTAINER_CSS } scrollViewClassName = { SCROLL_VIEW_CSS } >
125+ < div className = { SCROLL_VIEW_PADDING_CSS } >
122126 { this . state . paragraphs . map ( paragraph => < p key = { paragraph } > { paragraph } </ p > ) }
123127 </ div >
124128 </ ScrollToEnd >
125- < ScrollToEnd className = { SCROLL_VIEW_CSS + '' } mode = "top" >
126- < div className = { SCROLL_VIEW_PADDING_CSS + '' } >
129+ < ScrollToEnd className = { CONTAINER_CSS } mode = "top" >
130+ < div className = { SCROLL_VIEW_PADDING_CSS } >
127131 { [ ...this . state . paragraphs ] . reverse ( ) . map ( paragraph => < p key = { paragraph } > { paragraph } </ p > ) }
128132 </ div >
129133 </ ScrollToEnd >
You can’t perform that action at this time.
0 commit comments