forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/tangly1024/NotionNext
- Loading branch information
Showing
22 changed files
with
604 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import Collapse from '@/components/Collapse' | ||
import { useRef, useState } from 'react' | ||
import Logo from './Logo' | ||
import { MenuList } from './MenuList' | ||
import SearchInput from './SearchInput' | ||
|
||
/** | ||
* 顶部导航 | ||
* @param {*} param0 | ||
* @returns | ||
*/ | ||
const Header = props => { | ||
const [isOpen, changeShow] = useState(false) | ||
const collapseRef = useRef(null) | ||
|
||
const toggleMenuOpen = () => { | ||
changeShow(!isOpen) | ||
} | ||
|
||
return ( | ||
<div id='top-nav' className='z-40 block lg:hidden'> | ||
{/* 导航栏 */} | ||
<div | ||
id='sticky-nav' | ||
className={ | ||
'relative w-full top-0 z-20 transform duration-500 bg-white dark:bg-black' | ||
}> | ||
<Collapse type='vertical' isOpen={isOpen} collapseRef={collapseRef}> | ||
<div className='py-1 px-5'> | ||
<MenuList | ||
{...props} | ||
onHeightChange={param => | ||
collapseRef.current?.updateCollapseHeight(param) | ||
} | ||
/> | ||
<SearchInput {...props} /> | ||
</div> | ||
</Collapse> | ||
<div className='w-full flex justify-between items-center p-4 '> | ||
{/* 左侧LOGO 标题 */} | ||
<div className='flex flex-none flex-grow-0'> | ||
<Logo {...props} /> | ||
</div> | ||
<div className='flex'></div> | ||
|
||
{/* 右侧功能 */} | ||
<div className='mr-1 flex justify-end items-center text-sm space-x-4 font-serif dark:text-gray-200'> | ||
<div | ||
onClick={toggleMenuOpen} | ||
className='cursor-pointer text-lg p-2'> | ||
{isOpen ? ( | ||
<i className='fas fa-times' /> | ||
) : ( | ||
<i className='fas fa-bars' /> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Header |
Oops, something went wrong.