Skip to content

feat: card ui revamp #4630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3850872
change icon size to x small
AmarTrebinjac Jun 25, 2025
9eb8004
add award button
AmarTrebinjac Jun 25, 2025
e76dd16
update card color
AmarTrebinjac Jun 25, 2025
c0cb4e4
paddng
AmarTrebinjac Jun 25, 2025
245dbd8
add award icon to button on card
AmarTrebinjac Jun 30, 2025
265295c
Merge branch 'main' into MI-915
AmarTrebinjac Jun 30, 2025
6ae5830
remove unnecessary prop
AmarTrebinjac Jun 30, 2025
52a0026
rework bookmark button icon props
AmarTrebinjac Jun 30, 2025
7de087b
create post award action
AmarTrebinjac Jun 30, 2025
5e317cc
disable button when awarded
AmarTrebinjac Jun 30, 2025
1009246
update css
AmarTrebinjac Jun 30, 2025
4cc9533
Merge branch 'main' into MI-915
AmarTrebinjac Jun 30, 2025
a4c5fdf
can actually award check
AmarTrebinjac Jun 30, 2025
b2973a2
update list buttons
AmarTrebinjac Jul 1, 2025
82ebb5b
remove unnecessary check
AmarTrebinjac Jul 1, 2025
dc647e5
set new link color
AmarTrebinjac Jul 1, 2025
396a613
remove unnecessary typing
AmarTrebinjac Jul 1, 2025
027be4b
open award list
AmarTrebinjac Jul 1, 2025
27c4373
fix: query coresRole for post author
capJavert Jul 1, 2025
0f03059
update share grid footer
AmarTrebinjac Jul 1, 2025
fc08427
Merge branch 'MI-915' of github.com:dailydotdev/apps into MI-915
AmarTrebinjac Jul 1, 2025
2d481b0
update feed item container
AmarTrebinjac Jul 1, 2025
656cce9
footer margin update
AmarTrebinjac Jul 1, 2025
1a4cfea
update video footer
AmarTrebinjac Jul 1, 2025
2bff747
increase card text container margin
AmarTrebinjac Jul 2, 2025
3f2fb01
fix test
AmarTrebinjac Jul 2, 2025
eccf531
minor spacing adjustment
AmarTrebinjac Jul 2, 2025
69f204e
Undo changes to AwardButton
AmarTrebinjac Jul 2, 2025
685237b
set icon size in list
AmarTrebinjac Jul 2, 2025
776bb18
undo quatenarybutton changes
AmarTrebinjac Jul 2, 2025
ce0e928
undo bookmark button changes
AmarTrebinjac Jul 2, 2025
c92ca0e
Merge branch 'main' into MI-915
sshanzel Jul 3, 2025
5f5ffd5
Merge branch 'main' into MI-915
AmarTrebinjac Jul 3, 2025
1668770
add iconSize props
AmarTrebinjac Jul 3, 2025
587042e
added buttonClassName to quarternary buton
AmarTrebinjac Jul 3, 2025
d80d26e
position tooltips bottom
AmarTrebinjac Jul 3, 2025
9dce573
Merge branch 'main' into MI-915
AmarTrebinjac Jul 3, 2025
1e456bb
Merge branch 'MI-915' of github.com:dailydotdev/apps into MI-915
AmarTrebinjac Jul 4, 2025
9906886
Merge branch 'main' into MI-915
AmarTrebinjac Jul 4, 2025
e46f8b1
Merge branch 'MI-915' of github.com:dailydotdev/apps into MI-915
AmarTrebinjac Jul 4, 2025
92d74fe
add ch padding to all buttons to avoid layout shift and space equally
AmarTrebinjac Jul 4, 2025
8ba812a
Merge branch 'main' into MI-915
AmarTrebinjac Jul 4, 2025
a4cef7f
apply bookmark button fix
AmarTrebinjac Jul 4, 2025
0a422df
make all buttons quaternary for conistency
AmarTrebinjac Jul 4, 2025
6ff889a
Merge branch 'main' into MI-915
AmarTrebinjac Jul 7, 2025
07fde4d
change water color
AmarTrebinjac Jul 7, 2025
2f6ac75
pos
AmarTrebinjac Jul 7, 2025
40ed0f3
revert water colors
AmarTrebinjac Jul 9, 2025
c987690
add px padding to postawardacton
AmarTrebinjac Jul 9, 2025
49492bc
revert back to content shift
AmarTrebinjac Jul 9, 2025
7981c96
add experiment
AmarTrebinjac Jul 10, 2025
1be3ad8
set default exp to false
AmarTrebinjac Jul 10, 2025
3398e01
remove accidental double quotes
AmarTrebinjac Jul 10, 2025
9eef02b
Merge branch 'main' into MI-915
AmarTrebinjac Jul 10, 2025
6038392
Merge branch 'main' into MI-915
AmarTrebinjac Jul 13, 2025
54e5fb9
correct header margin
AmarTrebinjac Jul 13, 2025
efe8404
position squad icons
AmarTrebinjac Jul 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions packages/shared/src/components/buttons/BookmarkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { BookmarkReminderIcon } from '../icons/Bookmark/Reminder';
import { useLazyModal } from '../../hooks/useLazyModal';
import { LazyModal } from '../modals/common/types';
import { useBookmarkReminder } from '../../hooks/notifications';
import { ButtonColor, ButtonVariant } from './Button';
import { ButtonColor, ButtonIconPosition, ButtonVariant } from './Button';
import type { TooltipProps } from '../tooltip/Tooltip';
import { Tooltip } from '../tooltip/Tooltip';
import type { IconSize } from '../Icon';
import {
DropdownMenu,
DropdownMenuContent,
Expand All @@ -18,15 +20,20 @@ import {
} from '../dropdown/DropdownMenu';

interface BookmarkButtonProps {
buttonProps?: QuaternaryButtonProps<'button'>;
buttonProps?: Omit<QuaternaryButtonProps<'button'>, 'icon'>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed icon props because we seem to ignore the icon and select one based on a condition inside this component

contextMenuId?: string;
post: Post;
children?: ReactNode;
iconSize?: IconSize;
tooltipSide?: TooltipProps['side'];
}

export function BookmarkButton({
buttonProps = {},
post,
children,
iconSize,
tooltipSide,
}: BookmarkButtonProps): ReactElement {
const hasReminder = !!post.bookmark?.remindAt;
const { openModal } = useLazyModal();
Expand Down Expand Up @@ -65,8 +72,9 @@ export function BookmarkButton({
variant={ButtonVariant.Tertiary}
{...buttonPropsWithoutOnClick}
type="button"
iconPosition={ButtonIconPosition.Left}
pressed={post.bookmarked}
icon={<Icon secondary={post.bookmarked} />}
icon={<Icon secondary={post.bookmarked} size={iconSize} />}
>
{children}
</QuaternaryButton>
Expand All @@ -83,15 +91,19 @@ export function BookmarkButton({
}

return (
<Tooltip content={post.bookmarked ? 'Remove bookmark' : 'Bookmark'}>
<Tooltip
content={post.bookmarked ? 'Remove bookmark' : 'Bookmark'}
side={tooltipSide}
>
<QuaternaryButton
color={ButtonColor.Bun}
variant={ButtonVariant.Tertiary}
{...buttonProps}
type="button"
pressed={post.bookmarked}
iconPosition={ButtonIconPosition.Top}
onClick={(e) => buttonProps.onClick?.(e)}
icon={<Icon secondary={post.bookmarked} />}
icon={<Icon secondary={post.bookmarked} size={iconSize} />}
>
{children}
</QuaternaryButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type QuaternaryButtonProps<TagName extends AllowedTags> =
ButtonProps<TagName> & {
reverse?: boolean;
labelClassName?: string;
buttonClassName?: string;
};

function QuaternaryButtonComponent<TagName extends AllowedTags>(
Expand All @@ -24,6 +25,7 @@ function QuaternaryButtonComponent<TagName extends AllowedTags>(
reverse,
tag = 'button',
labelClassName,
buttonClassName,
...props
}: QuaternaryButtonProps<TagName>,
ref?: Ref<ButtonElementType<TagName>>,
Expand Down Expand Up @@ -62,7 +64,10 @@ function QuaternaryButtonComponent<TagName extends AllowedTags>(
id={id}
tag={tag}
ref={anchorRef}
className={classNames(tag === 'a' && isHovered && 'hover')}
className={classNames(
tag === 'a' && isHovered && 'hover',
buttonClassName,
)}
/>
{children && (
<label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import InteractionCounter from '../../InteractionCounter';
import { QuaternaryButton } from '../../buttons/QuaternaryButton';
import {
DiscussIcon as CommentIcon,
BookmarkIcon,
LinkIcon,
DownvoteIcon,
} from '../../icons';
Expand All @@ -24,6 +23,9 @@ import { IconSize } from '../../Icon';
import { useBlockPostPanel } from '../../../hooks/post/useBlockPostPanel';
import { usePostActions } from '../../../hooks/post/usePostActions';
import { Tooltip } from '../../tooltip/Tooltip';
import PostAwardAction from '../../post/PostAwardAction';
import { useFeature } from '../../GrowthBookProvider';
import { featurePostUiImprovements } from '../../../lib/featureManagement';

export interface ActionButtonsProps {
post: Post;
Expand Down Expand Up @@ -51,6 +53,7 @@ const ActionButtons = ({
const isUpvoteActive = post.userState?.vote === UserVote.Up;
const isDownvoteActive = post.userState?.vote === UserVote.Down;
const { onShowPanel, onClose } = useBlockPostPanel(post);
const postUiExp = useFeature(featurePostUiImprovements);

if (isFeedPreview) {
return null;
Expand Down Expand Up @@ -92,6 +95,118 @@ const ActionButtons = ({
onCopyLinkClick?.(e, post);
};

if (postUiExp) {
return (
<div
className={classNames(
'flex flex-row items-center justify-between px-1 pb-1',
className,
)}
>
<div className="flex flex-1 items-center justify-between">
<Tooltip
content={isUpvoteActive ? 'Remove upvote' : 'Upvote'}
side="bottom"
>
<QuaternaryButton
labelClassName="!pl-[1px]"
className="btn-tertiary-avocado pointer-events-auto"
id={`post-${post.id}-upvote-btn`}
color={ButtonColor.Avocado}
pressed={isUpvoteActive}
onClick={onToggleUpvote}
variant={ButtonVariant.Tertiary}
size={ButtonSize.Small}
icon={
<UpvoteButtonIcon
secondary={isUpvoteActive}
size={IconSize.XSmall}
/>
}
>
{post?.numUpvotes > 0 && (
<InteractionCounter
className={classNames(
'tabular-nums typo-footnote',
!post.numUpvotes && 'invisible',
)}
value={post.numUpvotes}
/>
)}
</QuaternaryButton>
</Tooltip>
<Tooltip
content={isDownvoteActive ? 'Remove downvote' : 'Downvote'}
side="bottom"
>
<QuaternaryButton
className="pointer-events-auto"
id={`post-${post.id}-downvote-btn`}
color={ButtonColor.Ketchup}
icon={
<DownvoteIcon
secondary={isDownvoteActive}
size={IconSize.XSmall}
/>
}
pressed={isDownvoteActive}
onClick={onToggleDownvote}
variant={ButtonVariant.Tertiary}
size={ButtonSize.Small}
/>
</Tooltip>
<Tooltip content="Comments" side="bottom">
<QuaternaryButton
labelClassName="!pl-[1px]"
id={`post-${post.id}-comment-btn`}
icon={
<CommentIcon
secondary={post.commented}
size={IconSize.XSmall}
/>
}
pressed={post.commented}
onClick={() => onCommentClick?.(post)}
size={ButtonSize.Small}
className="btn-tertiary-blueCheese"
>
{post?.numComments > 0 && (
<InteractionCounter
className={classNames(
'tabular-nums !typo-footnote',
!post.numComments && 'invisible',
)}
value={post.numComments}
/>
)}
</QuaternaryButton>
</Tooltip>
<PostAwardAction post={post} iconSize={IconSize.XSmall} />
<BookmarkButton
tooltipSide="bottom"
post={post}
buttonProps={{
id: `post-${post.id}-bookmark-btn`,
onClick: onToggleBookmark,
size: ButtonSize.Small,
}}
iconSize={IconSize.XSmall}
/>
<Tooltip content="Copy link" side="bottom">
<QuaternaryButton
size={ButtonSize.Small}
icon={<LinkIcon size={IconSize.XSmall} />}
onClick={onCopyLink}
variant={ButtonVariant.Tertiary}
color={ButtonColor.Water}
buttonClassName="hover:text-text-link"
/>
</Tooltip>
</div>
</div>
);
}

return (
<div
className={classNames(
Expand Down Expand Up @@ -154,7 +269,6 @@ const ActionButtons = ({
post={post}
buttonProps={{
id: `post-${post.id}-bookmark-btn`,
icon: <BookmarkIcon secondary={post.bookmarked} />,
onClick: onToggleBookmark,
size: ButtonSize.Small,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { WelcomePostCardFooter } from '../common/WelcomePostCardFooter';
import ActionButtons from '../ActionsButtons/ActionButtons';
import { ClickbaitShield } from '../common/ClickbaitShield';
import { useSmartTitle } from '../../../hooks/post/useSmartTitle';
import { useFeature } from '../../GrowthBookProvider';
import { featurePostUiImprovements } from '../../../lib/featureManagement';

export const FreeformGrid = forwardRef(function SharePostCard(
{
Expand All @@ -41,6 +43,7 @@ export const FreeformGrid = forwardRef(function SharePostCard(
const containerRef = useRef<HTMLDivElement>();
const image = usePostImage(post);
const { title } = useSmartTitle(post);
const postUiExp = useFeature(featurePostUiImprovements);

return (
<FeedItemContainer
Expand All @@ -61,7 +64,7 @@ export const FreeformGrid = forwardRef(function SharePostCard(
post={post}
enableSourceHeader={enableSourceHeader}
/>
<CardTextContainer>
<CardTextContainer className={classNames(postUiExp && 'mx-4')}>
<FreeformCardTitle
className={classNames(
generateTitleClamp({
Expand Down
15 changes: 12 additions & 3 deletions packages/shared/src/components/cards/article/ArticleGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { useSmartTitle } from '../../../hooks/post/useSmartTitle';
import useInteractiveFeed from '../../../hooks/feed/useInteractiveFeed';
import RelevancyTag from '../../tags/RelevancyTag';
import InteractiveFeedTagOverlay from '../../post/tags/InteractiveFeedTagOverlay';
import { useFeature } from '../../GrowthBookProvider';
import { featurePostUiImprovements } from '../../../lib/featureManagement';

export const ArticleGrid = forwardRef(function ArticleGrid(
{
Expand All @@ -48,6 +50,7 @@ export const ArticleGrid = forwardRef(function ArticleGrid(
}: PostCardProps,
ref: Ref<HTMLElement>,
): ReactElement {
const postUiExp = useFeature(featurePostUiImprovements);
const { className, style } = domProps;
const { data } = useBlockPostPanel(post);
const onPostCardClick = () => onPostClick(post);
Expand Down Expand Up @@ -95,7 +98,7 @@ export const ArticleGrid = forwardRef(function ArticleGrid(
post,
classNames(
className,
showFeedback && '!p-0',
(showFeedback || postUiExp) && '!p-0',
postRelevant &&
'!border-status-success !bg-action-upvote-float text-action-upvote-default',
postIrrelevant &&
Expand Down Expand Up @@ -135,7 +138,7 @@ export const ArticleGrid = forwardRef(function ArticleGrid(
showFeedback && styles.read,
)}
>
<CardTextContainer>
<CardTextContainer className={classNames(postUiExp && 'mx-4')}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed we are primarily using mx-4 but the design seems to say 8px only which is mx-2.

Screenshot 2025-07-10 at 4 20 32 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshanzel I think its a bit misleading because if you click in a level or two to see the actual text distance, its 16

Screen.Recording.2025-07-10.at.15.34.47.mov

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the outer container does not havew the right padding, then yeah, mx-4 should be good.

<PostCardHeader
post={post}
className={showFeedback ? '!hidden' : 'flex'}
Expand All @@ -155,7 +158,12 @@ export const ArticleGrid = forwardRef(function ArticleGrid(
{!showFeedback && (
<Container>
<CardSpace />
<div className="mx-2 flex items-center">
<div
className={classNames(
'flex items-center',
postUiExp ? 'mx-4 ' : 'mx-2',
)}
>
{post.clickbaitTitleDetected && <ClickbaitShield post={post} />}
<PostTags post={post} />
</div>
Expand All @@ -177,6 +185,7 @@ export const ArticleGrid = forwardRef(function ArticleGrid(
isHoveringCard={isHovering}
className={{
image: classNames(
postUiExp && 'px-1',
showFeedback && 'mb-0',
smallCard && ' !my-0 !h-26',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
import { useBookmarkProvider } from '../../../hooks';
import { PostOptionButton } from '../../../features/posts/PostOptionButton';
import type { Post } from '../../../graphql/posts';
import { useFeature } from '../../GrowthBookProvider';
import { featurePostUiImprovements } from '../../../lib/featureManagement';

interface CollectionCardHeaderProps {
post: Post;
Expand All @@ -17,6 +19,7 @@ interface CollectionCardHeaderProps {
export const CollectionCardHeader = ({
post,
}: CollectionCardHeaderProps): ReactElement => {
const postUiExp = useFeature(featurePostUiImprovements);
const {
collectionSources: sources,
numCollectionSources: totalSources,
Expand All @@ -37,7 +40,7 @@ export const CollectionCardHeader = ({
<CollectionPillSources
className={{
main: classNames(
'm-2 mb-1',
postUiExp ? 'mb-1 mt-3' : 'm-2 mb-1',
highlightBookmarkedPost && headerHiddenClassName,
),
}}
Expand Down
Loading