Conflicts: app/javascript/mastodon/components/status_list.js app/javascript/mastodon/features/notifications/index.js app/javascript/mastodon/features/ui/components/modal_root.js app/javascript/mastodon/features/ui/components/onboarding_modal.js app/javascript/mastodon/features/ui/index.js app/javascript/styles/about.scss app/javascript/styles/accounts.scss app/javascript/styles/components.scss app/presenters/instance_presenter.rb app/services/post_status_service.rb app/services/reblog_service.rb app/views/about/more.html.haml app/views/about/show.html.haml app/views/accounts/_header.html.haml config/webpack/loaders/babel.js spec/controllers/api/v1/accounts/credentials_controller_spec.rb
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import React from 'react';
 | |
| import PropTypes from 'prop-types';
 | |
| import detectPassiveEvents from 'detect-passive-events';
 | |
| import { scrollTop } from '../scroll';
 | |
| 
 | |
| export default class Column extends React.PureComponent {
 | |
| 
 | |
|   static propTypes = {
 | |
|     children: PropTypes.node,
 | |
|     extraClasses: PropTypes.string,
 | |
|   };
 | |
| 
 | |
|   scrollTop () {
 | |
|     const scrollable = this.node.querySelector('.scrollable');
 | |
| 
 | |
|     if (!scrollable) {
 | |
|       return;
 | |
|     }
 | |
| 
 | |
|     this._interruptScrollAnimation = scrollTop(scrollable);
 | |
|   }
 | |
| 
 | |
|   handleWheel = () => {
 | |
|     if (typeof this._interruptScrollAnimation !== 'function') {
 | |
|       return;
 | |
|     }
 | |
| 
 | |
|     this._interruptScrollAnimation();
 | |
|   }
 | |
| 
 | |
|   setRef = c => {
 | |
|     this.node = c;
 | |
|   }
 | |
| 
 | |
|   componentDidMount () {
 | |
|     this.node.addEventListener('wheel', this.handleWheel,  detectPassiveEvents.hasSupport ? { passive: true } : false);
 | |
|   }
 | |
| 
 | |
|   componentWillUnmount () {
 | |
|     this.node.removeEventListener('wheel', this.handleWheel);
 | |
|   }
 | |
| 
 | |
|   render () {
 | |
|     const { children, extraClasses } = this.props;
 | |
| 
 | |
|     return (
 | |
|       <div role='region' className={`column ${extraClasses || ''}`} ref={this.setRef}>
 | |
|         {children}
 | |
|       </div>
 | |
|     );
 | |
|   }
 | |
| 
 | |
| }
 |