-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve sidebar positioning in evaluation logs and document logs (#550)
Now when you scroll the logs table the top of the open log info panel is lost. With this change the panel is always visible and also have inner scroll
- Loading branch information
1 parent
88639e9
commit 0d1d3d9
Showing
16 changed files
with
566 additions
and
349 deletions.
There are no files selected for viewing
71 changes: 39 additions & 32 deletions
71
...Id]/versions/[commitUuid]/documents/[documentUuid]/_components/MetadataInfoTabs/index.tsx
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 |
---|---|---|
@@ -1,41 +1,48 @@ | ||
import { ReactNode, useState } from 'react' | ||
import { forwardRef, ReactNode, useState } from 'react' | ||
|
||
import { cn, TabSelector, TabSelectorOption } from '@latitude-data/web-ui' | ||
|
||
type RenderProps = { selectedTab: string } | ||
export function MetadataInfoTabs({ | ||
className, | ||
tabs = [ | ||
{ label: 'Metadata', value: 'metadata' }, | ||
{ label: 'Messages', value: 'messages' }, | ||
], | ||
children, | ||
}: { | ||
type Props = { | ||
children: (args: RenderProps) => ReactNode | ||
tabs?: TabSelectorOption<string>[] | ||
className?: string | ||
}) { | ||
const [selectedTab, setSelectedTab] = useState<string>('metadata') | ||
return ( | ||
<div | ||
className={cn( | ||
'flex-shrink-0 flex flex-col', | ||
'border border-border rounded-lg items-center', | ||
className, | ||
)} | ||
> | ||
<div className='pt-6'> | ||
<TabSelector | ||
options={tabs} | ||
selected={selectedTab} | ||
onSelect={setSelectedTab} | ||
/> | ||
</div> | ||
<div className='my-5 px-4 flex flex-col gap-y-5 relative w-full'> | ||
<div className='flex flex-col gap-4 w-full overflow-x-auto'> | ||
{children({ selectedTab })} | ||
} | ||
export const MetadataInfoTabs = forwardRef<HTMLDivElement, Props>( | ||
function MetadataInfoTabs( | ||
{ | ||
className, | ||
tabs = [ | ||
{ label: 'Metadata', value: 'metadata' }, | ||
{ label: 'Messages', value: 'messages' }, | ||
], | ||
children, | ||
}, | ||
ref, | ||
) { | ||
const [selectedTab, setSelectedTab] = useState<string>('metadata') | ||
return ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'flex flex-col flex-grow min-h-0 bg-background', | ||
'border border-border rounded-lg items-center relative', | ||
className, | ||
)} | ||
> | ||
<div className='pt-6 pb-2'> | ||
<TabSelector | ||
options={tabs} | ||
selected={selectedTab} | ||
onSelect={setSelectedTab} | ||
/> | ||
</div> | ||
<div className='w-full custom-scrollbar overflow-y-auto'> | ||
<div className='flex px-4 py-5 flex-col gap-4 w-full overflow-x-auto'> | ||
{children({ selectedTab })} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
) | ||
}, | ||
) |
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
Oops, something went wrong.