import React from 'react' import PropTypes from 'prop-types' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import throttle from 'lodash.throttle' import Sticky from 'react-stickynode' import { me } from '../initial_state' import { BREAKPOINT_EXTRA_SMALL } from '../constants' import Layout from './layout' import SidebarPanelGroup from '../components/sidebar_panel_group' import Responsive from '../features/ui/util/responsive_component' import WrappedBundle from '../features/ui/util/wrapped_bundle' import Heading from '../components/heading' import { GroupsPanel, SignUpLogInPanel, UserSuggestionsPanel, TrendsBreakingPanel, } from '../features/ui/util/async_components' class ExploreLayout extends ImmutablePureComponent { state = { lazyLoaded: false, } componentDidMount() { this.window = window this.documentElement = document.scrollingElement || document.documentElement this.window.addEventListener('scroll', this.handleScroll) } componentWillUnmount() { this.detachScrollListener() } detachScrollListener = () => { this.window.removeEventListener('scroll', this.handleScroll) } handleScroll = throttle(() => { if (this.window) { const { scrollTop } = this.documentElement if (scrollTop > 25 && !this.state.lazyLoaded) { this.setState({ lazyLoaded: true }) this.detachScrollListener() } } }, 150, { trailing: true, }) render() { const { children, title } = this.props const { lazyLoaded } = this.state const pageTitleBlock = (
Popular posts across Gab
) const layout = [ SignUpLogInPanel, , ] if (!!me) { layout.push() } layout.push() return (
{pageTitleBlock} {children}
{pageTitleBlock} {children}
) } } ExploreLayout.propTypes = { actions: PropTypes.array, children: PropTypes.node, group: ImmutablePropTypes.map, groupId: PropTypes.string, layout: PropTypes.object, relationships: ImmutablePropTypes.map, title: PropTypes.string, } export default ExploreLayout