This commit is contained in:
2025-12-01 17:21:38 +08:00
parent 32fee2b8ab
commit fab8c13cb3
7511 changed files with 996300 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import React from 'react'
import { CreateFromDSLModalTab } from '@/app/components/app/create-from-dsl-modal'
import { useTranslation } from 'react-i18next'
import Item from './item'
type TabProps = {
currentTab: CreateFromDSLModalTab
setCurrentTab: (tab: CreateFromDSLModalTab) => void
}
const Tab = ({
currentTab,
setCurrentTab,
}: TabProps) => {
const { t } = useTranslation()
const tabs = [
{
key: CreateFromDSLModalTab.FROM_FILE,
label: t('app.importFromDSLFile'),
},
{
key: CreateFromDSLModalTab.FROM_URL,
label: t('app.importFromDSLUrl'),
},
]
return (
<div className='system-md-semibold flex h-9 items-center gap-x-6 border-b border-divider-subtle px-6 text-text-tertiary'>
{
tabs.map(tab => (
<Item
key={tab.key}
isActive={currentTab === tab.key}
label={tab.label}
onClick={setCurrentTab.bind(null, tab.key)}
/>
))
}
</div>
)
}
export default Tab

View File

@@ -0,0 +1,33 @@
import React from 'react'
import cn from '@/utils/classnames'
type ItemProps = {
isActive: boolean
label: string
onClick: () => void
}
const Item = ({
isActive,
label,
onClick,
}: ItemProps) => {
return (
<div
className={cn(
'system-md-semibold relative flex h-full cursor-pointer items-center text-text-tertiary',
isActive && 'text-text-primary',
)}
onClick={onClick}
>
{label}
{
isActive && (
<div className='absolute bottom-0 h-0.5 w-full bg-util-colors-blue-brand-blue-brand-600' />
)
}
</div>
)
}
export default React.memo(Item)