mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { IPreviewItemProps } from './index'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import PreviewItem, { PreviewType } from './index'
|
||||
import type { IPreviewItemProps } from './index'
|
||||
|
||||
// Test data builder for props
|
||||
const createDefaultProps = (overrides?: Partial<IPreviewItemProps>): IPreviewItemProps => ({
|
||||
|
||||
@ -44,29 +44,33 @@ const PreviewItem: FC<IPreviewItemProps> = ({
|
||||
const formattedIndex = (() => String(index).padStart(3, '0'))()
|
||||
|
||||
return (
|
||||
<div className='rounded-xl bg-gray-50 p-4'>
|
||||
<div className='flex h-5 items-center justify-between text-xs text-gray-500'>
|
||||
<div className='box-border flex h-[18px] items-center space-x-1 rounded-md border border-gray-200 pl-1 pr-1.5 font-medium italic'>
|
||||
<div className="rounded-xl bg-gray-50 p-4">
|
||||
<div className="flex h-5 items-center justify-between text-xs text-gray-500">
|
||||
<div className="box-border flex h-[18px] items-center space-x-1 rounded-md border border-gray-200 pl-1 pr-1.5 font-medium italic">
|
||||
{sharpIcon}
|
||||
<span>{formattedIndex}</span>
|
||||
</div>
|
||||
<div className='flex items-center space-x-1'>
|
||||
<div className="flex items-center space-x-1">
|
||||
{textIcon}
|
||||
<span>{charNums} {t('datasetCreation.stepTwo.characters')}</span>
|
||||
<span>
|
||||
{charNums}
|
||||
{' '}
|
||||
{t('datasetCreation.stepTwo.characters')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className='mt-2 line-clamp-6 max-h-[120px] overflow-hidden text-sm text-gray-800'>
|
||||
<div className="mt-2 line-clamp-6 max-h-[120px] overflow-hidden text-sm text-gray-800">
|
||||
{type === PreviewType.TEXT && (
|
||||
<div style={{ whiteSpace: 'pre-line' }}>{content}</div>
|
||||
)}
|
||||
{type === PreviewType.QA && (
|
||||
<div style={{ whiteSpace: 'pre-line' }}>
|
||||
<div className='flex'>
|
||||
<div className='text-medium mr-2 shrink-0 text-gray-400'>Q</div>
|
||||
<div className="flex">
|
||||
<div className="text-medium mr-2 shrink-0 text-gray-400">Q</div>
|
||||
<div style={{ whiteSpace: 'pre-line' }}>{qa?.question}</div>
|
||||
</div>
|
||||
<div className='flex'>
|
||||
<div className='text-medium mr-2 shrink-0 text-gray-400'>A</div>
|
||||
<div className="flex">
|
||||
<div className="text-medium mr-2 shrink-0 text-gray-400">A</div>
|
||||
<div style={{ whiteSpace: 'pre-line' }}>{qa?.answer}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user