index.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import type { FC } from 'react'
  2. import { RiArrowLeftLine } from '@remixicon/react'
  3. import Link from 'next/link'
  4. import { useTranslation } from 'react-i18next'
  5. import { Stepper, type StepperProps } from '../stepper'
  6. import classNames from '@/utils/classnames'
  7. export type TopbarProps = Pick<StepperProps, 'activeIndex'> & {
  8. className?: string
  9. }
  10. const STEP_T_MAP: Record<number, string> = {
  11. 1: 'datasetCreation.steps.one',
  12. 2: 'datasetCreation.steps.two',
  13. 3: 'datasetCreation.steps.three',
  14. }
  15. export const Topbar: FC<TopbarProps> = (props) => {
  16. const { className, ...rest } = props
  17. const { t } = useTranslation()
  18. return <div className={classNames('flex shrink-0 h-[52px] items-center justify-between relative border-b border-b-divider-subtle', className)}>
  19. <Link href={'/datasets'} className="h-12 pl-2 pr-6 py-2 justify-start items-center gap-1 inline-flex">
  20. <div className='p-2'>
  21. <RiArrowLeftLine className='size-4 text-text-primary' />
  22. </div>
  23. <p className="text-text-primary system-sm-semibold-uppercase">
  24. {t('datasetCreation.steps.header.creation')}
  25. </p>
  26. </Link>
  27. <div className={
  28. 'top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 absolute'
  29. }>
  30. <Stepper
  31. steps={Array.from({ length: 3 }, (_, i) => ({
  32. name: t(STEP_T_MAP[i + 1]),
  33. }))}
  34. {...rest}
  35. />
  36. </div>
  37. </div>
  38. }