|
@@ -3,39 +3,26 @@ import './Timeline.scss'
|
|
|
import { CheckBoxType, TimelineType } from '@/utils/types'
|
|
import { CheckBoxType, TimelineType } from '@/utils/types'
|
|
|
import CheckBox from '../basic/CheckBox'
|
|
import CheckBox from '../basic/CheckBox'
|
|
|
|
|
|
|
|
-// interface TimelineItem {
|
|
|
|
|
-// status: 'padding' | 'done' | 'not_done';
|
|
|
|
|
-// content: string;
|
|
|
|
|
-// time: string;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
export default function Component(props: { items: any[], title?: string, type?: TimelineType }) {
|
|
export default function Component(props: { items: any[], title?: string, type?: TimelineType }) {
|
|
|
return <View className="timeline">
|
|
return <View className="timeline">
|
|
|
{
|
|
{
|
|
|
props.title && <Text className='timeline_title'>{props.title}</Text>
|
|
props.title && <Text className='timeline_title'>{props.title}</Text>
|
|
|
}
|
|
}
|
|
|
- {props.items.map((item, index) => (
|
|
|
|
|
- <View className="timeline-item" style={{ marginBottom: index !== props.items.length - 1 ? 10 : 0 }} key={index}>
|
|
|
|
|
- <View className='timeline-icon-bg'>
|
|
|
|
|
- {
|
|
|
|
|
- item.status == 'padding' && <CheckBox type={CheckBoxType.empty} opacity={0.4} />
|
|
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
- item.status == 'done' && <CheckBox type={CheckBoxType.check} opacity={0.4} />
|
|
|
|
|
- }
|
|
|
|
|
- {
|
|
|
|
|
- item.status == 'un_done' && <CheckBox type={CheckBoxType.cross} opacity={0.4} />
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
- {index !== props.items.length - 1 && <View className={(props.items[index + 1].status == 'done' && item.status == 'done') ? 'timeline-line' : 'timeline-line dash'} />}
|
|
|
|
|
- {
|
|
|
|
|
- props.type == TimelineType.timeMutiLine ?
|
|
|
|
|
- <View className="timeline-content">
|
|
|
|
|
- <View className="timeline-text">{item.title}</View>
|
|
|
|
|
- <View className="timeline-time">{item.content}</View>
|
|
|
|
|
- </View> :
|
|
|
|
|
- <View className="timeline-content-row" style={{ marginBottom: index !== props.items.length - 1 ? 32 : 0 }}>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ props.items.map((item, index) => (
|
|
|
|
|
+ <View className='timelineItem'>
|
|
|
|
|
+ <View className='timelineContentView'>
|
|
|
|
|
+ {
|
|
|
|
|
+ item.status == 'padding' && <CheckBox type={CheckBoxType.empty} opacity={0.4} />
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ item.status == 'done' && <CheckBox type={CheckBoxType.check} opacity={0.4} />
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ item.status == 'un_done' && <CheckBox type={CheckBoxType.cross} opacity={0.4} />
|
|
|
|
|
+ }
|
|
|
|
|
+ <View className='timelineContentDetail'>
|
|
|
<View className="timeline-time">{props.type == TimelineType.timeSecond ? item.title : item.content}</View>
|
|
<View className="timeline-time">{props.type == TimelineType.timeSecond ? item.title : item.content}</View>
|
|
|
{
|
|
{
|
|
|
item.date && <View className="timeline-date">{item.date}</View>
|
|
item.date && <View className="timeline-date">{item.date}</View>
|
|
@@ -43,8 +30,53 @@ export default function Component(props: { items: any[], title?: string, type?:
|
|
|
<View style={{ flex: 1 }} />
|
|
<View style={{ flex: 1 }} />
|
|
|
<View className="timeline-text">{props.type == TimelineType.timeSecond ? item.content : item.title}</View>
|
|
<View className="timeline-text">{props.type == TimelineType.timeSecond ? item.content : item.title}</View>
|
|
|
</View>
|
|
</View>
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className={index !== props.items.length - 1 ? 'timeline_line1 line1_bottom_space' : 'timeline_line1 line1_bottom_zero'} />
|
|
|
|
|
+ {index !== props.items.length - 1 && <View className={(props.items[index + 1].status == 'done' && item.status == 'done') ? 'timeline-line' : 'timeline-line dash'} />}
|
|
|
|
|
+
|
|
|
|
|
+ </View>
|
|
|
|
|
+ ))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
</View>
|
|
</View>
|
|
|
-}
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// export default function Component(props: { items: any[], title?: string, type?: TimelineType }) {
|
|
|
|
|
+// return <View className="timeline">
|
|
|
|
|
+// {
|
|
|
|
|
+// props.title && <Text className='timeline_title'>{props.title}</Text>
|
|
|
|
|
+// }
|
|
|
|
|
+// {props.items.map((item, index) => (
|
|
|
|
|
+// <View className="timeline-item" style={{ marginBottom: index !== props.items.length - 1 ? 10 : 0 }} key={index}>
|
|
|
|
|
+// <View className='timeline-icon-bg'>
|
|
|
|
|
+// {
|
|
|
|
|
+// item.status == 'padding' && <CheckBox type={CheckBoxType.empty} opacity={0.4} />
|
|
|
|
|
+// }
|
|
|
|
|
+// {
|
|
|
|
|
+// item.status == 'done' && <CheckBox type={CheckBoxType.check} opacity={0.4} />
|
|
|
|
|
+// }
|
|
|
|
|
+// {
|
|
|
|
|
+// item.status == 'un_done' && <CheckBox type={CheckBoxType.cross} opacity={0.4} />
|
|
|
|
|
+// }
|
|
|
|
|
+// </View>
|
|
|
|
|
+// {index !== props.items.length - 1 && <View className={(props.items[index + 1].status == 'done' && item.status == 'done') ? 'timeline-line' : 'timeline-line dash'} />}
|
|
|
|
|
+// {
|
|
|
|
|
+// props.type == TimelineType.timeMutiLine ?
|
|
|
|
|
+// <View className="timeline-content">
|
|
|
|
|
+// <View className="timeline-text">{item.title}</View>
|
|
|
|
|
+// <View className="timeline-time">{item.content}</View>
|
|
|
|
|
+// </View> :
|
|
|
|
|
+// <View className="timeline-content-row" style={{ marginBottom: index !== props.items.length - 1 ? 32 : 0 }}>
|
|
|
|
|
+// <View className="timeline-time">{props.type == TimelineType.timeSecond ? item.title : item.content}</View>
|
|
|
|
|
+// {
|
|
|
|
|
+// item.date && <View className="timeline-date">{item.date}</View>
|
|
|
|
|
+// }
|
|
|
|
|
+// <View style={{ flex: 1 }} />
|
|
|
|
|
+// <View className="timeline-text">{props.type == TimelineType.timeSecond ? item.content : item.title}</View>
|
|
|
|
|
+// </View>
|
|
|
|
|
+// }
|
|
|
|
|
+// </View>
|
|
|
|
|
+// ))}
|
|
|
|
|
+// </View>
|
|
|
|
|
+// }
|