Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 6 additions & 4 deletions apps/the_monkeys/src/app/blog/components/BlogReactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const BlogReactionsContainer = ({
<div className='flex-1 px-[14px] py-[6px] bg-foreground-light/80 dark:bg-foreground-dark/80 backdrop-blur-sm rounded-full shadow-sm ring-1 ring-border-light dark:ring-border-dark'>
<BlogReactions blogId={blogId} />
</div>

<div
className={twMerge(
'shrink-0 px-[10px] py-[6px] bg-alert-red/60 backdrop-blur-sm rounded-full shadow-sm ring-1 ring-alert-red',
Expand All @@ -76,9 +75,12 @@ export const BlogReactionsContainer = ({
>
{blogId && <BlogReportDialog size={24} blogId={blogId} />}
</div>

<div className='shrink-0 px-[10px] py-[6px] bg-foreground-light/80 dark:bg-foreground-dark/80 backdrop-blur-sm rounded-full shadow-sm ring-1 ring-border-light dark:ring-border-dark'>
<BlogShareDialog blogURL={url} size={20} />
<div className='shrink-0'>
<BlogShareDialog
blogURL={url}
size={20}
triggerClassName='px-[10px] py-[6px] bg-foreground-light/80 dark:bg-foreground-dark/80 backdrop-blur-sm rounded-full shadow-sm ring-1 ring-border-light dark:ring-border-dark hover:bg-foreground-light dark:hover:bg-foreground-dark hover:ring-brand-orange/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-orange'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we really need this many tailwind properties here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Most of these classes are not required for the click functionality. They are needed only to preserve the existing pill appearance and add clearer hover/focus feedback.

So, the full list is not strictly required, but the padding, background, rounded shape, and hover/focus styles should remain to keep the intended design and UX.

SO what should i do with them lmk.
I feel it looks fine tho.

/>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ import {
DialogTrigger,
} from '@the-monkeys/ui/atoms/dialog';
import { toast } from '@the-monkeys/ui/hooks/use-toast';
import { twMerge } from 'tailwind-merge';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why did we import twmerge here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

the twMerge is used so the default button classes and the caller-provided triggerClassName can safely be combined. It resolves conflicting Tailwind utilities such as:

'p-1' and: 'px-[10px] py-[6px]'

Without twmerge, both classes may remain in the final class string, and the resulting styling can depend on Tailwind’s generated CSS order. twMerge ensures the custom trigger styles correctly override the defaults.


interface BlogShareDialogProps {
blogURL: string;
size?: number;
triggerClassName?: string;
}

export const BlogShareDialog: FC<BlogShareDialogProps> = ({
blogURL,
size = 18,
triggerClassName,
}) => {
const copyToClipboard = () => {
if (navigator.clipboard) {
Expand All @@ -49,7 +52,10 @@ export const BlogShareDialog: FC<BlogShareDialogProps> = ({
<Dialog>
<DialogTrigger asChild>
<button
className='p-1 flex items-center justify-center cursor-pointer opacity-80 hover:opacity-100'
className={twMerge(
'p-1 flex items-center justify-center cursor-pointer opacity-80 hover:opacity-100 transition-colors',
triggerClassName
)}
title='Share Blog'
>
<Icon name='RiShare' size={size} />
Expand Down