fix: fix ui layout when in mobile mode (#16793)

This commit is contained in:
Good Wood
2025-03-26 11:01:13 +08:00
committed by GitHub
parent 37134c5987
commit 71edaba9df
2 changed files with 12 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ import { memo } from 'react'
import type { ChatItem } from '../../types'
import { useChatContext } from '../context'
import Button from '@/app/components/base/button'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
type SuggestedQuestionsProps = {
item: ChatItem
@@ -11,6 +12,10 @@ const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({
item,
}) => {
const { onSend } = useChatContext()
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
const klassName = `mr-1 mt-1 ${isMobile ? 'block overflow-hidden text-ellipsis' : ''} max-w-full shrink-0 last:mr-0`
const {
isOpeningStatement,
suggestedQuestions,
@@ -25,7 +30,7 @@ const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({
<Button
key={index}
variant='secondary-accent'
className='mr-1 mt-1 max-w-full shrink-0 last:mr-0'
className={klassName}
onClick={() => onSend?.(question)}
>
{question}