Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.6 KB
Raw Blame
'use client'
import type { FC } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { RiEqualizer2Line } from '@remixicon/react'
import { useBoolean } from 'ahooks'
import * as React from 'react'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'

const I18N_PREFIX = 'stepOne.website'

type Props = Readonly<{
  className?: string
  children: React.ReactNode
  controlFoldOptions?: number
}>

const OptionsWrap: FC<Props> = ({ className = '', children, controlFoldOptions }) => {
  const { t } = useTranslation(['datasetCreation'])

  const [fold, { toggle: foldToggle, setTrue: foldHide }] = useBoolean(false)

  useEffect(() => {
    if (controlFoldOptions) foldHide()
  }, [controlFoldOptions])
  return (
    <div className={cn(className, !fold ? 'mb-0' : 'mb-3')}>
      <div
        className="flex h-6.5 cursor-pointer items-center gap-x-1 py-1 select-none"
        onClick={foldToggle}
      >
        <div className="flex grow items-center">
          <RiEqualizer2Line className="mr-1 size-4 text-text-secondary" />
          <span className="text-[13px] leading-4 font-semibold text-text-secondary uppercase">
            {t(($) => $[`${I18N_PREFIX}.options`], { ns: 'datasetCreation' })}
          </span>
        </div>
        <span
          aria-hidden
          className={cn(
            'i-custom-vender-line-arrows-chevron-right h-3.5 w-3.5',
            cn(!fold && 'rotate-90', 'size-4 shrink-0 text-text-tertiary'),
          )}
        />
      </div>
      {!fold && <div className="mb-4">{children}</div>}
    </div>
  )
}
export default React.memo(OptionsWrap)