@estiva-app/ui 0.90.2 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AttachedCard.d.ts +30 -0
- package/dist/AttachedCard.d.ts.map +1 -0
- package/dist/AttachmentCard.d.ts +14 -0
- package/dist/AttachmentCard.d.ts.map +1 -1
- package/dist/AvatarGroup.d.ts +7 -1
- package/dist/AvatarGroup.d.ts.map +1 -1
- package/dist/Card.d.ts +4 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +1 -1
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/InlineText.d.ts +5 -2
- package/dist/InlineText.d.ts.map +1 -1
- package/dist/Link.d.ts +3 -2
- package/dist/Link.d.ts.map +1 -1
- package/dist/LinkCard.d.ts +3 -3
- package/dist/LinkCard.d.ts.map +1 -1
- package/dist/LinkChip.d.ts.map +1 -1
- package/dist/LinkParts.d.ts +17 -3
- package/dist/LinkParts.d.ts.map +1 -1
- package/dist/LinkPreview.d.ts.map +1 -1
- package/dist/LinkRow.d.ts +10 -5
- package/dist/LinkRow.d.ts.map +1 -1
- package/dist/PartCard.d.ts +16 -4
- package/dist/PartCard.d.ts.map +1 -1
- package/dist/Popover.d.ts +8 -1
- package/dist/Popover.d.ts.map +1 -1
- package/dist/ReactionRow.d.ts.map +1 -1
- package/dist/RichText.d.ts.map +1 -1
- package/dist/ShowMore.d.ts +8 -3
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/SuggestionMenu.d.ts +6 -2
- package/dist/SuggestionMenu.d.ts.map +1 -1
- package/dist/editor.js +19 -12
- package/dist/editor.js.map +3 -3
- package/dist/eslint/has-a-page-and-a-story.d.ts.map +1 -1
- package/dist/eslint/index.js +1093 -1076
- package/dist/eslint/index.js.map +4 -4
- package/dist/eslint/no-restyled-part.d.ts +9 -4
- package/dist/eslint/no-restyled-part.d.ts.map +1 -1
- package/dist/gates/{chunk-BS5JASHV.js → chunk-P2P6AHRY.js} +2 -2
- package/dist/gates/{chunk-BS5JASHV.js.map → chunk-P2P6AHRY.js.map} +2 -2
- package/dist/gates/cli.js +1 -1
- package/dist/gates/gate-config.d.ts +4 -1
- package/dist/gates/gate-config.d.ts.map +1 -1
- package/dist/gates/hook.d.ts.map +1 -1
- package/dist/gates/index.js +2 -2
- package/dist/gates/index.js.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +318 -200
- package/dist/index.js.map +4 -4
- package/dist/linked.d.ts +7 -9
- package/dist/linked.d.ts.map +1 -1
- package/dist/linked.examples.d.ts.map +1 -1
- package/dist/linkedFrom.d.ts +5 -0
- package/dist/linkedFrom.d.ts.map +1 -1
- package/dist/links.d.ts +2 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/looks.d.ts +24 -0
- package/dist/looks.d.ts.map +1 -1
- package/dist/registry/{app-X2GI4WTU.js → app-IGBRDD4L.js} +3 -3
- package/dist/registry/{build-P6X3PTZP.js → build-MWN4UI23.js} +2 -2
- package/dist/registry/{chunk-P55P2QFD.js → chunk-4TWYUIOB.js} +1 -1
- package/dist/registry/chunk-4TWYUIOB.js.map +7 -0
- package/dist/registry/{chunk-V67F474L.js → chunk-NSHK76XT.js} +2 -2
- package/dist/registry/{chunk-4QWD3EBY.js → chunk-THI3SLW5.js} +1 -1
- package/dist/registry/{chunk-4QWD3EBY.js.map → chunk-THI3SLW5.js.map} +1 -1
- package/dist/registry/cli.js +3 -3
- package/dist/registry/find.d.ts +1 -1
- package/dist/registry/find.d.ts.map +1 -1
- package/dist/registry/index.js +3 -3
- package/package.json +1 -1
- package/registry.json +532 -462
- package/src/AppProvider.stories.tsx +1 -1
- package/src/AppShell.stories.tsx +1 -1
- package/src/AttachedCard.mdx +55 -0
- package/src/{CardUnder.stories.tsx → AttachedCard.stories.tsx} +10 -19
- package/src/{CardUnder.test.tsx → AttachedCard.test.tsx} +11 -11
- package/src/AttachedCard.tsx +41 -0
- package/src/AttachmentCard.stories.tsx +1 -1
- package/src/AttachmentCard.tsx +36 -14
- package/src/Avatar.stories.tsx +1 -1
- package/src/AvatarGroup.stories.tsx +1 -1
- package/src/AvatarGroup.tsx +8 -2
- package/src/Banner.stories.tsx +1 -1
- package/src/BlockHandle.stories.tsx +1 -1
- package/src/BlockNodes.stories.tsx +1 -1
- package/src/Breadcrumb.stories.tsx +1 -1
- package/src/Button.stories.tsx +1 -1
- package/src/Card.stories.tsx +1 -1
- package/src/Card.test.tsx +1 -1
- package/src/Card.tsx +5 -2
- package/src/Checkbox.stories.tsx +1 -1
- package/src/Chip.stories.tsx +1 -1
- package/src/ChipInput.stories.tsx +1 -1
- package/src/CodeBlockColours.stories.tsx +1 -1
- package/src/CollapsibleSection.stories.tsx +1 -1
- package/src/CommandPalette.stories.tsx +1 -1
- package/src/CommentBox.mdx +3 -3
- package/src/CommentBox.stories.tsx +39 -7
- package/src/CommentBox.test.tsx +1 -1
- package/src/CommentBox.tsx +27 -17
- package/src/CommentHighlights.stories.tsx +1 -1
- package/src/ComposerTriggers.stories.tsx +1 -1
- package/src/ConfirmDialog.stories.tsx +1 -1
- package/src/ContainerHeader.stories.tsx +1 -1
- package/src/DialogShell.stories.tsx +1 -1
- package/src/Divider.stories.tsx +1 -1
- package/src/DocumentEditor.stories.tsx +1 -1
- package/src/EditableText.stories.tsx +1 -1
- package/src/EditorBlockHandle.stories.tsx +1 -1
- package/src/EditorTableControls.stories.tsx +1 -1
- package/src/EmptyState.stories.tsx +1 -1
- package/src/EntryShell.mdx +1 -1
- package/src/EntryShell.stories.tsx +1 -1
- package/src/ErrorBoundary.stories.tsx +1 -1
- package/src/Field.stories.tsx +1 -1
- package/src/FieldLine.stories.tsx +1 -1
- package/src/FilePicker.stories.tsx +1 -1
- package/src/Form.stories.tsx +1 -1
- package/src/IconButton.stories.tsx +1 -1
- package/src/IdentityMenu.stories.tsx +1 -1
- package/src/InlineChip.stories.tsx +1 -1
- package/src/InlineText.mdx +1 -0
- package/src/InlineText.stories.tsx +6 -3
- package/src/InlineText.tsx +7 -2
- package/src/Kbd.stories.tsx +1 -1
- package/src/KindIcon.stories.tsx +1 -1
- package/src/Lightbox.stories.tsx +1 -1
- package/src/Link.mdx +3 -2
- package/src/Link.stories.tsx +1 -1
- package/src/Link.test.tsx +5 -3
- package/src/Link.tsx +5 -3
- package/src/LinkCard.mdx +7 -5
- package/src/LinkCard.stories.tsx +4 -1
- package/src/LinkCard.test.tsx +8 -2
- package/src/LinkCard.tsx +97 -67
- package/src/LinkChip.mdx +3 -3
- package/src/LinkChip.stories.tsx +1 -1
- package/src/LinkChip.test.tsx +1 -1
- package/src/LinkChip.tsx +17 -4
- package/src/LinkChips.stories.tsx +1 -1
- package/src/LinkParts.stories.tsx +1 -1
- package/src/LinkParts.tsx +40 -8
- package/src/LinkPlaces.stories.tsx +1 -1
- package/src/LinkPreview.mdx +1 -1
- package/src/LinkPreview.stories.tsx +1 -1
- package/src/LinkPreview.tsx +3 -1
- package/src/LinkRow.mdx +8 -6
- package/src/LinkRow.stories.tsx +3 -3
- package/src/LinkRow.test.tsx +3 -3
- package/src/LinkRow.tsx +71 -41
- package/src/ListColumn.stories.tsx +1 -1
- package/src/MembersDialog.stories.tsx +1 -1
- package/src/MembersPill.stories.tsx +1 -1
- package/src/Menu.stories.tsx +1 -1
- package/src/MenuItem.stories.tsx +1 -1
- package/src/NavItem.stories.tsx +1 -1
- package/src/NavTree.stories.tsx +1 -1
- package/src/Panel.stories.tsx +1 -1
- package/src/PartCard.mdx +5 -4
- package/src/PartCard.stories.tsx +34 -7
- package/src/PartCard.test.tsx +5 -3
- package/src/PartCard.tsx +48 -24
- package/src/PastedImages.stories.tsx +1 -1
- package/src/PastedMarkdown.stories.tsx +1 -1
- package/src/Person.stories.tsx +1 -1
- package/src/PersonTrigger.stories.tsx +1 -1
- package/src/Popover.stories.tsx +1 -1
- package/src/Popover.tsx +6 -2
- package/src/PreviewCard.stories.tsx +1 -1
- package/src/ProgressBar.stories.tsx +1 -1
- package/src/Property.stories.tsx +1 -1
- package/src/Rail.stories.tsx +1 -1
- package/src/RailItem.stories.tsx +1 -1
- package/src/Reaction.stories.tsx +1 -1
- package/src/ReactionPicker.stories.tsx +1 -1
- package/src/ReactionRow.stories.tsx +1 -1
- package/src/ReactionRow.tsx +3 -1
- package/src/ReferenceCards.mdx +3 -0
- package/src/ReferenceCards.stories.tsx +3 -1
- package/src/ReferenceMenu.mdx +1 -1
- package/src/ReferenceMenu.stories.tsx +1 -1
- package/src/RichText.stories.tsx +1 -1
- package/src/RichText.tsx +6 -2
- package/src/ScrollArea.stories.tsx +1 -1
- package/src/SearchInput.stories.tsx +1 -1
- package/src/SectionHeader.stories.tsx +1 -1
- package/src/SectionLabel.stories.tsx +1 -1
- package/src/Select.stories.tsx +1 -1
- package/src/SelectionToolbar.stories.tsx +1 -1
- package/src/ShowMore.mdx +4 -4
- package/src/ShowMore.stories.tsx +1 -1
- package/src/ShowMore.tsx +11 -6
- package/src/Sidebar.stories.tsx +1 -1
- package/src/Skeleton.stories.tsx +1 -1
- package/src/SuggestionMenu.mdx +4 -1
- package/src/SuggestionMenu.stories.tsx +14 -8
- package/src/SuggestionMenu.tsx +20 -3
- package/src/Tabs.stories.tsx +1 -1
- package/src/TextInput.stories.tsx +1 -1
- package/src/Textarea.stories.tsx +1 -1
- package/src/Toast.stories.tsx +1 -1
- package/src/Toolbar.stories.tsx +1 -1
- package/src/Tooltip.stories.tsx +1 -1
- package/src/TopBar.stories.tsx +1 -1
- package/src/UnreadDot.stories.tsx +1 -1
- package/src/eslint/has-a-page-and-a-story.test.ts +5 -0
- package/src/eslint/has-a-page-and-a-story.ts +11 -2
- package/src/eslint/no-restyled-part.test.ts +32 -8
- package/src/eslint/no-restyled-part.ts +50 -23
- package/src/gates/gate-config.ts +5 -2
- package/src/gates/gates.test.ts +20 -2
- package/src/gates/hook.ts +4 -3
- package/src/index.ts +2 -1
- package/src/linked.examples.ts +3 -4
- package/src/linked.ts +11 -1
- package/src/linkedFrom.test.tsx +55 -3
- package/src/linkedFrom.ts +47 -2
- package/src/links.ts +3 -2
- package/src/looks.ts +29 -0
- package/src/registry/build.ts +1 -1
- package/src/registry/contract.test.ts +1 -1
- package/src/registry/find.ts +1 -1
- package/src/registry/registry.test.ts +12 -12
- package/src/suggestionPopup.tsx +1 -1
- package/stories/Choosing.mdx +2 -2
- package/stories/DesignTokens.mdx +1 -1
- package/stories/GettingStarted.mdx +2 -2
- package/stories/Introduction.mdx +23 -4
- package/stories/TokensPage.tsx +12 -7
- package/dist/CardUnder.d.ts +0 -31
- package/dist/CardUnder.d.ts.map +0 -1
- package/dist/registry/chunk-P55P2QFD.js.map +0 -7
- package/src/CardUnder.mdx +0 -54
- package/src/CardUnder.tsx +0 -49
- /package/dist/registry/{app-X2GI4WTU.js.map → app-IGBRDD4L.js.map} +0 -0
- /package/dist/registry/{build-P6X3PTZP.js.map → build-MWN4UI23.js.map} +0 -0
- /package/dist/registry/{chunk-V67F474L.js.map → chunk-NSHK76XT.js.map} +0 -0
package/src/LinkCard.tsx
CHANGED
|
@@ -1,60 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A link's card: what a row cannot hold.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* A link's card: what a row cannot hold. Look C (Katerina, 29 Oct): it starts
|
|
3
|
+
* as its row does, its kind in a file's 36px tile with the title and one line
|
|
4
|
+
* under it (its key and its kind's word), and on the title's line, at the right,
|
|
5
|
+
* its ring, its conversation count and its faces, in that order, as a row's;
|
|
6
|
+
* then its summary, the items inside it in a box of their own, the newest thing said
|
|
7
|
+
* in it as a quote, and a footer: the pickers, or who and when. Words a person wrote draw as themselves: their face, their name
|
|
8
|
+
* and the time beside it, then the words.
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* not
|
|
10
|
+
* At most 480px wide, in a message, a document and a box being written in alike
|
|
11
|
+
* (Katerina, 30 Oct: a card across a wide box did not look good); in a box it
|
|
12
|
+
* sits on the files' fill, its values as words until it is sent. While it
|
|
13
|
+
* loads it holds the card's own shape, so what is around it does not jump; not
|
|
14
|
+
* available is one row.
|
|
10
15
|
*/
|
|
16
|
+
import { useContext } from 'react'
|
|
11
17
|
import { Avatar } from './Avatar'
|
|
12
18
|
import { AvatarGroup } from './AvatarGroup'
|
|
13
19
|
import { Card } from './Card'
|
|
20
|
+
import { cn } from './cn'
|
|
14
21
|
import { Link } from './Link'
|
|
15
|
-
import type
|
|
16
|
-
import { CommentCount, LinkedIcon, LinkKey, LinkPickers, ProgressRing, StatusMark } from './LinkParts'
|
|
17
|
-
import { LinkUnavailable } from './LinkRow'
|
|
22
|
+
import { inTheBox, type Linked, type LinkedKind, type LinkState, type LoadingShape } from './linked'
|
|
23
|
+
import { CommentCount, LinkedIcon, LinkKey, LinkPickers, LinkTile, ProgressRing, StatusMark } from './LinkParts'
|
|
24
|
+
import { linkMetaOf, LinkUnavailable } from './LinkRow'
|
|
25
|
+
import { QUOTE_BAR_CLASSES, TIME_CLASSES, TYPE_TILE_CLASSES } from './looks'
|
|
18
26
|
import { SkeletonBar } from './Skeleton'
|
|
19
27
|
|
|
20
28
|
export interface LinkCardProps {
|
|
21
29
|
link: LinkState
|
|
22
|
-
/** The values read as words, never pickers: the hover preview. */
|
|
30
|
+
/** The values read as words, never pickers: the hover preview. In a box being written in (`inTheBox`) they always are. */
|
|
23
31
|
readOnly?: boolean
|
|
24
32
|
/** No frame of its own: inside a box that draws one, as the hover preview's. */
|
|
25
33
|
bare?: boolean
|
|
26
34
|
}
|
|
27
35
|
|
|
36
|
+
/** A card's frame: 12px round it, 12px between what it holds. */
|
|
37
|
+
const CARD_CLASSES = 'flex flex-col gap-3 p-3'
|
|
38
|
+
|
|
28
39
|
export function LinkCard({ link, readOnly = false, bare = false }: LinkCardProps) {
|
|
40
|
+
// In a box being written in: the files' fill, and the values as words until it is sent.
|
|
41
|
+
const boxed = useContext(inTheBox)
|
|
29
42
|
if (link.state === 'loading') return <LinkCardLoading kind={link.kind} shape={link.shape} />
|
|
30
|
-
if (link.state === 'unavailable') return <LinkUnavailable kind={link.kind} noun={link.noun} openIn={link.openIn} />
|
|
43
|
+
if (link.state === 'unavailable') return <LinkUnavailable kind={link.kind} noun={link.noun} openIn={link.openIn} card />
|
|
31
44
|
const { linked } = link
|
|
32
|
-
const body = linked.kind === 'message' && linked.author ? <SaidBody linked={linked} /> : <CardBody linked={linked} readOnly={readOnly} />
|
|
33
|
-
if (bare) return <div className=
|
|
45
|
+
const body = linked.kind === 'message' && linked.author ? <SaidBody linked={linked} /> : <CardBody linked={linked} readOnly={readOnly || boxed} />
|
|
46
|
+
if (bare) return <div className={CARD_CLASSES}>{body}</div>
|
|
34
47
|
return (
|
|
35
|
-
<Card fill=
|
|
48
|
+
<Card fill={boxed ? 'elevated' : 'inset'} className={cn(CARD_CLASSES, 'max-w-[480px]')}>
|
|
36
49
|
{body}
|
|
37
50
|
</Card>
|
|
38
51
|
)
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
function CardBody({ linked, readOnly }: { linked: Linked; readOnly: boolean }) {
|
|
55
|
+
const boxed = useContext(inTheBox)
|
|
56
|
+
const on = boxed ? 'elevated' : 'inset'
|
|
57
|
+
const meta = linkMetaOf(linked)
|
|
58
|
+
// Only when there is something to put there: a topic with a summary alone drew an empty row, 36px of nothing (Katerina, 30 Oct).
|
|
59
|
+
const footed = Boolean(linked.status || linked.owner || linked.authors || linked.updated)
|
|
42
60
|
return (
|
|
43
61
|
<>
|
|
44
|
-
<div className="flex
|
|
45
|
-
{
|
|
46
|
-
<span className="flex min-w-0 flex-1
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
62
|
+
<div className="flex items-center gap-3">
|
|
63
|
+
<LinkTile kind={linked.kind} />
|
|
64
|
+
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
65
|
+
<span className="block min-w-0 text-body-2-strong text-text-primary">
|
|
66
|
+
{/* One line, cut short: a long title truncates rather than wrapping (Katerina, 29 Oct). */}
|
|
67
|
+
<Link href={linked.href} variant="quiet" truncate className="block">
|
|
68
|
+
{linked.title}
|
|
69
|
+
</Link>
|
|
70
|
+
</span>
|
|
71
|
+
{meta && <span className="truncate text-caption text-text-secondary">{meta}</span>}
|
|
51
72
|
</span>
|
|
52
|
-
{linked.done
|
|
53
|
-
|
|
73
|
+
{(linked.done || linked.conversation || linked.members) && (
|
|
74
|
+
// On the title's line, not halfway down the header: the ring, the count, the faces, as a row's (Katerina, 30 Oct).
|
|
75
|
+
<span className="flex h-[19.6px] shrink-0 items-center gap-2 self-start">
|
|
76
|
+
{linked.done && <ProgressRing done={linked.done.done} total={linked.done.total} />}
|
|
77
|
+
{linked.conversation && <CommentCount conversation={linked.conversation} noun={linked.conversation.noun} />}
|
|
78
|
+
{linked.members && <AvatarGroup members={linked.members} size={16} on={on} />}
|
|
79
|
+
</span>
|
|
80
|
+
)}
|
|
54
81
|
</div>
|
|
55
|
-
{(linked.key || linked.subtitle) && <p className="-mt-1 pl-6 text-caption text-text-secondary">{[linked.key, linked.subtitle].filter(Boolean).join(' · ')}</p>}
|
|
56
82
|
{linked.summary && <p className="line-clamp-2 text-body-2 text-text-secondary">{linked.summary}</p>}
|
|
57
83
|
{linked.children && linked.children.length > 0 && (
|
|
84
|
+
// In a box of their own, a hairline between them, as the card first drew them (Katerina, 29 Oct: "add back the borders").
|
|
58
85
|
<div className="flex flex-col divide-y divide-border-subtle rounded-md border border-border-subtle leaf:divide-border-strong leaf:border-border-strong">
|
|
59
86
|
{linked.children.map((child) => (
|
|
60
87
|
<div key={child.id} className="relative flex h-8 items-center gap-2 px-2 hover:bg-bg-active">
|
|
@@ -73,57 +100,59 @@ function CardBody({ linked, readOnly }: { linked: Linked; readOnly: boolean }) {
|
|
|
73
100
|
</div>
|
|
74
101
|
)}
|
|
75
102
|
{linked.latest && (
|
|
76
|
-
|
|
103
|
+
// 12px between the words "Latest conversation" and the quote they name (Katerina, 29 Oct).
|
|
104
|
+
<div className="flex flex-col gap-3">
|
|
77
105
|
{/* "Latest" in words: the card follows it, so this is not necessarily what the link was sent about. */}
|
|
78
106
|
<span className="text-caption text-text-muted">Latest conversation</span>
|
|
79
|
-
<div className=
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<p className="line-clamp-2 text-body-2 text-text-secondary">{linked.latest.body}</p>
|
|
87
|
-
</div>
|
|
107
|
+
<div className={cn('flex flex-col gap-1', QUOTE_BAR_CLASSES)}>
|
|
108
|
+
<span className="flex items-center gap-2 text-caption">
|
|
109
|
+
<Avatar name={linked.latest.author.name} src={linked.latest.author.picture} size={16} />
|
|
110
|
+
<span className="text-text-primary">{linked.latest.author.name}</span>
|
|
111
|
+
<span className={cn('text-text-muted', TIME_CLASSES)}>{linked.latest.at}</span>
|
|
112
|
+
</span>
|
|
113
|
+
<p className="line-clamp-2 text-body-2 text-text-secondary">{linked.latest.body}</p>
|
|
88
114
|
</div>
|
|
89
115
|
</div>
|
|
90
116
|
)}
|
|
91
|
-
|
|
117
|
+
{footed && (
|
|
118
|
+
<div className="flex min-h-6 items-center gap-2">
|
|
92
119
|
{(linked.status || linked.owner) && <LinkPickers status={linked.status} owner={linked.owner} ownerLabel={linked.ownerLabel} readOnly={readOnly} />}
|
|
93
120
|
{/* Faces only: names would not fit once several people wrote it. */}
|
|
94
121
|
{linked.authors ? (
|
|
95
122
|
<span className="flex min-w-0 items-center gap-2 text-caption text-text-secondary">
|
|
96
|
-
<AvatarGroup members={linked.authors} size={16} />
|
|
97
|
-
{
|
|
123
|
+
<AvatarGroup members={linked.authors} size={16} on={on} />
|
|
124
|
+
{/* Italic, as every "Updated …" on a card is (Katerina, 30 Oct). */}
|
|
125
|
+
{linked.updated && <span className="shrink-0 italic">Updated {linked.updated}</span>}
|
|
98
126
|
</span>
|
|
99
127
|
) : (
|
|
100
|
-
!linked.status && !linked.owner && linked.updated && <span className="text-caption text-text-secondary">Updated {linked.updated}</span>
|
|
101
|
-
)}
|
|
102
|
-
{linked.conversation && (
|
|
103
|
-
<span className="ml-auto flex">
|
|
104
|
-
<CommentCount conversation={linked.conversation} noun={linked.conversation.noun} />
|
|
105
|
-
</span>
|
|
128
|
+
!linked.status && !linked.owner && linked.updated && <span className="text-caption italic text-text-secondary">Updated {linked.updated}</span>
|
|
106
129
|
)}
|
|
107
130
|
</div>
|
|
131
|
+
)}
|
|
108
132
|
</>
|
|
109
133
|
)
|
|
110
134
|
}
|
|
111
135
|
|
|
112
|
-
/** Words a person wrote, linked: their face, their name, the time as the link, and the words. */
|
|
136
|
+
/** Words a person wrote, linked: their face, their name, the time beside it as the link (without a time, the name), and the words. */
|
|
113
137
|
function SaidBody({ linked }: { linked: Linked }) {
|
|
114
138
|
const author = linked.author!
|
|
115
139
|
return (
|
|
116
140
|
<>
|
|
117
141
|
<div className="flex items-center gap-2">
|
|
118
142
|
<Avatar name={author.name} src={author.picture} size={24} />
|
|
119
|
-
|
|
120
|
-
<span className="text-
|
|
121
|
-
<Link href={linked.href} variant="quiet">
|
|
122
|
-
{linked.updated ?? 'Open'}
|
|
123
|
-
</Link>
|
|
143
|
+
{/* No "Open" in a missing time's place (Katerina, 30 Oct): the name is the link then. */}
|
|
144
|
+
<span className="text-body-2-strong text-text-primary">
|
|
145
|
+
{linked.updated ? author.name : <Link href={linked.href} variant="quiet">{author.name}</Link>}
|
|
124
146
|
</span>
|
|
147
|
+
{linked.updated && (
|
|
148
|
+
<span className={cn('text-caption text-text-muted', TIME_CLASSES)}>
|
|
149
|
+
<Link href={linked.href} variant="quiet">
|
|
150
|
+
{linked.updated}
|
|
151
|
+
</Link>
|
|
152
|
+
</span>
|
|
153
|
+
)}
|
|
125
154
|
</div>
|
|
126
|
-
<p className="line-clamp-4 text-body-2 text-text-
|
|
155
|
+
<p className="line-clamp-4 text-body-2 text-text-secondary">{linked.body ?? linked.title}</p>
|
|
127
156
|
</>
|
|
128
157
|
)
|
|
129
158
|
}
|
|
@@ -131,8 +160,8 @@ function SaidBody({ linked }: { linked: Linked }) {
|
|
|
131
160
|
/** Each kind's usual card, for a placeholder when the app remembers nothing of it. */
|
|
132
161
|
const KIND_SHAPE: Record<LinkedKind, LoadingShape> = {
|
|
133
162
|
issue: { subtitle: true, summary: true, footer: 'pickers' },
|
|
134
|
-
project: { subtitle:
|
|
135
|
-
topic: { summary: true, latest: true, footer: 'line' },
|
|
163
|
+
project: { subtitle: true, summary: true, rows: 3, ring: true, footer: 'pickers' },
|
|
164
|
+
topic: { subtitle: true, summary: true, latest: true, footer: 'line' },
|
|
136
165
|
page: { subtitle: true, summary: true, footer: 'people' },
|
|
137
166
|
file: { summary: false, footer: 'line' },
|
|
138
167
|
message: { summary: true, footer: 'none' },
|
|
@@ -144,22 +173,23 @@ export interface LinkCardLoadingProps {
|
|
|
144
173
|
shape?: LoadingShape
|
|
145
174
|
}
|
|
146
175
|
|
|
147
|
-
/** The card it will become, drawn in bars
|
|
176
|
+
/** The card it will become, drawn in bars in the card's own shape: the tile, its two lines, then what it holds. */
|
|
148
177
|
export function LinkCardLoading({ kind, shape }: LinkCardLoadingProps) {
|
|
149
178
|
const { subtitle = false, summary = true, rows = 0, latest = false, ring = false, footer = 'line' } = shape ?? KIND_SHAPE[kind]
|
|
179
|
+
const boxed = useContext(inTheBox)
|
|
150
180
|
return (
|
|
151
181
|
<div className="animate-skeleton-in" aria-busy>
|
|
152
|
-
<Card fill=
|
|
153
|
-
<div className="flex
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
182
|
+
<Card fill={boxed ? 'elevated' : 'inset'} aria-hidden className={cn(CARD_CLASSES, 'max-w-[480px]')}>
|
|
183
|
+
<div className="flex items-center gap-3">
|
|
184
|
+
<span className={TYPE_TILE_CLASSES}>
|
|
185
|
+
<LinkedIcon kind={kind} />
|
|
186
|
+
</span>
|
|
187
|
+
<span className="flex min-w-0 flex-1 flex-col gap-1.5">
|
|
188
|
+
<SkeletonBar on="inset" className="h-3.5 w-1/2" />
|
|
189
|
+
{subtitle && <SkeletonBar on="inset" className="h-2.5 w-20" />}
|
|
190
|
+
</span>
|
|
191
|
+
{ring && <SkeletonBar on="inset" shape="round" className="size-4 self-start" />}
|
|
157
192
|
</div>
|
|
158
|
-
{subtitle && (
|
|
159
|
-
<div className="-mt-1 flex h-[14.4px] items-center pl-6">
|
|
160
|
-
<SkeletonBar on="inset" className="h-2.5 w-20" />
|
|
161
|
-
</div>
|
|
162
|
-
)}
|
|
163
193
|
{summary && (
|
|
164
194
|
<div className="flex h-[19.6px] items-center">
|
|
165
195
|
<SkeletonBar on="inset" className="h-3 w-4/5" />
|
|
@@ -175,11 +205,11 @@ export function LinkCardLoading({ kind, shape }: LinkCardLoadingProps) {
|
|
|
175
205
|
</div>
|
|
176
206
|
)}
|
|
177
207
|
{latest && (
|
|
178
|
-
<div className="flex flex-col gap-
|
|
208
|
+
<div className="flex flex-col gap-3">
|
|
179
209
|
<div className="flex h-[14.4px] items-center">
|
|
180
210
|
<SkeletonBar on="inset" className="h-2.5 w-28" />
|
|
181
211
|
</div>
|
|
182
|
-
<div className=
|
|
212
|
+
<div className={cn('flex h-[57.6px] flex-col justify-center gap-2', QUOTE_BAR_CLASSES)}>
|
|
183
213
|
<SkeletonBar on="inset" className="h-2.5 w-24" />
|
|
184
214
|
<SkeletonBar on="inset" className="h-3 w-full" />
|
|
185
215
|
<SkeletonBar on="inset" className="h-3 w-3/5" />
|
|
@@ -187,7 +217,7 @@ export function LinkCardLoading({ kind, shape }: LinkCardLoadingProps) {
|
|
|
187
217
|
</div>
|
|
188
218
|
)}
|
|
189
219
|
{footer !== 'none' && (
|
|
190
|
-
<div className="flex min-h-6 items-center gap-2
|
|
220
|
+
<div className="flex min-h-6 items-center gap-2">
|
|
191
221
|
{footer === 'pickers' ? (
|
|
192
222
|
<>
|
|
193
223
|
<SkeletonBar on="inset" shape="control" className="h-6 w-24" />
|
package/src/LinkChip.mdx
CHANGED
|
@@ -5,7 +5,7 @@ import * as LinkChipStories from './LinkChip.stories'
|
|
|
5
5
|
|
|
6
6
|
# LinkChip
|
|
7
7
|
|
|
8
|
-
A link in a sentence: its icon, its key, its title cut short, and its status as a shape.
|
|
8
|
+
A link in a sentence: its icon, its key, its title cut short, and its status as a shape. Up to 40 characters, never wider than its line.
|
|
9
9
|
|
|
10
10
|
<Canvas of={LinkChipStories.InASentence} />
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ A link in a sentence: its icon, its key, its title cut short, and its status as
|
|
|
13
13
|
|
|
14
14
|
- **ready** — a link the app has looked up. Hovering it shows its card (**LinkPreview**); a tap or a click opens it.
|
|
15
15
|
- **loading** — still being looked up: the icon, which the address already says, and a bar.
|
|
16
|
-
- **unavailable** — deleted, or not the reader's to see. Both say "
|
|
16
|
+
- **unavailable** — deleted, or not the reader's to see. Both say "Issue not available" in the app's word for it.
|
|
17
17
|
- `preview={false}` — no card on hover, where a card would cover what the reader is choosing from.
|
|
18
18
|
|
|
19
19
|
<Canvas of={LinkChipStories.EachKind} />
|
|
@@ -21,7 +21,7 @@ A link in a sentence: its icon, its key, its title cut short, and its status as
|
|
|
21
21
|
## When not
|
|
22
22
|
|
|
23
23
|
- A link alone on its line → **LinkRow**.
|
|
24
|
-
- The one card
|
|
24
|
+
- The one card attached to a piece of text → **AttachedCard**.
|
|
25
25
|
- A person, a place or a label with no lookup behind it → **InlineChip**.
|
|
26
26
|
|
|
27
27
|
## How
|
package/src/LinkChip.stories.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { LinkChip } from './LinkChip'
|
|
|
3
3
|
import { GROUP, ITEM, LOADING, PAGE, PLACE, ready, SAID, UNAVAILABLE } from './linked.examples'
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Links & references/LinkChip',
|
|
7
7
|
component: LinkChip,
|
|
8
8
|
parameters: { layout: 'padded' },
|
|
9
9
|
args: { link: ready(ITEM) },
|
package/src/LinkChip.test.tsx
CHANGED
|
@@ -59,7 +59,7 @@ describe('LinkChip', () => {
|
|
|
59
59
|
|
|
60
60
|
it('says “not available” in words, and leads nowhere', () => {
|
|
61
61
|
render(<LinkChip link={UNAVAILABLE} />)
|
|
62
|
-
expect(screen.getByText('
|
|
62
|
+
expect(screen.getByText('Issue not available')).toBeTruthy()
|
|
63
63
|
expect(screen.queryByRole('link')).toBeNull()
|
|
64
64
|
})
|
|
65
65
|
|
package/src/LinkChip.tsx
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* wrote), the key, the title cut short, the status as its shape. Loading
|
|
4
4
|
* keeps the icon, since the kind is known from the address; not available says
|
|
5
5
|
* so in words. Hovering it shows its card; a tap opens it.
|
|
6
|
+
*
|
|
7
|
+
* Look C (Katerina, 29 Oct): the key a step lighter than LinkKey's muted grey
|
|
8
|
+
* and 8px from the title; room for 40 characters of title, never more than its
|
|
9
|
+
* line, so in a narrow box it truncates instead of running past the edge.
|
|
6
10
|
*/
|
|
7
11
|
import { Avatar } from './Avatar'
|
|
8
12
|
import { InlineChip } from './InlineChip'
|
|
@@ -29,7 +33,7 @@ export function LinkChip({ link, preview = true }: LinkChipProps) {
|
|
|
29
33
|
if (link.state === 'unavailable') {
|
|
30
34
|
return (
|
|
31
35
|
<InlineChip tone="muted" icon={<LinkedIcon kind={link.kind} size={14} tone="inherit" />}>
|
|
32
|
-
{link.noun}
|
|
36
|
+
{link.noun} not available
|
|
33
37
|
</InlineChip>
|
|
34
38
|
)
|
|
35
39
|
}
|
|
@@ -38,11 +42,20 @@ export function LinkChip({ link, preview = true }: LinkChipProps) {
|
|
|
38
42
|
const said = linked.kind === 'message' && linked.author
|
|
39
43
|
const chip = (
|
|
40
44
|
<InlineChip
|
|
41
|
-
icon={said ? <Avatar name={said.name} src={said.picture} size={
|
|
45
|
+
icon={said ? <Avatar name={said.name} src={said.picture} size={14} /> : <LinkedIcon kind={linked.kind} size={14} tone="inherit" />}
|
|
42
46
|
href={linked.href}
|
|
43
|
-
|
|
47
|
+
// Never wider than its line. With its hover card, the card's wrapper holds it to the line (max-w-full): a share of the
|
|
48
|
+
// line on the chip itself made the wrapper as wide as the whole title, and left a gap after the cut-short chip
|
|
49
|
+
// (Katerina, 29 Oct). Without one, it holds itself, less its own 2px each side.
|
|
50
|
+
// min-w-0: inside the wrapper it may shrink below its whole title, which then truncates.
|
|
51
|
+
className={preview ? 'min-w-0 max-w-[40ch]' : 'max-w-[min(40ch,calc(100%_-_4px))]'}
|
|
44
52
|
>
|
|
45
|
-
{linked.key &&
|
|
53
|
+
{linked.key && (
|
|
54
|
+
// 4px more than the chip's gap after it, and kept whole: "ABC-2" never breaks at its hyphen.
|
|
55
|
+
<span className="mr-1 shrink-0 whitespace-nowrap">
|
|
56
|
+
<LinkKey tone="secondary">{linked.key}</LinkKey>
|
|
57
|
+
</span>
|
|
58
|
+
)}
|
|
46
59
|
<span className="truncate">{said ? `${said.name}: ${linked.body ?? linked.title}` : linked.title}</span>
|
|
47
60
|
{status?.colour && <StatusMark status={{ label: status.label, colour: status.colour }} />}
|
|
48
61
|
</InlineChip>
|
|
@@ -4,7 +4,7 @@ import { PEOPLE, STATUS_OPTIONS } from './linked.examples'
|
|
|
4
4
|
import { CommentCount, LinkPickers, ProgressRing, StatusMark } from './LinkParts'
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Links & references/LinkParts',
|
|
8
8
|
component: LinkPickers,
|
|
9
9
|
parameters: { layout: 'padded' },
|
|
10
10
|
} satisfies Meta<typeof LinkPickers>
|
package/src/LinkParts.tsx
CHANGED
|
@@ -9,7 +9,8 @@ import { Avatar } from './Avatar'
|
|
|
9
9
|
import { cn } from './cn'
|
|
10
10
|
import { KindIcon } from './KindIcon'
|
|
11
11
|
import { Link } from './Link'
|
|
12
|
-
import { chosenOf, type LinkedConversation, type LinkedKind, type LinkedPicker, type LinkedStatus, type StatusColour } from './linked'
|
|
12
|
+
import { chosenOf, type Linked, type LinkedConversation, type LinkedKind, type LinkedPicker, type LinkedStatus, type StatusColour } from './linked'
|
|
13
|
+
import { TYPE_TILE_CLASSES } from './looks'
|
|
13
14
|
import { Select } from './Select'
|
|
14
15
|
import { WithTooltip } from './Tooltip'
|
|
15
16
|
import { UnreadDot } from './UnreadDot'
|
|
@@ -43,9 +44,30 @@ export function LinkedIcon({ kind, size = 16, tone = 'secondary' }: { kind: Link
|
|
|
43
44
|
return <KindIcon kind={kind} size={size} tone={tone} />
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* A key, the way people say it ("ABC-2"): before the title, quieter than it. `secondary` is a step brighter, for a chip
|
|
49
|
+
* in a sentence, where the muted grey on the chip's fill was hard to read (Katerina, 29 Oct).
|
|
50
|
+
*/
|
|
51
|
+
export function LinkKey({ children, tone = 'muted' }: { children: string; tone?: 'muted' | 'secondary' }) {
|
|
52
|
+
return <span className={cn('shrink-0 text-caption tabular-nums', tone === 'secondary' ? 'text-text-secondary' : 'text-text-muted')}>{children}</span>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The kinds the apps have, in the words they use for them (Katerina, 29 Oct: "topic, project, issue, page or document"). */
|
|
56
|
+
const KIND_NOUN: Partial<Record<LinkedKind, string>> = { issue: 'Issue', project: 'Project', topic: 'Topic', page: 'Document' }
|
|
57
|
+
|
|
58
|
+
/** What it is, in a word: the app's own word, else its kind's. Another app's file, or words a person wrote, have none. */
|
|
59
|
+
export function kindNounOf(linked: Pick<Linked, 'kind' | 'noun'>): string | undefined {
|
|
60
|
+
return linked.noun ?? KIND_NOUN[linked.kind]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The 36px tile a link's kind sits in, as a file's type does in AttachmentCard; words a person wrote show their face. */
|
|
64
|
+
export function LinkTile({ kind, author }: { kind: LinkedKind; author?: { name: string; picture?: string } }) {
|
|
65
|
+
if (author) return <Avatar name={author.name} src={author.picture} size={36} />
|
|
66
|
+
return (
|
|
67
|
+
<span className={TYPE_TILE_CLASSES}>
|
|
68
|
+
<LinkedIcon kind={kind} />
|
|
69
|
+
</span>
|
|
70
|
+
)
|
|
49
71
|
}
|
|
50
72
|
|
|
51
73
|
/** Progress as a small ring, with the count beside it. */
|
|
@@ -57,7 +79,9 @@ export function ProgressRing({ done, total }: { done: number; total: number }) {
|
|
|
57
79
|
const share = total > 0 ? Math.min(done, total) / total : 0
|
|
58
80
|
return (
|
|
59
81
|
<WithTooltip label={`${done} of ${total} done`} inline wrapperClassName="inline-flex shrink-0">
|
|
60
|
-
|
|
82
|
+
{/* 6px between the ring and its count (Katerina, 29 Oct: 4px read as one mark). */}
|
|
83
|
+
{/* The count in the small size: a mark beside the ring, not words (Katerina, 29 Oct). */}
|
|
84
|
+
<span className="inline-flex shrink-0 items-center gap-1.5 text-small tabular-nums text-text-secondary">
|
|
61
85
|
<svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} className="shrink-0 -rotate-90" aria-hidden>
|
|
62
86
|
<circle cx={size / 2} cy={size / 2} r={r} fill="none" strokeWidth={stroke} className="stroke-border-default" />
|
|
63
87
|
<circle cx={size / 2} cy={size / 2} r={r} fill="none" strokeWidth={stroke} strokeLinecap="round" strokeDasharray={`${c * share} ${c}`} className="stroke-success-default" />
|
|
@@ -77,8 +101,15 @@ export function ProgressRing({ done, total }: { done: number; total: number }) {
|
|
|
77
101
|
export function CommentCount({ conversation, noun = 'comments' }: { conversation: LinkedConversation; noun?: string }) {
|
|
78
102
|
const { count, href, unread = false } = conversation
|
|
79
103
|
return (
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
/*
|
|
105
|
+
* A small button's shape, as Button's small one is: 24px tall like the pickers beside it, 6px each side, its corners
|
|
106
|
+
* and its hover. It was 15px tall, 1px above and below its icon and 4px at the sides, and read as squashed
|
|
107
|
+
* (Katerina, 29 Oct). The link fills the box, so all of it opens the conversation. The box keeps its own room:
|
|
108
|
+
* its 6px and the row's gap part it from the faces and the ring beside it (14px to its icon). The count is in
|
|
109
|
+
* the small size (10px).
|
|
110
|
+
*/
|
|
111
|
+
<span className={cn('relative z-10 inline-flex h-6 shrink-0 rounded-md text-small tabular-nums transition-colors hover:bg-bg-hover', unread ? 'font-medium text-text-primary' : 'text-text-secondary')}>
|
|
112
|
+
<Link href={href} variant="plain" className="flex h-full items-center gap-1 px-1.5">
|
|
82
113
|
<IconMessage2 size={14} stroke={1.5} aria-hidden />
|
|
83
114
|
{count}
|
|
84
115
|
<span className="sr-only">{unread ? `${noun}, unread — open the conversation` : `${noun} — open the conversation`}</span>
|
|
@@ -108,7 +139,8 @@ export function LinkPickers({ status, owner, ownerLabel = 'Owner', readOnly = fa
|
|
|
108
139
|
const statusWords = status && (readOnly || !status.onChange)
|
|
109
140
|
const ownerWords = owner && (readOnly || !owner.onChange)
|
|
110
141
|
return (
|
|
111
|
-
|
|
142
|
+
// As words, 16px apart, so the status and the person read as two things; as boxed pickers their borders already part them (Katerina, 29 Oct).
|
|
143
|
+
<span className={cn('flex h-6 min-w-0 items-center text-caption text-text-secondary', statusWords || ownerWords ? 'gap-4' : 'gap-2')}>
|
|
112
144
|
{status &&
|
|
113
145
|
(statusWords ? (
|
|
114
146
|
<span className="inline-flex shrink-0 items-center gap-1">
|
|
@@ -14,7 +14,7 @@ import { richTextClassName } from './RichText'
|
|
|
14
14
|
* ones are the app's, which knows how to resolve what the link points at.
|
|
15
15
|
*/
|
|
16
16
|
const meta = {
|
|
17
|
-
title: '
|
|
17
|
+
title: 'Writing/LinkPlaces',
|
|
18
18
|
parameters: { layout: 'padded' },
|
|
19
19
|
} satisfies Meta
|
|
20
20
|
|
package/src/LinkPreview.mdx
CHANGED
|
@@ -19,7 +19,7 @@ A link's card on hover over its chip or its row, read only, in the package's one
|
|
|
19
19
|
|
|
20
20
|
## When not
|
|
21
21
|
|
|
22
|
-
- A card that stays → **LinkCard**, or **
|
|
22
|
+
- A card that stays → **LinkCard**, or **AttachedCard** attached to a piece of text.
|
|
23
23
|
- A preview of something that is not a link → **PreviewCard**.
|
|
24
24
|
|
|
25
25
|
## How
|
|
@@ -5,7 +5,7 @@ import { LinkPreview, LinkPreviewOpen } from './LinkPreview'
|
|
|
5
5
|
import { LinkRow } from './LinkRow'
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: '
|
|
8
|
+
title: 'Links & references/LinkPreview',
|
|
9
9
|
component: LinkPreview,
|
|
10
10
|
parameters: { layout: 'padded' },
|
|
11
11
|
args: { linked: ITEM, children: null },
|
package/src/LinkPreview.tsx
CHANGED
|
@@ -38,8 +38,10 @@ export function LinkPreview({ linked, block = false, children }: LinkPreviewProp
|
|
|
38
38
|
const canHover = useCanHover()
|
|
39
39
|
if (!canHover) return <>{children}</>
|
|
40
40
|
// A row fills its column; PreviewCard's own trigger is inline and would shrink it to its words.
|
|
41
|
+
// Above the link by default, as a hover card over text sits (Katerina, 29 Oct); PreviewCard flips it below when there is no room.
|
|
42
|
+
// contentClassName p-0: the card brings its own 12px, as every card has; PreviewCard's 12px on top of it made 24 (Katerina, 29 Oct).
|
|
41
43
|
return (
|
|
42
|
-
<PreviewCard side="
|
|
44
|
+
<PreviewCard side="top" contentClassName="p-0" content={<LinkCard link={{ state: 'ready', linked }} bare readOnly />} wrapperClassName={block ? 'grid w-full min-w-0 grid-cols-[minmax(0,1fr)]' : 'max-w-full'}>
|
|
43
45
|
{children}
|
|
44
46
|
</PreviewCard>
|
|
45
47
|
)
|
package/src/LinkRow.mdx
CHANGED
|
@@ -5,23 +5,25 @@ import * as LinkRowStories from './LinkRow.stories'
|
|
|
5
5
|
|
|
6
6
|
# LinkRow
|
|
7
7
|
|
|
8
|
-
A link alone on its line:
|
|
8
|
+
A link alone on its line: its kind in a file's tile, the title and its key under it, and on the title's line its state, comments and faces.
|
|
9
9
|
|
|
10
10
|
<Canvas of={LinkRowStories.EachKind} />
|
|
11
11
|
|
|
12
12
|
## When
|
|
13
13
|
|
|
14
|
-
- **ready** —
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
14
|
+
- **ready** — its kind in the 36px tile a file's type has (**AttachmentCard**), the title as the link, and under it the key and what it is ("ABC-2 · Issue"), in the app's word for it, else its kind's. On the title's line: its status or its ring, its comment count, then the owner, members or authors at the far right. Hovering it shows its card; a tap opens it.
|
|
15
|
+
- **words a person wrote** — their face in the tile, their name with the time beside it, and the words under them.
|
|
16
|
+
- **width** — at most 480px, in a box being written in too.
|
|
17
|
+
- **unread** — the count is brighter, with its dot.
|
|
18
|
+
- **loading** — the row in bars, in the row's own shape.
|
|
19
|
+
- **unavailable** — a row's shape, "Issue not available", with where it may still open (`openIn`). This is also what a card draws when it is not available: **LinkUnavailable**, from this file.
|
|
18
20
|
|
|
19
21
|
<Canvas of={LinkRowStories.NotAvailable} />
|
|
20
22
|
|
|
21
23
|
## When not
|
|
22
24
|
|
|
23
25
|
- A link in a sentence → **LinkChip**.
|
|
24
|
-
- The one card
|
|
26
|
+
- The one card attached to a piece of text → **AttachedCard**.
|
|
25
27
|
|
|
26
28
|
## How
|
|
27
29
|
|
package/src/LinkRow.stories.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { GROUP, ITEM, ITEM_UNREAD, LOADING, PAGE, PLACE, ready, SAID, UNAVAILABL
|
|
|
3
3
|
import { LinkRow, LinkUnavailable } from './LinkRow'
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Links & references/LinkRow',
|
|
7
7
|
component: LinkRow,
|
|
8
8
|
parameters: { layout: 'padded' },
|
|
9
9
|
args: { link: ready(ITEM) },
|
|
@@ -42,8 +42,8 @@ export const NotAvailable: Story = { args: { link: UNAVAILABLE } }
|
|
|
42
42
|
export const NotAvailableLine: Story = {
|
|
43
43
|
render: () => (
|
|
44
44
|
<div className="flex flex-col gap-2">
|
|
45
|
-
<LinkUnavailable kind="issue" noun="
|
|
46
|
-
<LinkUnavailable kind="page" noun="
|
|
45
|
+
<LinkUnavailable kind="issue" noun="Issue" openIn={{ app: 'App one', href: '#elsewhere' }} />
|
|
46
|
+
<LinkUnavailable kind="page" noun="Document" />
|
|
47
47
|
</div>
|
|
48
48
|
),
|
|
49
49
|
}
|
package/src/LinkRow.test.tsx
CHANGED
|
@@ -13,9 +13,9 @@ describe('LinkRow', () => {
|
|
|
13
13
|
expect(screen.getByRole('link', { name: ITEM.title }).getAttribute('href')).toBe('#item')
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
it('
|
|
16
|
+
it('shows its comment count on every row, and says when something in it is unread', () => {
|
|
17
17
|
const { rerender } = render(<LinkRow link={ready(ITEM)} preview={false} />)
|
|
18
|
-
expect(screen.
|
|
18
|
+
expect(screen.getByRole('link', { name: /comments — open the conversation/ }).getAttribute('href')).toBe('#item-conversation')
|
|
19
19
|
rerender(<LinkRow link={ready(ITEM_UNREAD)} preview={false} />)
|
|
20
20
|
expect(screen.getByRole('link', { name: /unread — open the conversation/ }).getAttribute('href')).toBe('#item-conversation')
|
|
21
21
|
})
|
|
@@ -33,6 +33,6 @@ describe('LinkRow', () => {
|
|
|
33
33
|
|
|
34
34
|
it('says it is not available in one line', () => {
|
|
35
35
|
render(<LinkRow link={UNAVAILABLE} />)
|
|
36
|
-
expect(screen.getByText('
|
|
36
|
+
expect(screen.getByText('Issue not available')).toBeTruthy()
|
|
37
37
|
})
|
|
38
38
|
})
|