-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Gutter] Factor out method to set common gutter component properties
- Loading branch information
Jess Lin
committed
Apr 22, 2015
1 parent
7f1b058
commit e2e7373
Showing
3 changed files
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Helper methods shared among GutterComponent classes. | ||
|
||
module.exports = | ||
# Sets scrollHeight, scrollTop, and backgroundColor on the given domNode. | ||
setDimensionsAndBackground: (oldState, newState, domNode) -> | ||
if newState.scrollHeight isnt oldState.scrollHeight | ||
domNode.style.height = newState.scrollHeight + 'px' | ||
oldState.scrollHeight = newState.scrollHeight | ||
|
||
if newState.scrollTop isnt oldState.scrollTop | ||
domNode.style['-webkit-transform'] = "translate3d(0px, #{-newState.scrollTop}px, 0px)" | ||
oldState.scrollTop = newState.scrollTop | ||
|
||
if newState.backgroundColor isnt oldState.backgroundColor | ||
domNode.style.backgroundColor = newState.backgroundColor | ||
oldState.backgroundColor = newState.backgroundColor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters