-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathCollectionCardHeader.tsx
More file actions
51 lines (47 loc) · 1.36 KB
/
CollectionCardHeader.tsx
File metadata and controls
51 lines (47 loc) · 1.36 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
import type { ReactElement } from 'react';
import React from 'react';
import classNames from 'classnames';
import { CollectionPillSources } from '../../post/collection';
import {
BookmakProviderHeader,
headerHiddenClassName,
} from '../common/BookmarkProviderHeader';
import { useBookmarkProvider } from '../../../hooks';
import { PostOptionButton } from '../../../features/posts/PostOptionButton';
import type { Post } from '../../../graphql/posts';
interface CollectionCardHeaderProps {
post: Post;
}
export const CollectionCardHeader = ({
post,
}: CollectionCardHeaderProps): ReactElement => {
const {
collectionSources: sources,
numCollectionSources: totalSources,
bookmarked,
} = post;
const { highlightBookmarkedPost } = useBookmarkProvider({
bookmarked: bookmarked ?? false,
});
return (
<>
{highlightBookmarkedPost && <BookmakProviderHeader />}
<CollectionPillSources
className={{
main: classNames(
'mb-1 mt-3',
highlightBookmarkedPost && headerHiddenClassName,
),
}}
sources={sources ?? []}
totalSources={totalSources ?? 0}
>
<div className="flex-1" />
<PostOptionButton
post={post}
triggerClassName="laptop:mouse:invisible laptop:mouse:group-hover:visible"
/>
</CollectionPillSources>
</>
);
};