优化色卡界面加载色卡颜色种类的处理过程。
This commit is contained in:
parent
ccedaa62a6
commit
7f6c217d7e
|
@ -6,6 +6,7 @@ import { HSegmentedControl } from '../components/HSegmentedControl';
|
|||
import { ScrollArea } from '../components/ScrollArea';
|
||||
import { ColorDescription } from '../models';
|
||||
import { ColorCard } from '../page-components/cards-detail/ColorCard';
|
||||
import { mapToObject } from '../utls';
|
||||
import styles from './CardsDetail.module.css';
|
||||
|
||||
type ColorModes = 'hex' | 'rgb' | 'hsl' | 'lab' | 'oklch';
|
||||
|
@ -20,7 +21,11 @@ export function CardsDetail({ mainTag }: CardsDetailProps) {
|
|||
return [];
|
||||
}
|
||||
try {
|
||||
const embededCategories = colorFn.color_categories() as { label: string; value: string }[];
|
||||
const embededCategories = colorFn.color_categories().map(mapToObject) as {
|
||||
label: string;
|
||||
value: string;
|
||||
}[];
|
||||
console.debug('[Fetch color categories]', embededCategories);
|
||||
return embededCategories.filter((cate) => !isEqual(cate.value, 'unknown'));
|
||||
} catch (e) {
|
||||
console.error('[Fetch color categories]', e);
|
||||
|
|
Loading…
Reference in New Issue
Block a user