diff --git a/app/soapbox/components/sub_navigation.js b/app/soapbox/components/sub_navigation.js index ef672035f..33287befa 100644 --- a/app/soapbox/components/sub_navigation.js +++ b/app/soapbox/components/sub_navigation.js @@ -31,8 +31,6 @@ class SubNavigation extends React.PureComponent { message: PropTypes.string, settings: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), onOpenSettings: PropTypes.func.isRequired, - className: PropTypes.string, - showAfter: PropTypes.number, } static contextTypes = { @@ -40,8 +38,7 @@ class SubNavigation extends React.PureComponent { } state = { - sticking: false, - visible: typeof this.props.showAfter !== 'number', + scrolled: false, } handleBackClick = () => { @@ -74,33 +71,16 @@ class SubNavigation extends React.PureComponent { window.removeEventListener('scroll', this.handleScroll); } - updateSticking = () => { + handleScroll = throttle(() => { if (this.node) { const { top } = this.node.getBoundingClientRect(); if (top <= 50) { - this.setState({ sticking: true }); + this.setState({ scrolled: true }); } else { - this.setState({ sticking: false }); + this.setState({ scrolled: false }); } } - } - - updateVisibile = () => { - const { showAfter } = this.props; - - if (typeof showAfter === 'number') { - if (document.documentElement.scrollTop >= showAfter) { - this.setState({ visible: true }); - } else { - this.setState({ visible: false }); - } - } - } - - handleScroll = throttle(() => { - this.updateSticking(); - this.updateVisibile(); }, 150, { trailing: true }); handleOpenSettings = () => { @@ -112,11 +92,11 @@ class SubNavigation extends React.PureComponent { } render() { - const { intl, message, settings: Settings, className, showAfter } = this.props; - const { sticking, visible } = this.state; + const { intl, message, settings: Settings } = this.props; + const { scrolled } = this.state; return ( -
+
+
+
+
+
+ {(!collapsed || animating) && } +
+ {showSuggestions ? ( {Component => } - ) : (<> - + ) : ( }} />} /> - )} + )} ); } diff --git a/app/styles/components/account-header.scss b/app/styles/components/account-header.scss index fe4c09b99..401e3fcc5 100644 --- a/app/styles/components/account-header.scss +++ b/app/styles/components/account-header.scss @@ -335,13 +335,3 @@ } } } - -.account__sub-navigation { - display: none; - - @media (max-width: 897px) { - display: flex; - position: fixed; - margin: 0; - } -} diff --git a/app/styles/components/columns.scss b/app/styles/components/columns.scss index 7ae141104..61c3ab489 100644 --- a/app/styles/components/columns.scss +++ b/app/styles/components/columns.scss @@ -924,8 +924,8 @@ } // Make MaterialStatus flush against SubNavigation -.sub-navigation:not(.sub-navigation--hidden) ~ .slist .item-list > article:first-child .material-status__status, -.sub-navigation:not(.sub-navigation--hidden) ~ .material-status:not(.material-status + .material-status) .material-status__status { +.sub-navigation ~ .slist .item-list > article:first-child .material-status__status, +.sub-navigation ~ .material-status:not(.material-status + .material-status) .material-status__status { border-top-left-radius: 0; border-top-right-radius: 0; } @@ -940,7 +940,7 @@ } } - .sub-navigation:not(.sub-navigation--hidden) ~ .slist .slist__append { + .sub-navigation ~ .slist .slist__append { border-top-left-radius: 0; border-top-right-radius: 0; } diff --git a/app/styles/components/timeline-queue-header.scss b/app/styles/components/timeline-queue-header.scss index da3c6b65e..93cf73d6f 100644 --- a/app/styles/components/timeline-queue-header.scss +++ b/app/styles/components/timeline-queue-header.scss @@ -15,7 +15,7 @@ padding: 0 10px; z-index: 500; - .sub-navigation:not(.sub-navigation--hidden) ~ & { + .sub-navigation ~ & { top: calc(60px + 41px); } diff --git a/app/styles/components/wtf-panel.scss b/app/styles/components/wtf-panel.scss index 367cab868..b76e7a6e4 100644 --- a/app/styles/components/wtf-panel.scss +++ b/app/styles/components/wtf-panel.scss @@ -162,7 +162,7 @@ } } -.column .sub-navigation:not(.sub-navigation--hidden) ~ .wtf-panel { +.column .sub-navigation ~ .wtf-panel { border-top-left-radius: 0; border-top-right-radius: 0; } diff --git a/app/styles/navigation.scss b/app/styles/navigation.scss index f097876cc..9a8a48a44 100644 --- a/app/styles/navigation.scss +++ b/app/styles/navigation.scss @@ -128,22 +128,11 @@ align-items: center; justify-content: center; z-index: 999; - transition: transform 0.2s, border-radius 0.2s; - &--sticking { + &--scrolled { border-radius: 0 !important; } - &--show-after { - transform: translateY(-41px) scaleY(0); - margin-top: -1041px; - margin-bottom: 1000px; - - &.sub-navigation--visible { - transform: translateY(0) scaleY(1); - } - } - &__content { width: 100%; height: 100%; @@ -181,7 +170,6 @@ display: flex; align-items: center; justify-content: center; - margin-left: auto; .svg-icon { width: 20px; @@ -194,7 +182,3 @@ border-top-right-radius: 10px; } } - -.home-timeline .sub-navigation__back { - display: none; -}