Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix css details on ThreadDoubleAccordion #206

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions apps/masterbots.ai/components/shared/thread-accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export function ThreadAccordion({
// disable automatic client fetch by default
// ThreadList sets this to true to load the rest of messages inside ThreadDialog or ThreadListAccordion
// ThreadList only receives the first question and answer
showHeading = true
showHeading = true,
className = ''
}: ThreadAccordionProps) {
const pathname = usePathname()
const router = useRouter()
Expand Down Expand Up @@ -72,7 +73,7 @@ export function ThreadAccordion({
return (
<div className="flex w-full">
<Accordion
className={cn('w-full border border-solid border-mirage scroll')}
className={cn('w-full border border-solid border-mirage scroll', className)}
AndlerRL marked this conversation as resolved.
Show resolved Hide resolved
defaultValue={['pair-0', 'pair-1', 'pair-2']}
type="multiple"
key={`accordion-${JSON.stringify(pairs)}`}
Expand All @@ -89,9 +90,9 @@ export function ThreadAccordion({
// is not the frist question we return follow question style
!isFirst ? (
<AccordionTrigger
className={cn('px-5 border-y border-solid border-mirage')}
className={cn('pl-5 pr-[47px] border-y border-solid border-mirage')}
AndlerRL marked this conversation as resolved.
Show resolved Hide resolved
>
<div className="pl-12 md:text-lg">
<div className="pl-[27px] md:text-lg">
{p.userMessage.content}
</div>
</AccordionTrigger>
Expand Down Expand Up @@ -124,7 +125,7 @@ export function ThreadAccordion({

<AccordionContent
aria-expanded
className={cn('mx-8 border-x border-solid border-mirage')}
className={cn('mx-[46px] border-x border-solid border-mirage')}
AndlerRL marked this conversation as resolved.
Show resolved Hide resolved
>
{p.chatGptMessage.map(message => (
<BrowseChatMessage
Expand All @@ -148,4 +149,5 @@ interface ThreadAccordionProps {
clientFetch?: boolean
chat?: boolean
showHeading?: boolean
className?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export function ThreadListAccordion({
type="multiple"
>
{/* Frist level question and excerpt visible on lists */}
<AccordionItem className="relative" value="pair-1">
<AccordionItem className="border-b-mirage border-solid relative" value="pair-1">
<AccordionTrigger
isSticky
className={cn('hover:bg-mirage px-5', state.isOpen && 'bg-mirage')}
className={cn('hover:bg-mirage px-2 border border-[transparent] dark:border-b-mirage border-b-gray-300 rounded-t-lg', state.isOpen && 'bg-mirage')}
AndlerRL marked this conversation as resolved.
Show resolved Hide resolved
>
<ThreadHeading
chat={chat}
Expand All @@ -50,7 +50,7 @@ export function ThreadListAccordion({
</AccordionTrigger>

{/* TODO: we need to slide down the content */}
<AccordionContent className={cn('pl-14')}>
<AccordionContent>
{/* Secod level accordion with follow up questions
showHeading must be false as we already have in screen on AccordionTrigger above */}
<div className="overflow-y-scroll scrollbar srcoll-smooth max-h-[500px]">
Expand All @@ -60,6 +60,7 @@ export function ThreadListAccordion({
showHeading={false}
thread={thread}
initialMessagePairs={createMessagePairs(thread.messages)}
className='border-r-[transparent]'
AndlerRL marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
</AccordionContent>
Expand Down
4 changes: 2 additions & 2 deletions apps/masterbots.ai/components/ui/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const AccordionTrigger = React.forwardRef<
>
<AccordionPrimitive.Trigger
className={cn(
'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
'flex flex-1 items-center justify-between py-4 font-medium transition-all [&[data-state=open]>svg]:rotate-180',
className
)}
ref={ref}
Expand All @@ -60,7 +60,7 @@ const AccordionContent = React.forwardRef<
ref={ref}
{...props}
>
<div className={cn('pb-4 pt-0', className)}>{children}</div>
<div className={cn('pt-0', className)}>{children}</div>
</AccordionPrimitive.Content>
))

Expand Down
Loading