generated from idea2app/Lark-Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCard.tsx
More file actions
111 lines (102 loc) · 3.48 KB
/
Card.tsx
File metadata and controls
111 lines (102 loc) · 3.48 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
import { HorizontalMarqueeBox, text2color } from 'idea-react';
import { TableCellAttachment } from 'mobx-lark';
import { observer } from 'mobx-react';
import dynamic from 'next/dynamic';
import { Component } from 'react';
import { Badge, Carousel, Col, Container, Row } from 'react-bootstrap';
import { LarkImage } from '../../Base/LarkImage';
import { ScoreBar } from '../../Base/ScoreBar';
import { TimeRange } from '../../Base/TimeRange';
import { ActivityPeople } from '../People';
import { AgendaToolbarProps } from './Toolbar';
const AgendaToolbar = dynamic(() => import('./Toolbar'), { ssr: false });
@observer
export class AgendaCard extends Component<AgendaToolbarProps> {
renderCardImage = (file: TableCellAttachment) => (
<LarkImage
key={file.attachmentToken}
className="m-auto object-fit-cover"
style={{ width: '6rem', height: '6rem' }}
src={[file]}
roundedCircle
/>
);
renderAvatarImages() {
const { type, mentors, mentorAvatars, organizationLogos } = this.props;
const images = (type === 'Booth' && organizationLogos) || mentorAvatars;
return (mentors as string[])?.[1] ? (
<Carousel indicators={false}>
{(images as TableCellAttachment[])?.map(file => (
<Carousel.Item key={file.attachmentToken}>{this.renderCardImage(file)}</Carousel.Item>
))}
</Carousel>
) : (
<ActivityPeople size={5} avatars={images} />
);
}
render() {
const {
activityId,
id,
type,
title,
mentors,
mentorOrganizations,
mentorPositions,
startTime,
endTime,
score,
} = this.props;
return (
<Container
className="h-100"
style={{ contentVisibility: 'auto', containIntrinsicHeight: '13rem' }}
>
<Row className="border shadow-sm rounded h-100">
<Col xs={4} className="d-flex flex-column justify-content-around align-items-center">
<Badge bg={text2color(type + '', ['light'])}>
<HorizontalMarqueeBox maxWidth="80px" height="12px">
{type + ''}
</HorizontalMarqueeBox>
</Badge>
{this.renderAvatarImages()}
</Col>
<Col xs={8} className="d-flex flex-column py-3">
<h3 className="fs-5">
<a
className="text-decoration-none text-secondary"
href={`/activity/${activityId}/agenda/${id}`}
title={title as string}
>
<HorizontalMarqueeBox duration="20s" maxWidth="330px" height="24px">
{title as string}
</HorizontalMarqueeBox>
</a>
</h3>
<ul className="list-unstyled flex-fill d-flex flex-column justify-content-between gap-2">
<li>
<TimeRange {...{ startTime, endTime }} />
</li>
{(mentors as string[])?.map((name, index) => (
<li key={name}>
{name} {(mentorOrganizations as string[])?.[index]}{' '}
{(mentorPositions as string[])?.[index]}
</li>
))}
{score && (
<li>
<ScoreBar value={score + ''} />
</li>
)}
<AgendaToolbar
as="li"
className="justify-content-end"
{...{ ...this.props, activityId }}
/>
</ul>
</Col>
</Row>
</Container>
);
}
}