避免Scheme在构建之前点击预览和导出。
This commit is contained in:
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
||||
import { Tab } from '../../components/Tab';
|
||||
import { SchemeContent } from '../../models';
|
||||
import { SwatchSchemeStorage } from '../../swatch_scheme';
|
||||
import { isNilOrEmpty } from '../../utls';
|
||||
import { SchemeExport } from './Export';
|
||||
import { SwatchSchemeBuilder } from './swatch-scheme/Builder';
|
||||
import { SwatchSchemePreview } from './swatch-scheme/Preview';
|
||||
@@ -24,7 +25,15 @@ export function SwatchScheme({ scheme }: SwatchSchemeProps) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tab tabs={tabOptions} activeTab={activeTab} onActive={(v) => setActiveTab(v as string)} />
|
||||
<Tab
|
||||
tabs={tabOptions}
|
||||
activeTab={activeTab}
|
||||
onActive={(v) => setActiveTab(v as string)}
|
||||
disabled={{
|
||||
overview: isNilOrEmpty(scheme.schemeStorage?.scheme),
|
||||
export: isNilOrEmpty(scheme.schemeStorage?.cssVariables),
|
||||
}}
|
||||
/>
|
||||
{isEqual(activeTab, 'overview') && <SwatchSchemePreview scheme={scheme} />}
|
||||
{isEqual(activeTab, 'builder') && (
|
||||
<SwatchSchemeBuilder scheme={scheme} onBuildCompleted={() => setActiveTab('overview')} />
|
||||
|
Reference in New Issue
Block a user