Refactored and cleaned up code
This commit is contained in:
27
weather-ui/src/components/Topbar/index.tsx
Normal file
27
weather-ui/src/components/Topbar/index.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
'use client';
|
||||
|
||||
import { Avatar } from 'antd';
|
||||
import Search from 'antd/es/input/Search';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { AiOutlineUser } from 'react-icons/ai';
|
||||
|
||||
export default function Topbar() {
|
||||
const router = useRouter();
|
||||
|
||||
function onSearch(value: string) {
|
||||
router.push(`/airports/${value}`);
|
||||
}
|
||||
|
||||
return (
|
||||
<nav className='w-screen flex bg-gray-700 text-gray-200'>
|
||||
<Search
|
||||
placeholder='Search Airports...'
|
||||
onSearch={onSearch}
|
||||
enterButton
|
||||
className='p-2'
|
||||
style={{ width: '20em' }}
|
||||
/>
|
||||
<Avatar shape='square' size={48} icon={<AiOutlineUser />} />
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user