mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-16 10:08:44 +00:00
Move RenderNavBar to common hook
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import './newPage.less';
|
||||
|
||||
// Common imports
|
||||
@@ -8,21 +7,9 @@ import { hbfm } from 'marked-hbfm';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||
import { printCurrentBrew, fetchThemeBundle, splitTextStyleAndMetadata } from '@shared/helpers.js';
|
||||
|
||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||
|
||||
import Nav from '@navbar/nav.jsx';
|
||||
import Navbar from '@navbar/navbar.jsx';
|
||||
import NewBrewItem from '@navbar/newbrew.navitem.jsx';
|
||||
import AccountNavItem from '@navbar/account.navitem.jsx';
|
||||
import ErrorNavItem from '@navbar/error-navitem.jsx';
|
||||
import HelpNavItem from '@navbar/help.navitem.jsx';
|
||||
import VaultNavItem from '@navbar/vault.navitem.jsx';
|
||||
import PrintNavItem from '@navbar/print.navitem.jsx';
|
||||
import RecentNavItems from '@navbar/recent.navitem.jsx';
|
||||
const { both: RecentNavItem } = RecentNavItems;
|
||||
|
||||
// Page specific imports
|
||||
const BREWKEY = 'HB_newPage_content';
|
||||
const STYLEKEY = 'HB_newPage_style';
|
||||
@@ -109,32 +96,11 @@ const NewPage = (props)=>{
|
||||
window.location = `/edit/${savedBrew.editId}`;
|
||||
};
|
||||
|
||||
const renderNavbar = ()=>(
|
||||
<Navbar>
|
||||
<Nav.section>
|
||||
<Nav.item className='brewTitle'>{currentBrew.title}</Nav.item>
|
||||
</Nav.section>
|
||||
|
||||
<Nav.section>
|
||||
{error
|
||||
? <ErrorNavItem error={error} clearError={clearError} />
|
||||
: renderSaveButton()}
|
||||
<NewBrewItem />
|
||||
<PrintNavItem />
|
||||
<HelpNavItem />
|
||||
<VaultNavItem />
|
||||
<RecentNavItem />
|
||||
<AccountNavItem />
|
||||
</Nav.section>
|
||||
</Navbar>
|
||||
);
|
||||
|
||||
const {
|
||||
clearError,
|
||||
renderSaveButton,
|
||||
renderPanels
|
||||
} = useCommonEditPageFunctions({
|
||||
saveGoogle,
|
||||
error,
|
||||
setError,
|
||||
currentBrew,
|
||||
setCurrentBrew,
|
||||
@@ -148,7 +114,6 @@ const NewPage = (props)=>{
|
||||
showFloatingButtons,
|
||||
lastSavedBrew,
|
||||
save,
|
||||
renderNavbar,
|
||||
pageName,
|
||||
showEditorButtons,
|
||||
userThemes: props.userThemes
|
||||
|
||||
Reference in New Issue
Block a user