You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 1022B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react'
  2. import { CreateFromDSLModalTab } from '@/app/components/app/create-from-dsl-modal'
  3. import { useTranslation } from 'react-i18next'
  4. import Item from './item'
  5. type TabProps = {
  6. currentTab: CreateFromDSLModalTab
  7. setCurrentTab: (tab: CreateFromDSLModalTab) => void
  8. }
  9. const Tab = ({
  10. currentTab,
  11. setCurrentTab,
  12. }: TabProps) => {
  13. const { t } = useTranslation()
  14. const tabs = [
  15. {
  16. key: CreateFromDSLModalTab.FROM_FILE,
  17. label: t('app.importFromDSLFile'),
  18. },
  19. {
  20. key: CreateFromDSLModalTab.FROM_URL,
  21. label: t('app.importFromDSLUrl'),
  22. },
  23. ]
  24. return (
  25. <div className='system-md-semibold flex h-9 items-center gap-x-6 border-b border-divider-subtle px-6 text-text-tertiary'>
  26. {
  27. tabs.map(tab => (
  28. <Item
  29. key={tab.key}
  30. isActive={currentTab === tab.key}
  31. label={tab.label}
  32. onClick={setCurrentTab.bind(null, tab.key)}
  33. />
  34. ))
  35. }
  36. </div>
  37. )
  38. }
  39. export default Tab