@estiva-app/ui 0.94.0 → 0.96.0
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/AppShell.d.ts +25 -7
- package/dist/AppShell.d.ts.map +1 -1
- package/dist/ArchivedNotice.d.ts +28 -0
- package/dist/ArchivedNotice.d.ts.map +1 -0
- package/dist/Button.d.ts +4 -3
- package/dist/Button.d.ts.map +1 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/ConversationActions.d.ts +24 -0
- package/dist/ConversationActions.d.ts.map +1 -0
- package/dist/ConversationCard.d.ts +88 -0
- package/dist/ConversationCard.d.ts.map +1 -0
- package/dist/ConversationLayout.d.ts +50 -0
- package/dist/ConversationLayout.d.ts.map +1 -0
- package/dist/ConversationMenu.d.ts +24 -0
- package/dist/ConversationMenu.d.ts.map +1 -0
- package/dist/Divider.d.ts +23 -4
- package/dist/Divider.d.ts.map +1 -1
- package/dist/EditedMarker.d.ts +11 -0
- package/dist/EditedMarker.d.ts.map +1 -0
- package/dist/IconButton.d.ts +3 -3
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/LinkParts.d.ts +3 -1
- package/dist/LinkParts.d.ts.map +1 -1
- package/dist/LinkRow.d.ts.map +1 -1
- package/dist/ListColumn.d.ts +3 -1
- package/dist/ListColumn.d.ts.map +1 -1
- package/dist/MetaText.d.ts +22 -0
- package/dist/MetaText.d.ts.map +1 -0
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/PageHeader.d.ts +50 -0
- package/dist/PageHeader.d.ts.map +1 -0
- package/dist/Panel.d.ts +6 -0
- package/dist/Panel.d.ts.map +1 -1
- package/dist/PartCard.d.ts +4 -7
- package/dist/PartCard.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +17 -0
- package/dist/PinnedComment.d.ts.map +1 -0
- package/dist/QuotedLine.d.ts +16 -0
- package/dist/QuotedLine.d.ts.map +1 -0
- package/dist/ReactionHorizon.d.ts +14 -0
- package/dist/ReactionHorizon.d.ts.map +1 -0
- package/dist/RepliesRow.d.ts +26 -0
- package/dist/RepliesRow.d.ts.map +1 -0
- package/dist/ResolveDialog.d.ts +13 -0
- package/dist/ResolveDialog.d.ts.map +1 -0
- package/dist/Select.d.ts +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/ShowMore.d.ts +1 -7
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/Skeleton.d.ts +8 -4
- package/dist/Skeleton.d.ts.map +1 -1
- package/dist/Thread.d.ts +38 -0
- package/dist/Thread.d.ts.map +1 -0
- package/dist/TopBar.d.ts +3 -2
- package/dist/TopBar.d.ts.map +1 -1
- package/dist/UrgentMark.d.ts +6 -0
- package/dist/UrgentMark.d.ts.map +1 -0
- package/dist/commentBoxFrame.d.ts +3 -1
- package/dist/commentBoxFrame.d.ts.map +1 -1
- package/dist/conversation.examples.d.ts +52 -0
- package/dist/conversation.examples.d.ts.map +1 -0
- package/dist/editor.js +32 -24
- package/dist/editor.js.map +2 -2
- package/dist/eslint/index.js +2 -1
- package/dist/eslint/index.js.map +2 -2
- package/dist/eslint/no-native-title.d.ts +1 -1
- package/dist/eslint/no-native-title.d.ts.map +1 -1
- package/dist/eslint/no-restyled-part.d.ts.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1379 -442
- package/dist/index.js.map +4 -4
- package/dist/looks.d.ts +13 -1
- package/dist/looks.d.ts.map +1 -1
- package/dist/threadCard.d.ts +46 -0
- package/dist/threadCard.d.ts.map +1 -0
- package/package.json +1 -1
- package/registry.json +1872 -557
- package/src/AppShell.mdx +24 -10
- package/src/AppShell.stories.tsx +65 -31
- package/src/AppShell.test.tsx +92 -10
- package/src/AppShell.tsx +108 -18
- package/src/ArchivedNotice.mdx +46 -0
- package/src/ArchivedNotice.stories.tsx +52 -0
- package/src/ArchivedNotice.test.tsx +42 -0
- package/src/ArchivedNotice.tsx +71 -0
- package/src/Button.mdx +2 -2
- package/src/Button.tsx +8 -6
- package/src/Card.test.tsx +4 -4
- package/src/Card.tsx +6 -2
- package/src/CommentBox.test.tsx +2 -1
- package/src/CommentBox.tsx +14 -7
- package/src/ConfirmDialog.stories.tsx +12 -0
- package/src/ConversationActions.mdx +47 -0
- package/src/ConversationActions.stories.tsx +39 -0
- package/src/ConversationActions.tsx +96 -0
- package/src/ConversationCard.mdx +72 -0
- package/src/ConversationCard.states.test.tsx +330 -0
- package/src/ConversationCard.stories.tsx +135 -0
- package/src/ConversationCard.test.tsx +159 -0
- package/src/ConversationCard.tsx +522 -0
- package/src/ConversationLayout.mdx +61 -0
- package/src/ConversationLayout.stories.tsx +161 -0
- package/src/ConversationLayout.test.tsx +240 -0
- package/src/ConversationLayout.tsx +233 -0
- package/src/ConversationMenu.mdx +47 -0
- package/src/ConversationMenu.stories.tsx +42 -0
- package/src/ConversationMenu.test.tsx +47 -0
- package/src/ConversationMenu.tsx +57 -0
- package/src/Divider.mdx +36 -1
- package/src/Divider.stories.tsx +57 -0
- package/src/Divider.test.tsx +24 -1
- package/src/Divider.tsx +49 -9
- package/src/EditedMarker.mdx +36 -0
- package/src/EditedMarker.stories.tsx +24 -0
- package/src/EditedMarker.tsx +20 -0
- package/src/IconButton.mdx +2 -1
- package/src/IconButton.tsx +8 -5
- package/src/LinkCard.test.tsx +5 -2
- package/src/LinkParts.mdx +4 -0
- package/src/LinkParts.stories.tsx +10 -0
- package/src/LinkParts.tsx +5 -1
- package/src/LinkRow.mdx +1 -1
- package/src/LinkRow.tsx +10 -5
- package/src/ListColumn.tsx +9 -3
- package/src/MetaText.mdx +41 -0
- package/src/MetaText.stories.tsx +29 -0
- package/src/MetaText.tsx +38 -0
- package/src/NavItem.tsx +2 -11
- package/src/PageHeader.mdx +123 -0
- package/src/PageHeader.stories.tsx +174 -0
- package/src/PageHeader.test.tsx +99 -0
- package/src/PageHeader.tsx +105 -0
- package/src/Panel.mdx +12 -0
- package/src/Panel.stories.tsx +47 -5
- package/src/Panel.test.tsx +40 -0
- package/src/Panel.tsx +8 -2
- package/src/PartCard.mdx +1 -1
- package/src/PartCard.stories.tsx +2 -9
- package/src/PartCard.test.tsx +13 -1
- package/src/PartCard.tsx +6 -9
- package/src/PinnedComment.mdx +40 -0
- package/src/PinnedComment.stories.tsx +21 -0
- package/src/PinnedComment.tsx +40 -0
- package/src/QuotedLine.mdx +44 -0
- package/src/QuotedLine.stories.tsx +30 -0
- package/src/QuotedLine.test.tsx +34 -0
- package/src/QuotedLine.tsx +33 -0
- package/src/ReactionHorizon.mdx +36 -0
- package/src/ReactionHorizon.stories.tsx +27 -0
- package/src/ReactionHorizon.tsx +27 -0
- package/src/RepliesRow.mdx +45 -0
- package/src/RepliesRow.stories.tsx +33 -0
- package/src/RepliesRow.test.tsx +47 -0
- package/src/RepliesRow.tsx +86 -0
- package/src/ReplyCard.mdx +50 -0
- package/src/ReplyCard.stories.tsx +68 -0
- package/src/ResolveDialog.mdx +44 -0
- package/src/ResolveDialog.stories.tsx +23 -0
- package/src/ResolveDialog.test.tsx +53 -0
- package/src/ResolveDialog.tsx +58 -0
- package/src/Select.tsx +12 -2
- package/src/ShowMore.mdx +2 -5
- package/src/ShowMore.stories.tsx +0 -14
- package/src/ShowMore.test.tsx +0 -16
- package/src/ShowMore.tsx +2 -16
- package/src/Skeleton.stories.tsx +4 -1
- package/src/Skeleton.tsx +33 -4
- package/src/Thread.mdx +53 -0
- package/src/Thread.stories.tsx +167 -0
- package/src/Thread.test.tsx +83 -0
- package/src/Thread.tsx +113 -0
- package/src/TopBar.mdx +8 -6
- package/src/TopBar.stories.tsx +4 -3
- package/src/TopBar.tsx +8 -3
- package/src/UrgentMark.mdx +37 -0
- package/src/UrgentMark.stories.tsx +27 -0
- package/src/UrgentMark.tsx +15 -0
- package/src/commentBoxFrame.tsx +8 -4
- package/src/conversation.examples.tsx +135 -0
- package/src/eslint/no-native-title.ts +1 -1
- package/src/eslint/no-restyled-part.ts +1 -0
- package/src/index.ts +19 -2
- package/src/looks.ts +18 -2
- package/src/registry/registry.test.ts +7 -6
- package/src/threadCard.ts +84 -0
- package/stories/Choosing.mdx +21 -1
- package/tokens.css +14 -10
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Fragment, type ReactNode } from 'react'
|
|
2
|
+
import { IconLock } from '@tabler/icons-react'
|
|
3
|
+
import { cn } from './cn'
|
|
4
|
+
import { ContainerHeader } from './ContainerHeader'
|
|
5
|
+
import { MetaText } from './MetaText'
|
|
6
|
+
import { WithTooltip } from './Tooltip'
|
|
7
|
+
|
|
8
|
+
/** One of the quiet words at the right of a `PageHeader`: a count, and whether it is about what is finished. */
|
|
9
|
+
export interface PageHeaderMeta {
|
|
10
|
+
/** The words: "6 open", "2 done". */
|
|
11
|
+
label: string
|
|
12
|
+
/** Words about what is finished: in the success colour. Default: the secondary text. */
|
|
13
|
+
done?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The bar at the top of a page: what the page is, and what acts on all of it.
|
|
18
|
+
* ContainerHeader's bar (48px, a hairline under it, 16px in at each end) with
|
|
19
|
+
* a fixed place for each thing the apps' own page bars hold, so they stop
|
|
20
|
+
* laying them out one by one.
|
|
21
|
+
*
|
|
22
|
+
* At the left, in this order, 8px apart: an icon or a face, a lock, the title,
|
|
23
|
+
* something right after it. At the right, 12px apart: quiet words (counts),
|
|
24
|
+
* when it last changed, the members, then the page's buttons. Those numbers
|
|
25
|
+
* are Peek's page bar and Leaf's, measured on 31 October: the counts and the
|
|
26
|
+
* members are one group 12px clear of the buttons (Katerina, 8 October), and
|
|
27
|
+
* the buttons sit 4px apart, as every bar's do.
|
|
28
|
+
*/
|
|
29
|
+
export interface PageHeaderProps {
|
|
30
|
+
/**
|
|
31
|
+
* The page's name. A string is one line in `body-2-strong`, cut short with
|
|
32
|
+
* an ellipsis when there is no room. A node — a `Breadcrumb`, an
|
|
33
|
+
* `InlineText` — is drawn as given, in the room that is left.
|
|
34
|
+
*/
|
|
35
|
+
title: ReactNode
|
|
36
|
+
/** Before the title, 16px: an icon at stroke 1.5, or a face (`Avatar size={16}`). A bare icon takes the secondary text colour. */
|
|
37
|
+
leading?: ReactNode
|
|
38
|
+
/** A lock before the title: only its members can open this page. Named "Private" to assistive technology and in a tooltip. */
|
|
39
|
+
private?: boolean
|
|
40
|
+
/** Right after the title, 8px from it, and never cut short: a small `Button`, a `Chip`. */
|
|
41
|
+
after?: ReactNode
|
|
42
|
+
/** Quiet words at the right, before the members: counts. A dot between each, each in `MetaText` (in Signal, the mono micro-type). */
|
|
43
|
+
meta?: (string | PageHeaderMeta)[]
|
|
44
|
+
/** When it last changed, in words — "Edited 2 minutes ago" — 12px italic, with the exact time in a tooltip. */
|
|
45
|
+
time?: { label: string; exact: string }
|
|
46
|
+
/** Who is in it: a `MembersPill`. */
|
|
47
|
+
members?: ReactNode
|
|
48
|
+
/** The page's own buttons, at the right edge: a `Toolbar` with `surface={false}` of `ToolbarButton`s, or one `IconButton`. */
|
|
49
|
+
actions?: ReactNode
|
|
50
|
+
/** Placement only. */
|
|
51
|
+
className?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function PageHeader({ title, leading, private: locked = false, after, meta, time, members, actions, className }: PageHeaderProps) {
|
|
55
|
+
const words = (meta ?? []).map((one) => (typeof one === 'string' ? { label: one } : one))
|
|
56
|
+
const quiet = words.length > 0 || time != null || members != null
|
|
57
|
+
|
|
58
|
+
const name = (
|
|
59
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
60
|
+
{leading != null && <span className="flex shrink-0 items-center text-text-secondary">{leading}</span>}
|
|
61
|
+
{locked && (
|
|
62
|
+
<WithTooltip label="Private">
|
|
63
|
+
<IconLock size={16} stroke={1.5} role="img" aria-label="Private" className="shrink-0 text-text-secondary" />
|
|
64
|
+
</WithTooltip>
|
|
65
|
+
)}
|
|
66
|
+
{typeof title === 'string' ? <span className="truncate text-body-2-strong text-text-primary">{title}</span> : <div className="flex min-w-0 items-center">{title}</div>}
|
|
67
|
+
{after != null && <span className="flex shrink-0 items-center">{after}</span>}
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const right =
|
|
72
|
+
quiet || actions != null ? (
|
|
73
|
+
<>
|
|
74
|
+
{quiet && (
|
|
75
|
+
// The quiet group: 12px between its parts, and 12px clear of the buttons — the bar sets
|
|
76
|
+
// its actions 4px apart, so the group adds the other 8px, as Peek's and Leaf's bars do.
|
|
77
|
+
<div className={cn('flex items-center gap-3', actions != null && 'pr-2')}>
|
|
78
|
+
{words.length > 0 && (
|
|
79
|
+
<div className="flex items-center gap-2">
|
|
80
|
+
{words.map((one, i) => (
|
|
81
|
+
<Fragment key={`${one.label}-${i}`}>
|
|
82
|
+
{i > 0 && (
|
|
83
|
+
// eslint-disable-next-line token-spacing/no-restricted-classes -- @estiva-escape: Peek's dot between its counts, 3px measured on 31 October; the scale steps from 2px to 4px
|
|
84
|
+
<span aria-hidden="true" className="size-[3px] shrink-0 rounded-full bg-text-muted" />
|
|
85
|
+
)}
|
|
86
|
+
<MetaText tone={one.done ? 'success' : 'secondary'}>{one.label}</MetaText>
|
|
87
|
+
</Fragment>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
{time && (
|
|
92
|
+
<WithTooltip label={time.exact}>
|
|
93
|
+
{/* Quieter than the title: 12px and italic, as every "time ago" line is (Katerina, 30 October), in the muted words (1 November). */}
|
|
94
|
+
<span className="whitespace-nowrap text-caption italic text-text-muted">{time.label}</span>
|
|
95
|
+
</WithTooltip>
|
|
96
|
+
)}
|
|
97
|
+
{members}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
{actions}
|
|
101
|
+
</>
|
|
102
|
+
) : undefined
|
|
103
|
+
|
|
104
|
+
return <ContainerHeader title={name} actions={right} className={className} />
|
|
105
|
+
}
|
package/src/Panel.mdx
CHANGED
|
@@ -56,6 +56,18 @@ import { Panel, IconButton } from '@estiva-app/ui'
|
|
|
56
56
|
ContainerHeader's: 48px, a hairline under it.
|
|
57
57
|
- A panel that follows its scroll (a thread that opens at its newest reply)
|
|
58
58
|
reads it with `bodyRef` and `onBodyScroll`.
|
|
59
|
+
- A **Chip** in `actions`, before the close button, says the state of what
|
|
60
|
+
the panel shows. The bar sets its actions 4px apart, so the chip sits 4px
|
|
61
|
+
from the button. Here at 384px, the right column's width in every app.
|
|
62
|
+
|
|
63
|
+
<Canvas of={PanelStories.WithAChip} />
|
|
64
|
+
|
|
65
|
+
- A panel that is the page — a file's or a document's — takes the page's
|
|
66
|
+
own bar in `header`: a **PageHeader**, drawn in place of the panel's.
|
|
67
|
+
`title` still names the panel if it breaks.
|
|
68
|
+
|
|
69
|
+
<Canvas of={PanelStories.WithAPageHeader} />
|
|
70
|
+
|
|
59
71
|
- **A crash stays inside it.** If its body, its actions or its footer break,
|
|
60
72
|
it keeps its title and shows "Something went wrong in the panel… try again"
|
|
61
73
|
in the room the body had. It is **ErrorBoundary**'s.
|
package/src/Panel.stories.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { IconDotsVertical } from '@tabler/icons-react'
|
|
2
|
+
import { IconDotsVertical, IconX } from '@tabler/icons-react'
|
|
3
|
+
import { Chip } from './Chip'
|
|
3
4
|
import { IconButton } from './IconButton'
|
|
5
|
+
import { PageHeader } from './PageHeader'
|
|
4
6
|
import { Panel } from './Panel'
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -13,11 +15,12 @@ const meta = {
|
|
|
13
15
|
component: Panel,
|
|
14
16
|
parameters: { layout: 'fullscreen' },
|
|
15
17
|
args: { title: 'Details', children: null, bodyClassName: 'flex flex-col gap-3 px-4 pt-3 pb-4' },
|
|
16
|
-
argTypes: { children: { control: false }, actions: { control: false }, footer: { control: false } },
|
|
17
|
-
// A side column of the frame: 380px wide and a fixed height, where a panel sits beside a page
|
|
18
|
+
argTypes: { children: { control: false }, actions: { control: false }, header: { control: false }, footer: { control: false } },
|
|
19
|
+
// A side column of the frame: 380px wide and a fixed height, where a panel sits beside a page;
|
|
20
|
+
// 384px, the right column's width in every app (Katerina, 31 October), where a story says so.
|
|
18
21
|
decorators: [
|
|
19
|
-
(Story) => (
|
|
20
|
-
<div className=
|
|
22
|
+
(Story, { parameters }) => (
|
|
23
|
+
<div className={parameters.rightColumn ? 'flex h-[560px] w-[384px] flex-col border-l border-border-subtle bg-bg-surface' : 'flex h-[560px] w-[380px] flex-col border-l border-border-subtle bg-bg-surface'}>
|
|
21
24
|
{Story()}
|
|
22
25
|
</div>
|
|
23
26
|
),
|
|
@@ -70,6 +73,45 @@ export const WithAFooter: Story = {
|
|
|
70
73
|
),
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
/** A chip before the close button, saying the state of what the panel shows; the right column's width, 384px. */
|
|
77
|
+
export const WithAChip: Story = {
|
|
78
|
+
parameters: { rightColumn: true },
|
|
79
|
+
args: {
|
|
80
|
+
actions: (
|
|
81
|
+
<>
|
|
82
|
+
<Chip type="success" label="Label" />
|
|
83
|
+
<IconButton tooltip="Close" aria-label="Close">
|
|
84
|
+
<IconX size={16} stroke={1.5} />
|
|
85
|
+
</IconButton>
|
|
86
|
+
</>
|
|
87
|
+
),
|
|
88
|
+
},
|
|
89
|
+
render: (args) => <Panel {...args}>{paragraphs(3)}</Panel>,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A page's own bar in place of the panel's: a PageHeader, where the panel is the page. The body still scrolls under it. */
|
|
93
|
+
export const WithAPageHeader: Story = {
|
|
94
|
+
name: 'With a page header',
|
|
95
|
+
args: {
|
|
96
|
+
header: (
|
|
97
|
+
<PageHeader
|
|
98
|
+
title="Item one"
|
|
99
|
+
time={{ label: 'Edited 2 minutes ago', exact: '1 November 2026, 14:02' }}
|
|
100
|
+
actions={
|
|
101
|
+
<IconButton tooltip="More" aria-label="More">
|
|
102
|
+
<IconDotsVertical size={16} stroke={1.5} />
|
|
103
|
+
</IconButton>
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
),
|
|
107
|
+
children: Array.from({ length: 24 }, (_, i) => (
|
|
108
|
+
<p key={i} className="text-body-2 text-text-secondary">
|
|
109
|
+
A line of the page, number {i + 1}.
|
|
110
|
+
</p>
|
|
111
|
+
)),
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
73
115
|
/** Two panels in one column: the first capped at three fifths, each scrolls in its own room. */
|
|
74
116
|
export const TwoInAColumn: Story = {
|
|
75
117
|
render: (args) => (
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
4
|
+
import { Panel } from './Panel'
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup)
|
|
7
|
+
|
|
8
|
+
function Breaks(): never {
|
|
9
|
+
throw new Error('the body broke')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('Panel', () => {
|
|
13
|
+
it('draws its own bar from its title', () => {
|
|
14
|
+
render(<Panel title="Details">Body</Panel>)
|
|
15
|
+
expect(screen.getByText('Details')).toBeTruthy()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('draws a page’s own bar in place of its own, with `header`', () => {
|
|
19
|
+
render(
|
|
20
|
+
<Panel title="Details" header={<div>The page’s bar</div>}>
|
|
21
|
+
Body
|
|
22
|
+
</Panel>,
|
|
23
|
+
)
|
|
24
|
+
expect(screen.getByText('The page’s bar')).toBeTruthy()
|
|
25
|
+
expect(screen.queryByText('Details')).toBeNull()
|
|
26
|
+
expect(screen.getByText('Body')).toBeTruthy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('keeps its title when it breaks, even with a page’s bar, which may be what broke', () => {
|
|
30
|
+
vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
31
|
+
render(
|
|
32
|
+
<Panel title="Details" header={<div>The page’s bar</div>}>
|
|
33
|
+
<Breaks />
|
|
34
|
+
</Panel>,
|
|
35
|
+
)
|
|
36
|
+
expect(screen.getByText('Details')).toBeTruthy()
|
|
37
|
+
expect(screen.queryByText('The page’s bar')).toBeNull()
|
|
38
|
+
vi.restoreAllMocks()
|
|
39
|
+
})
|
|
40
|
+
})
|
package/src/Panel.tsx
CHANGED
|
@@ -35,6 +35,12 @@ export interface PanelProps {
|
|
|
35
35
|
chevron?: boolean
|
|
36
36
|
/** The panel's own actions, at the header's right — a `Toolbar` of `ToolbarButton`s, or one `IconButton`. */
|
|
37
37
|
actions?: ReactNode
|
|
38
|
+
/**
|
|
39
|
+
* A page's own bar, in place of the one `title`, `chevron` and `actions` draw: a `PageHeader`, where the panel is
|
|
40
|
+
* the page (Peek's file pages, Leaf's documents), so the page's bar and its scrolling body are one panel. `title`
|
|
41
|
+
* still names the panel if it breaks.
|
|
42
|
+
*/
|
|
43
|
+
header?: ReactNode
|
|
38
44
|
/** The body. It scrolls when it is taller than the panel. */
|
|
39
45
|
children: ReactNode
|
|
40
46
|
/** A row fixed under the body that never scrolls — a reply box. */
|
|
@@ -49,10 +55,10 @@ export interface PanelProps {
|
|
|
49
55
|
className?: string
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
function Frame({ title, chevron = false, actions, children, footer, bodyClassName, bodyRef, onBodyScroll, className, broken = false }: PanelProps & { broken?: boolean }) {
|
|
58
|
+
function Frame({ title, chevron = false, actions, header, children, footer, bodyClassName, bodyRef, onBodyScroll, className, broken = false }: PanelProps & { broken?: boolean }) {
|
|
53
59
|
return (
|
|
54
60
|
<div className={cn('flex h-full min-h-0 flex-1 flex-col', className)}>
|
|
55
|
-
<ContainerHeader title={title} chevron={chevron} actions={actions} />
|
|
61
|
+
{header ?? <ContainerHeader title={title} chevron={chevron} actions={actions} />}
|
|
56
62
|
{broken ? (
|
|
57
63
|
// The message takes the room the body had and centres itself in it.
|
|
58
64
|
<div className="flex min-h-0 flex-1 flex-col px-4">{children}</div>
|
package/src/PartCard.mdx
CHANGED
|
@@ -12,7 +12,7 @@ A part of something longer, shared live: its blocks as they are now, under the t
|
|
|
12
12
|
## When
|
|
13
13
|
|
|
14
14
|
- **ready** — what it is part of, as a card starts: its kind in a file's 36px tile, its title as the link, and "A part of ABC-2" under it; then the blocks the app draws as `children`, behind a quote bar that starts where the tile does. The apps draw the blocks with **RichText** `size="small"`.
|
|
15
|
-
- **
|
|
15
|
+
- **long** — with `maxHeight`, a long part is cut behind Show more, under the quote bar. Its title is the way to it, in the app it lives in: there is no "Open in …" button (Katerina, 31 Oct).
|
|
16
16
|
- **loading** — at a card's height.
|
|
17
17
|
- **unavailable** — one row: "A part of this issue not available", in the app's word for it, else its kind's. Not the reader's to see.
|
|
18
18
|
- **deleted** — what it is part of was deleted, as a trusted deletion naming it says (SPEC §13.6.1): the same row, "A part of this issue deleted".
|
package/src/PartCard.stories.tsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { IconExternalLink } from '@tabler/icons-react'
|
|
3
|
-
import { Button } from './Button'
|
|
4
2
|
import { PartCard } from './PartCard'
|
|
5
3
|
import { RichText, type RichTextBlock } from './RichText'
|
|
6
4
|
|
|
@@ -38,19 +36,14 @@ const LONG_BLOCKS: RichTextBlock[] = [
|
|
|
38
36
|
...Array.from({ length: 6 }, (_, i): RichTextBlock => ({ type: 'paragraph', inline: [{ text: `Paragraph ${i + 1} of the part, long enough to fill a line of the card and go on to a second one.`, marks: [] }] })),
|
|
39
37
|
]
|
|
40
38
|
|
|
41
|
-
/** As an app quotes a long part: cut behind Show more,
|
|
42
|
-
export const
|
|
39
|
+
/** As an app quotes a long part: cut behind Show more, under the quote bar. Its title is the way to it, in its own app. */
|
|
40
|
+
export const Long: Story = {
|
|
43
41
|
args: {
|
|
44
42
|
state: 'ready',
|
|
45
43
|
kind: 'page',
|
|
46
44
|
heading: 'Document one',
|
|
47
45
|
href: '#part',
|
|
48
46
|
maxHeight: 160,
|
|
49
|
-
action: (
|
|
50
|
-
<Button size="small" leadingIcon={<IconExternalLink stroke={1.5} className="size-3.5" />} onClick={() => {}}>
|
|
51
|
-
Open in App one
|
|
52
|
-
</Button>
|
|
53
|
-
),
|
|
54
47
|
children: <RichText blocks={LONG_BLOCKS} size="small" />,
|
|
55
48
|
},
|
|
56
49
|
}
|
package/src/PartCard.test.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
2
|
/** What the PartCard page claims, pinned: the header opens what it is part of, the blocks draw, and the states say so. */
|
|
3
3
|
import { cleanup, render, screen } from '@testing-library/react'
|
|
4
|
-
import { afterEach, describe, expect, it } from 'vitest'
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
5
5
|
import { PartCard } from './PartCard'
|
|
6
6
|
|
|
7
7
|
afterEach(cleanup)
|
|
@@ -19,6 +19,18 @@ describe('PartCard', () => {
|
|
|
19
19
|
expect(screen.getByText('The blocks')).toBeTruthy()
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
+
it('a long part is cut behind Show more, its title the only way to it (Katerina, 31 Oct: no "Open in" beside it)', () => {
|
|
23
|
+
const tall = vi.spyOn(HTMLElement.prototype, 'scrollHeight', 'get').mockReturnValue(300)
|
|
24
|
+
render(
|
|
25
|
+
<PartCard kind="page" heading="Document one" href="#part" maxHeight={160}>
|
|
26
|
+
<p>The blocks</p>
|
|
27
|
+
</PartCard>,
|
|
28
|
+
)
|
|
29
|
+
expect(screen.getAllByRole('button').map((b) => b.textContent)).toEqual(['Show more'])
|
|
30
|
+
expect(screen.getAllByRole('link').map((a) => a.textContent)).toEqual(['Document one'])
|
|
31
|
+
tall.mockRestore()
|
|
32
|
+
})
|
|
33
|
+
|
|
22
34
|
it('says a part is not available in words', () => {
|
|
23
35
|
render(<PartCard state="unavailable" kind="issue" noun="Issue" />)
|
|
24
36
|
expect(screen.getByText('A part of this issue not available')).toBeTruthy()
|
package/src/PartCard.tsx
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* Look C (Katerina, 29 Oct): what it is part of as a card starts, its kind in a
|
|
9
9
|
* file's 36px tile, its title and "A part of ABC-2" under it; then the blocks
|
|
10
10
|
* behind a quote bar that starts where the tile does.
|
|
11
|
+
*
|
|
12
|
+
* The title is the way to it, in the app it lives in: no "Open in …" button
|
|
13
|
+
* beside the blocks (Katerina, 31 Oct: it said again what the title does).
|
|
11
14
|
*/
|
|
12
15
|
import { useContext, type ReactNode } from 'react'
|
|
13
16
|
import { Card } from './Card'
|
|
@@ -45,17 +48,11 @@ export interface PartCardProps {
|
|
|
45
48
|
openIn?: { app: string; href: string }
|
|
46
49
|
/** The part's blocks, drawn by the app. */
|
|
47
50
|
children?: ReactNode
|
|
48
|
-
/**
|
|
49
|
-
* The way out to where the part lives: a small `Button` with a leading icon ("Open in Leaf"). Drawn under the
|
|
50
|
-
* blocks at the right, level with Show more, outside the quote bar (Katerina, 30 Oct: "the vertical line should not
|
|
51
|
-
* be covering the button"). Peek and Ship put it in ShowMore's row inside the blocks before.
|
|
52
|
-
*/
|
|
53
|
-
action?: ReactNode
|
|
54
51
|
/** Cut the blocks at this height, in px, behind ShowMore's fade and its Show more. Absent, they are drawn whole. */
|
|
55
52
|
maxHeight?: number
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
export function PartCard({ state = 'ready', kind, heading, href, partKey, noun, openIn, children,
|
|
55
|
+
export function PartCard({ state = 'ready', kind, heading, href, partKey, noun, openIn, children, maxHeight }: PartCardProps) {
|
|
59
56
|
const word = noun ?? kindNounOf({ kind }) ?? 'File'
|
|
60
57
|
const boxed = useContext(inTheBox)
|
|
61
58
|
if (state === 'loading') return <LinkCardLoading kind={kind} shape={{ summary: true, rows: 0, footer: 'none' }} />
|
|
@@ -85,8 +82,8 @@ export function PartCard({ state = 'ready', kind, heading, href, partKey, noun,
|
|
|
85
82
|
</span>
|
|
86
83
|
</div>
|
|
87
84
|
{/* The quote bar starts where the tile above it starts (Katerina, 29 Oct), and runs beside the blocks only. */}
|
|
88
|
-
{
|
|
89
|
-
<ShowMore maxHeight={maxHeight
|
|
85
|
+
{maxHeight !== undefined ? (
|
|
86
|
+
<ShowMore maxHeight={maxHeight} contentClassName={QUOTE_BAR_CLASSES}>
|
|
90
87
|
{children}
|
|
91
88
|
</ShowMore>
|
|
92
89
|
) : (
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './PinnedComment.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# PinnedComment
|
|
7
|
+
|
|
8
|
+
The comment a thread answers, pinned at the top of the replies column: who, when, and its first line.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Pinned} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- At the top of a **Thread** in the right column. Thread draws it from its `start`.
|
|
15
|
+
|
|
16
|
+
<Canvas of={Stories.Deleted} />
|
|
17
|
+
|
|
18
|
+
## When not
|
|
19
|
+
|
|
20
|
+
- The comment itself, in the list → **ConversationCard**.
|
|
21
|
+
|
|
22
|
+
## How
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Thread } from '@estiva-app/ui'
|
|
26
|
+
|
|
27
|
+
<Thread start={{ author: author, time: time, words: words }} onClose={onClose} box={box}>
|
|
28
|
+
{replies}
|
|
29
|
+
</Thread>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Give `time` its day: no day line stands above it here.
|
|
33
|
+
|
|
34
|
+
## What it owns
|
|
35
|
+
|
|
36
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
<Controls />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { Column, ONE, WORDS } from './conversation.examples'
|
|
3
|
+
import { PinnedComment } from './PinnedComment'
|
|
4
|
+
|
|
5
|
+
/** The comment a thread answers, at the top of the replies column. */
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Conversation/PinnedComment',
|
|
8
|
+
component: PinnedComment,
|
|
9
|
+
parameters: { layout: 'padded' },
|
|
10
|
+
args: { author: ONE, time: 'Today 11:08 AM', words: WORDS },
|
|
11
|
+
decorators: [(Story) => <Column>{Story()}</Column>],
|
|
12
|
+
} satisfies Meta<typeof PinnedComment>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
/** Who, when, and its first line. */
|
|
18
|
+
export const Pinned: Story = {}
|
|
19
|
+
|
|
20
|
+
/** It was deleted; its replies stay under it. */
|
|
21
|
+
export const Deleted: Story = { args: { deleted: true } }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { Avatar } from './Avatar'
|
|
3
|
+
import { Card } from './Card'
|
|
4
|
+
import type { ConversationPerson } from './ConversationCard'
|
|
5
|
+
import { MetaText } from './MetaText'
|
|
6
|
+
|
|
7
|
+
export interface PinnedCommentProps {
|
|
8
|
+
author: ConversationPerson
|
|
9
|
+
/** When it was written, in the app's words, with its day: no day line stands above it here. */
|
|
10
|
+
time: ReactNode
|
|
11
|
+
/** Its words, cut to one line: plain words read best. */
|
|
12
|
+
words: ReactNode
|
|
13
|
+
/** It was deleted; its replies stay. */
|
|
14
|
+
deleted?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The comment a thread answers, pinned at the top of the replies column: who, when, and its first line, on a raised
|
|
19
|
+
* card. Peek's pinned message, moved with the conversation.
|
|
20
|
+
*/
|
|
21
|
+
export function PinnedComment({ author, time, words, deleted = false }: PinnedCommentProps) {
|
|
22
|
+
return (
|
|
23
|
+
<Card fill="elevated" clip>
|
|
24
|
+
{deleted ? (
|
|
25
|
+
<p className="p-2 text-caption italic text-text-muted">This comment was deleted.</p>
|
|
26
|
+
) : (
|
|
27
|
+
<div className="flex flex-col p-2">
|
|
28
|
+
<div className="flex items-center gap-2">
|
|
29
|
+
<Avatar size={24} src={author.picture} alt={author.name} />
|
|
30
|
+
<span className="min-w-0 truncate text-body-2-strong text-text-primary">{author.name}</span>
|
|
31
|
+
<MetaText className="shrink-0">{time}</MetaText>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="pb-2 pl-8 pr-2 pt-1">
|
|
34
|
+
<div className="truncate text-caption text-text-secondary">{words}</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
38
|
+
</Card>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './QuotedLine.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# QuotedLine
|
|
7
|
+
|
|
8
|
+
On a comment on a part of the page: the words it is on, in the page's own highlight, under the name and above the comment's words.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Words} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- On a **ConversationCard** about a part of the page, in its `about`.
|
|
15
|
+
|
|
16
|
+
<Canvas of={Stories.Reworded} />
|
|
17
|
+
|
|
18
|
+
<Canvas of={Stories.Gone} />
|
|
19
|
+
|
|
20
|
+
## When not
|
|
21
|
+
|
|
22
|
+
- A whole block quoted in the words → **PartCard**.
|
|
23
|
+
|
|
24
|
+
## How
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { ConversationCard, QuotedLine } from '@estiva-app/ui'
|
|
28
|
+
|
|
29
|
+
<ConversationCard author={author} time={time} about={<QuotedLine words={quote} state="reworded" />}>
|
|
30
|
+
{words}
|
|
31
|
+
</ConversationCard>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Two lines at most; the whole words are in the tooltip.
|
|
35
|
+
- A part with no words, a picture or a block: `label`, its name in your words.
|
|
36
|
+
- Made for the card's `about`: the card puts it under the name, where the words start.
|
|
37
|
+
|
|
38
|
+
## What it owns
|
|
39
|
+
|
|
40
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
41
|
+
|
|
42
|
+
## Props
|
|
43
|
+
|
|
44
|
+
<Controls />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { Column } from './conversation.examples'
|
|
3
|
+
import { QuotedLine } from './QuotedLine'
|
|
4
|
+
|
|
5
|
+
/** On a comment on a part of the page, under the name and above its words: the words it is on, in the page's highlight. */
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Conversation/QuotedLine',
|
|
8
|
+
component: QuotedLine,
|
|
9
|
+
parameters: { layout: 'padded' },
|
|
10
|
+
args: { words: 'the words this comment is on' },
|
|
11
|
+
decorators: [(Story) => <Column>{Story()}</Column>],
|
|
12
|
+
} satisfies Meta<typeof QuotedLine>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
/** The words the comment is on, still in the text: in the page's highlight, so the two read as one. */
|
|
18
|
+
export const Words: Story = { name: 'Words' }
|
|
19
|
+
|
|
20
|
+
/** The words were changed since: the highlight goes grey, and "Changed since". */
|
|
21
|
+
export const Reworded: Story = { name: 'Words changed', args: { state: 'reworded' } }
|
|
22
|
+
|
|
23
|
+
/** The part was deleted from the page: the words struck through, and "Deleted from the page". */
|
|
24
|
+
export const Gone: Story = { name: 'Part deleted', args: { state: 'gone' } }
|
|
25
|
+
|
|
26
|
+
/** On a part with no words of its own, a picture: its name, in the app's words. */
|
|
27
|
+
export const Part: Story = { name: 'No words', args: { words: undefined, label: 'Picture: plan-sketch.png' } }
|
|
28
|
+
|
|
29
|
+
/** Words longer than two lines: cut, the whole in the tooltip. */
|
|
30
|
+
export const Long: Story = { name: 'Long words', args: { words: 'the words this comment is on, which run on past the width of the column, and on again, so that two lines are not enough and the words have to be cut before their end' } }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
4
|
+
import { QuotedLine } from './QuotedLine'
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup)
|
|
7
|
+
|
|
8
|
+
describe('QuotedLine', () => {
|
|
9
|
+
it('marks the words in the page’s highlight while they are still in the text', () => {
|
|
10
|
+
const { container } = render(<QuotedLine words="the words this comment is on" />)
|
|
11
|
+
const mark = screen.getByText('the words this comment is on')
|
|
12
|
+
expect(mark.tagName).toBe('MARK')
|
|
13
|
+
expect(mark.className).toMatch(/\bbg-warning-muted\b/)
|
|
14
|
+
expect(container.querySelector('[data-quoted="here"]')).not.toBeNull()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('says the words changed since, and loses the highlight', () => {
|
|
18
|
+
render(<QuotedLine words="the words" state="reworded" />)
|
|
19
|
+
expect(screen.getByText('Changed since')).toBeTruthy()
|
|
20
|
+
expect(screen.getByText('the words').className).not.toMatch(/\bbg-warning-muted\b/)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('says the part was deleted, and strikes the words through', () => {
|
|
24
|
+
render(<QuotedLine words="the words" state="gone" />)
|
|
25
|
+
expect(screen.getByText('Deleted from the page')).toBeTruthy()
|
|
26
|
+
expect(screen.getByText('the words').className).toMatch(/\bline-through\b/)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('gives a part with no words its name', () => {
|
|
30
|
+
const { container } = render(<QuotedLine label="Picture: plan-sketch.png" />)
|
|
31
|
+
expect(screen.getByText('Picture: plan-sketch.png')).toBeTruthy()
|
|
32
|
+
expect(container.querySelector('[data-quoted="part"]')).not.toBeNull()
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from './cn'
|
|
2
|
+
import { WithTooltip } from './Tooltip'
|
|
3
|
+
|
|
4
|
+
export interface QuotedLineProps {
|
|
5
|
+
/** The words the comment is on, as they were quoted. */
|
|
6
|
+
words?: string
|
|
7
|
+
/** `here`: still in the text. `reworded`: changed since. `gone`: their part was deleted from the page. */
|
|
8
|
+
state?: 'here' | 'reworded' | 'gone'
|
|
9
|
+
/** A part with no words, a picture or a whole block: what it is, in the app's words ("Picture: plan.png"). */
|
|
10
|
+
label?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SINCE = { reworded: 'Changed since', gone: 'Deleted from the page' } as const
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What a comment on a part of the page is on: its words, two lines at most, in the page's own highlight, so the two
|
|
17
|
+
* read as one. ConversationCard puts it under the name, above the comment's words ("above the message, not above the
|
|
18
|
+
* person": Katerina, 1 November). Words changed since or deleted lose the highlight and say so; a part with no words
|
|
19
|
+
* gives its name.
|
|
20
|
+
*/
|
|
21
|
+
export function QuotedLine({ words, state = 'here', label }: QuotedLineProps) {
|
|
22
|
+
const shown = words ?? label ?? ''
|
|
23
|
+
return (
|
|
24
|
+
<div data-quoted={words ? state : 'part'} className="flex w-full min-w-0 flex-col gap-0.5">
|
|
25
|
+
<WithTooltip label={shown} wrapperClassName="flex min-w-0">
|
|
26
|
+
<p className="line-clamp-2 text-caption text-text-secondary">
|
|
27
|
+
<mark className={cn('rounded-sm px-0.5 text-text-primary [box-decoration-break:clone]', state === 'here' ? 'bg-warning-muted' : 'bg-bg-inset text-text-secondary', state === 'gone' && 'line-through')}>{shown}</mark>
|
|
28
|
+
</p>
|
|
29
|
+
</WithTooltip>
|
|
30
|
+
{state !== 'here' && <span className="text-caption italic text-text-muted">{SINCE[state]}</span>}
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './ReactionHorizon.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# ReactionHorizon
|
|
7
|
+
|
|
8
|
+
The line that says reactions are read only so far back, and how many older comments were not checked.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Older} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- Under a long conversation, when the app stopped reading reactions before the oldest comment.
|
|
15
|
+
|
|
16
|
+
## When not
|
|
17
|
+
|
|
18
|
+
No alternative: when every reaction was read, it draws nothing, so it can always be placed.
|
|
19
|
+
|
|
20
|
+
## How
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { ReactionHorizon } from '@estiva-app/ui'
|
|
24
|
+
|
|
25
|
+
<ReactionHorizon limit={200} omitted={14} cut={false} />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- `limit`, `omitted` and `cut` are the app's to count.
|
|
29
|
+
|
|
30
|
+
## What it owns
|
|
31
|
+
|
|
32
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
<Controls />
|