lbry-desktop/ui/page/publish/view.jsx
DispatchCommit 599f9e106e use smooth scrolling
Tells browser to use smooth scrolling to animate scroll
https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
2021-02-01 13:50:16 -05:00

40 lines
800 B
JavaScript

// @flow
import React from 'react';
import PublishForm from 'component/publishForm';
import Page from 'component/page';
import YrblWalletEmpty from 'component/yrblWalletEmpty';
type Props = {
balance: number,
};
function PublishPage(props: Props) {
const { balance } = props;
function scrollToTop() {
const mainContent = document.querySelector('main');
if (mainContent) {
mainContent.scrollTo({
top: 0,
behavior: 'smooth',
});
}
}
return (
<Page
noFooter
noSideNavigation
backout={{
title: __('Upload'),
backLabel: __('Back'),
}}
>
{balance === 0 && <YrblWalletEmpty />}
<PublishForm scrollToTop={scrollToTop} disabled={balance === 0} />
</Page>
);
}
export default PublishPage;