-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathindex.ts
More file actions
146 lines (138 loc) · 4.25 KB
/
Copy pathindex.ts
File metadata and controls
146 lines (138 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import type { ComponentType } from 'react';
import { Platform } from 'react-native';
import { BackgroundColorDemo } from './BackgroundColorDemo';
import { BenchmarkDemo } from './BenchmarkDemo';
import { BannerDemo } from './BannerDemo';
import { CardFlipDemo } from './CardFlipDemo';
import { BorderDemo } from './BorderDemo';
import { BorderRadiusDemo } from './BorderRadiusDemo';
import { ButtonDemo } from './ButtonDemo';
import { CombinedDemo } from './CombinedDemo';
import { ComparisonDemo } from './ComparisonDemo';
import { CustomEasingDemo } from './CustomEasingDemo';
import { DelayDemo } from './DelayDemo';
import { EnterDemo } from './EnterDemo';
import { ExitDemo } from './ExitDemo';
import { FadeDemo } from './FadeDemo';
import { InterruptDemo } from './InterruptDemo';
import { PulseDemo } from './PulseDemo';
import { RotateDemo } from './RotateDemo';
import { ScaleDemo } from './ScaleDemo';
import { SlideDemo } from './SlideDemo';
import { StyleReRenderDemo } from './StyleReRenderDemo';
import { StyledCardDemo } from './StyledCardDemo';
import { TransformOriginDemo } from './TransformOriginDemo';
import { PerPropertyDemo } from './PerPropertyDemo';
import { SpinDemo } from './SpinDemo';
import { UniwindDemo } from './uniwind/UniwindDemo';
interface DemoEntry {
component: ComponentType;
title: string;
section: string;
}
export const demos: Record<string, DemoEntry> = {
'button': { component: ButtonDemo, title: 'Button', section: 'Basic' },
'fade': { component: FadeDemo, title: 'Fade', section: 'Basic' },
'slide': { component: SlideDemo, title: 'Slide', section: 'Basic' },
'enter': { component: EnterDemo, title: 'Enter', section: 'Basic' },
'exit': { component: ExitDemo, title: 'Exit', section: 'Basic' },
'rotate': { component: RotateDemo, title: 'Rotate', section: 'Transform' },
'scale': { component: ScaleDemo, title: 'Scale', section: 'Transform' },
'card-flip': {
component: CardFlipDemo,
title: 'Card Flip',
section: 'Transform',
},
'transform-origin': {
component: TransformOriginDemo,
title: 'Transform Origin',
section: 'Transform',
},
'custom-easing': {
component: CustomEasingDemo,
title: 'Custom Easing',
section: 'Timing',
},
'delay': { component: DelayDemo, title: 'Delay', section: 'Timing' },
'combined': { component: CombinedDemo, title: 'Combined', section: 'Timing' },
'styled-card': {
component: StyledCardDemo,
title: 'Styled Card',
section: 'Style',
},
'border': {
component: BorderDemo,
title: 'Border',
section: 'Style',
},
'border-radius': {
component: BorderRadiusDemo,
title: 'Border Radius',
section: 'Style',
},
'background-color': {
component: BackgroundColorDemo,
title: 'Background Color',
section: 'Style',
},
'style-rerender': {
component: StyleReRenderDemo,
title: 'Style Re-Render',
section: 'Style',
},
'uniwind': {
component: UniwindDemo,
title: 'Uniwind',
section: 'Style',
},
'spin': { component: SpinDemo, title: 'Spin', section: 'Loop' },
'pulse': { component: PulseDemo, title: 'Pulse', section: 'Loop' },
'banner': { component: BannerDemo, title: 'Banner', section: 'Loop' },
'interrupt': {
component: InterruptDemo,
title: 'Interrupt',
section: 'Advanced',
},
'comparison': {
component: ComparisonDemo,
title: 'Comparison',
section: 'Advanced',
},
'per-property': {
component: PerPropertyDemo,
title: 'Per-Property',
section: 'Advanced',
},
...(Platform.OS !== 'web'
? {
benchmark: {
component: BenchmarkDemo,
title: 'Benchmark',
section: 'Advanced',
},
}
: {}),
};
interface SectionData {
title: string;
data: { key: string; title: string }[];
}
const sectionOrder = [
'Basic',
'Transform',
'Timing',
'Style',
'Loop',
'Advanced',
];
export function getDemoSections(): SectionData[] {
const grouped = new Map<string, { key: string; title: string }[]>();
for (const [key, entry] of Object.entries(demos)) {
const list = grouped.get(entry.section) ?? [];
list.push({ key, title: entry.title });
grouped.set(entry.section, list);
}
return sectionOrder
.filter((s) => grouped.has(s))
.map((s) => ({ title: s, data: grouped.get(s)! }));
}