MCPcopy Create free account
hub / github.com/dailydotdev/apps / BookmarkRow

Function BookmarkRow

packages/shared/src/components/bookmark/BookmarkRow.tsx:34–155  ·  view source on GitHub ↗
({
  post,
  onRemove,
  onSelect,
  isSelected = false,
  onKeyDown,
}: BookmarkRowProps)

Source from the content-addressed store, hash-verified

32 * stays bold.
33 */
34export function BookmarkRow({
35 post,
36 onRemove,
37 onSelect,
38 isSelected = false,
39 onKeyDown,
40}: BookmarkRowProps): ReactElement {
41 const [isMenuOpen, setIsMenuOpen] = useState(false);
42 const article = post.sharedPost ?? post;
43 const title = post.title || post.sharedPost?.title;
44 const { source } = post;
45 const sourceName =
46 isSourceUserSource(source) && post.author?.name
47 ? post.author.name
48 : source?.name;
49 const isVideo = isVideoPost(post);
50 const readTime = article.readTime
51 ? `${article.readTime}m ${isVideo ? 'watch' : 'read'}`
52 : undefined;
53 const meta = [sourceName, readTime].filter(Boolean).join(' · ');
54 const isRead = isPostRead(post);
55 const isColumn = !!onSelect;
56 const postPath = getPostPath(post);
57 const note = post.bookmark?.note;
58 const hasReminder = !!post.bookmark?.remindAt;
59
60 return (
61 <div
62 data-testid="bookmarkRow"
63 data-selected={isSelected || undefined}
64 className={classNames(
65 'group relative flex items-start rounded-12 transition-colors duration-150 motion-reduce:transition-none',
66 isSelected ? 'bg-surface-float' : 'hover:bg-surface-hover',
67 isColumn && 'pr-2',
68 )}
69 >
70 <Link href={postPath}>
71 <a
72 href={postPath}
73 aria-current={isSelected ? 'true' : undefined}
74 data-post-id={post.id}
75 title={title ?? undefined}
76 onKeyDown={onKeyDown}
77 onClick={(event) => {
78 if (onSelect && !isModifiedClick(event)) {
79 event.preventDefault();
80 onSelect();
81 }
82 }}
83 className="flex min-h-16 min-w-0 flex-1 items-start gap-2.5 rounded-12 py-1.5 pl-2 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent-blueCheese-default"
84 >
85 <span className="flex min-w-0 flex-1 flex-col">
86 <span
87 className={classNames(
88 'line-clamp-2 break-words font-bold typo-subhead',
89 isRead ? 'text-text-tertiary' : 'text-text-primary',
90 )}
91 >

Callers

nothing calls this directly

Calls 6

isSourceUserSourceFunction · 0.90
isVideoPostFunction · 0.90
isPostReadFunction · 0.90
getPostPathFunction · 0.90
isModifiedClickFunction · 0.70
onSelectFunction · 0.50

Tested by

no test coverage detected