Skip to content

Commit 04fc484

Browse files
authored
feat(template): Cylinders 3d (#6)
* feat: add cylinder-3d structure * feat: add alternating item * feat: new built-in template * refactor: simplify structure * feat: update SimpleItem to support usePaletteColor and adjust built-in templates
1 parent c59f9a1 commit 04fc484

4 files changed

Lines changed: 828 additions & 5 deletions

File tree

packages/infographic/src/designs/items/SimpleItem.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface SimpleItemProps extends BaseItemProps {
1111
gap?: number;
1212
showIcon?: boolean;
1313
iconSize?: number;
14+
usePaletteColor?: boolean;
1415
}
1516

1617
export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
@@ -24,10 +25,17 @@ export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
2425
iconSize = 30,
2526
positionH = 'normal',
2627
positionV = 'normal',
28+
usePaletteColor = false,
2729
themeColors,
2830
},
2931
restProps,
30-
] = getItemProps(props, ['width', 'gap', 'showIcon', 'iconSize']);
32+
] = getItemProps(props, [
33+
'width',
34+
'gap',
35+
'showIcon',
36+
'iconSize',
37+
'usePaletteColor',
38+
]);
3139

3240
const { label, desc, icon } = datum;
3341

@@ -40,14 +48,17 @@ export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
4048
};
4149

4250
const textAlign = getTextAlign(positionH);
51+
const labelColor = usePaletteColor
52+
? themeColors.colorPrimary
53+
: themeColors.colorText;
4354

4455
const labelContent = (
4556
<ItemLabel
4657
indexes={indexes}
4758
width={width}
4859
alignHorizontal="center"
4960
alignVertical="center"
50-
fill={themeColors.colorText}
61+
fill={labelColor}
5162
>
5263
{label}
5364
</ItemLabel>
@@ -69,7 +80,7 @@ export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
6980
width={width}
7081
alignHorizontal={textAlign}
7182
alignVertical="center"
72-
fill={themeColors.colorText}
83+
fill={labelColor}
7384
>
7485
{label}
7586
</ItemLabel>
@@ -152,7 +163,7 @@ export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
152163
width={textWidth}
153164
alignHorizontal="right"
154165
alignVertical="center"
155-
fill={themeColors.colorText}
166+
fill={labelColor}
156167
>
157168
{label}
158169
</ItemLabel>
@@ -178,7 +189,7 @@ export const SimpleItem: ComponentType<SimpleItemProps> = (props) => {
178189
width={textWidth}
179190
alignHorizontal="left"
180191
alignVertical="center"
181-
fill={themeColors.colorText}
192+
fill={labelColor}
182193
>
183194
{label}
184195
</ItemLabel>

packages/infographic/src/designs/structures/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export * from './relation-network';
1616
export * from './sequence-ascending-steps';
1717
export * from './sequence-circle-arrows';
1818
export * from './sequence-color-snake-steps';
19+
export * from './sequence-cylinders-3d';
1920
export * from './sequence-horizontal-zigzag';
2021
export * from './sequence-roadmap-vertical';
2122
export * from './sequence-snake-steps';

0 commit comments

Comments
 (0)