style: improvements

This commit is contained in:
Jing Hua 2023-03-05 01:33:46 +08:00
parent 9bc839917e
commit 5d11cfa343
4 changed files with 38 additions and 26 deletions

View file

@ -66,7 +66,7 @@ const ChatContent = () => {
Submit
</button>
</div>
<div className='w-full h-32 md:h-48 flex-shrink-0'></div>
<div className='w-full h-10'></div>
</div>
</ScrollToBottom>
</div>

View file

@ -1,13 +1,17 @@
import React from 'react';
import { useScrollToBottom } from 'react-scroll-to-bottom';
import { useAtBottom, useScrollToBottom } from 'react-scroll-to-bottom';
import DownArrow from '@icon/DownArrow';
const ScrollToBottomButton = () => {
const scrollToBottom = useScrollToBottom();
const [atBottom] = useAtBottom();
return (
<button
className='cursor-pointer absolute right-6 bottom-[60px] md:bottom-[60px] z-10 rounded-full border border-gray-200 bg-gray-50 text-gray-600 dark:border-white/10 dark:bg-white/10 dark:text-gray-200'
className={`cursor-pointer absolute right-6 bottom-[60px] md:bottom-[60px] z-10 rounded-full border border-gray-200 bg-gray-50 text-gray-600 dark:border-white/10 dark:bg-white/10 dark:text-gray-200 ${
atBottom ? 'hidden' : ''
}`}
onClick={scrollToBottom}
>
<DownArrow />

View file

@ -7,32 +7,39 @@ import CrossIcon2 from '@icon/CrossIcon2';
const Menu = () => {
return (
<div
id='menu'
className='dark bg-gray-900 md:fixed md:inset-y-0 md:flex md:w-[260px] md:flex-col max-md:translate-x-[-100%] max-md:fixed max-md:transition-transform max-md:z-[999] max-md:top-0 max-md:left-0 max-md:h-full'
>
<div className='flex h-full min-h-0 flex-col '>
<div className='scrollbar-trigger flex h-full w-full flex-1 items-start border-white/20'>
<nav className='flex h-full flex-1 flex-col space-y-1 p-2'>
<NewChat />
<ChatHistoryList />
<MenuOptions />
</nav>
<>
<div
id='menu'
className='dark bg-gray-900 md:fixed md:inset-y-0 md:flex md:w-[260px] md:flex-col max-md:translate-x-[-100%] max-md:fixed max-md:transition-transform max-md:z-[999] max-md:top-0 max-md:left-0 max-md:h-full max-md:w-3/4'
>
<div className='flex h-full min-h-0 flex-col '>
<div className='scrollbar-trigger flex h-full w-full flex-1 items-start border-white/20'>
<nav className='flex h-full flex-1 flex-col space-y-1 p-2'>
<NewChat />
<ChatHistoryList />
<MenuOptions />
</nav>
</div>
</div>
<div
id='menu-close'
className='hidden md:hidden absolute z-[999] right-0 translate-x-full top-10 bg-gray-900 p-2 cursor-pointer hover:bg-black text-white'
onClick={() => {
document
.getElementById('menu')
?.classList.remove('max-md:translate-x-[0%]');
document.getElementById('menu-close')?.classList.add('hidden');
document.getElementById('menu-backdrop')?.classList.add('hidden');
}}
>
<CrossIcon2 />
</div>
</div>
<div
id='menu-close'
className='hidden md:hidden absolute z-[999] right-0 translate-x-full top-10 bg-gray-900 p-2 cursor-pointer hover:bg-black text-white'
onClick={() => {
document
.getElementById('menu')
?.classList.remove('max-md:translate-x-[0%]');
document.getElementById('menu-close')?.classList.add('hidden');
}}
>
<CrossIcon2 />
</div>
</div>
id='menu-backdrop'
className='hidden md:hidden fixed top-0 left-0 h-full w-full z-[60] bg-gray-900/70'
/>
</>
);
};

View file

@ -20,6 +20,7 @@ const MobileBar = () => {
.getElementById('menu')
?.classList.add('max-md:translate-x-[0%]');
document.getElementById('menu-close')?.classList.remove('hidden');
document.getElementById('menu-backdrop')?.classList.remove('hidden');
}}
>
<span className='sr-only'>Open sidebar</span>