-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathblueprint-collection.tsx
More file actions
97 lines (93 loc) · 2.51 KB
/
Copy pathblueprint-collection.tsx
File metadata and controls
97 lines (93 loc) · 2.51 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
import classNames from 'classnames'
import { LicenseInfo } from 'components/license-info/license-info'
import { BasicTooltip } from 'design-system/components/tooltip/basic-tooltip'
import { EyeIcon } from 'lucide-react'
import { buttonVariants } from 'nova-ui-kit'
import { ReactNode, useState } from 'react'
import { Link } from 'react-router-dom'
import styles from './blueprint-collection.module.scss'
export interface BlueprintItem {
id: string
image: { src: string; width: number; height: number }
label: string
timeLabel: string
countLabel: string
to?: string
}
export const BlueprintCollection = ({
children,
showLicenseInfo,
}: {
children: ReactNode
showLicenseInfo?: boolean
}) => (
<div className={classNames(styles.blueprint)}>
{showLicenseInfo ? (
<div className={styles.licenseInfoContent}>
<LicenseInfo />
</div>
) : null}
<div className={styles.blueprintContent}>{children}</div>
</div>
)
export const BlueprintItem = ({
item,
}: {
item: {
id: string
image: { src: string; width: number; height: number }
label: string
timeLabel: string
countLabel: string
to?: string
}
}) => {
const [size, setSize] = useState({
width: item.image.width,
height: item.image.height,
})
return (
<div className={classNames(styles.blueprintItem, 'group')}>
<div className={styles.blueprintInfo} style={{ width: size.width }}>
<span className="grow text-muted-foreground text-right">
{item.timeLabel}
</span>
</div>
<div className={styles.blueprintImage}>
<img
src={item.image.src}
alt=""
width={size.width}
height={size.height}
onLoad={(e) => {
setSize({
width: e.currentTarget.width,
height: e.currentTarget.height,
})
}}
/>
{item.to ? (
<BasicTooltip asChild content="Show in session capture">
<Link
to={item.to}
className={classNames(
buttonVariants({ size: 'icon', variant: 'outline' }),
'flex w-8 h-8 absolute right-2 bottom-2 invisible group-hover:visible'
)}
>
<EyeIcon className="w-4 h-4" />
</Link>
</BasicTooltip>
) : null}
</div>
<span
className={classNames(
styles.blueprintLabel,
'body-small text-foreground'
)}
>
{item.label}
</span>
</div>
)
}