2025-04-24 21:26:54 +08:00
|
|
|
import React from 'react'
|
2025-04-28 13:33:16 +08:00
|
|
|
import Divider from '@/app/components/base/divider'
|
|
|
|
import Button from '@/app/components/base/button'
|
2025-04-24 21:26:54 +08:00
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import { RiBookOpenLine, RiEqualizer2Line } from '@remixicon/react'
|
|
|
|
|
|
|
|
type HeaderProps = {
|
|
|
|
isInPipeline?: boolean
|
2025-05-21 10:53:18 +08:00
|
|
|
onClickConfiguration?: () => void
|
2025-04-28 13:33:16 +08:00
|
|
|
title: string
|
2025-05-21 10:53:18 +08:00
|
|
|
buttonText?: string
|
2025-04-28 13:33:16 +08:00
|
|
|
docTitle: string
|
|
|
|
docLink: string
|
2025-04-24 21:26:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const Header = ({
|
|
|
|
isInPipeline = false,
|
2025-04-28 13:33:16 +08:00
|
|
|
onClickConfiguration,
|
|
|
|
title,
|
|
|
|
buttonText,
|
|
|
|
docTitle,
|
|
|
|
docLink,
|
2025-04-24 21:26:54 +08:00
|
|
|
}: HeaderProps) => {
|
|
|
|
return (
|
|
|
|
<div className='flex items-center gap-x-2'>
|
2025-04-28 14:33:01 +08:00
|
|
|
<div className='flex shrink-0 grow items-center gap-x-1'>
|
2025-04-24 21:26:54 +08:00
|
|
|
<div className={cn(
|
|
|
|
'text-text-secondary',
|
|
|
|
isInPipeline ? 'system-sm-semibold' : 'system-md-semibold',
|
|
|
|
)}>
|
2025-04-28 13:33:16 +08:00
|
|
|
{title}
|
2025-04-24 21:26:54 +08:00
|
|
|
</div>
|
2025-05-21 10:53:18 +08:00
|
|
|
{!isInPipeline && (
|
2025-06-05 15:44:18 +08:00
|
|
|
<>
|
|
|
|
<Divider type='vertical' className='mx-1 h-3.5' />
|
|
|
|
<Button
|
|
|
|
variant='secondary'
|
|
|
|
size='small'
|
|
|
|
className='px-1.5'
|
|
|
|
>
|
|
|
|
<RiEqualizer2Line
|
|
|
|
className='h-4 w-4'
|
|
|
|
onClick={onClickConfiguration}
|
|
|
|
/>
|
|
|
|
<span className='system-xs-medium'>
|
|
|
|
{buttonText}
|
|
|
|
</span>
|
|
|
|
</Button>
|
|
|
|
</>
|
2025-05-21 10:53:18 +08:00
|
|
|
)}
|
2025-04-24 21:26:54 +08:00
|
|
|
</div>
|
|
|
|
<a
|
2025-04-28 14:33:01 +08:00
|
|
|
className='system-xs-medium flex items-center gap-x-1 overflow-hidden text-text-accent'
|
2025-04-28 13:33:16 +08:00
|
|
|
href={docLink}
|
2025-04-24 21:26:54 +08:00
|
|
|
target='_blank'
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
>
|
2025-04-28 14:33:01 +08:00
|
|
|
<RiBookOpenLine className='size-3.5 shrink-0' />
|
|
|
|
<span className='grow truncate' title={docTitle}>{docTitle}</span>
|
2025-04-24 21:26:54 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default React.memo(Header)
|