feat(配色方案): 添加Q2配色方案支持
新增Q2配色方案相关组件、模型和样式定义 在SchemeSign组件中添加q2样式支持 扩展模型以包含Q2方案类型和存储结构
This commit is contained in:
35
src/page-components/scheme/Q2Scheme.tsx
Normal file
35
src/page-components/scheme/Q2Scheme.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import { useState } from 'react';
|
||||
import { Tab } from '../../components/Tab';
|
||||
import { SchemeContent } from '../../models';
|
||||
import { Q2SchemeStorage } from '../../q-2-scheme';
|
||||
import { isNilOrEmpty } from '../../utls';
|
||||
|
||||
const tabOptions = [
|
||||
{ title: 'Overview', id: 'overview' },
|
||||
{ title: 'Builder', id: 'builder' },
|
||||
{ title: 'Exports', id: 'export' },
|
||||
];
|
||||
|
||||
type Q2SchemeProps = {
|
||||
scheme: SchemeContent<Q2SchemeStorage>;
|
||||
};
|
||||
|
||||
export function Q2Scheme({ scheme }: Q2SchemeProps) {
|
||||
const [activeTab, setActiveTab] = useState<(typeof tabOptions)[number]['id']>(() =>
|
||||
isNil(scheme.schemeStorage.scheme) ? 'builder' : 'overview',
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tab
|
||||
tabs={tabOptions}
|
||||
activeTab={activeTab}
|
||||
onActive={(v) => setActiveTab(v as string)}
|
||||
disabled={{
|
||||
overview: isNilOrEmpty(scheme.schemeStorage?.scheme),
|
||||
export: isNilOrEmpty(scheme.schemeStorage?.cssVariables),
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user