Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/components/StoreReview/MainTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface MainTagProps {
const MainTag: React.FC<MainTagProps> = ({ text, onClick, rounded }) => {
const TagElement = onClick ? 'button' : 'span';
const baseClasses =
'inline-flex w-fit whitespace-nowrap items-center h-[24px] bg-[#F4F6F8] text-black-500 border-[1.5px] border-[#65CE58] text-body-md-description px-[12px] py-[6px]';
'inline-flex w-fit whitespace-nowrap justify-center h-[24px] bg-[#F4F6F8] leading-[24px] text-black-500 border-[1.5px] border-[#65CE58] text-body-md-description px-[12px]';
const roundedClass = rounded || 'rounded-[12px]';

return (
Expand Down
26 changes: 9 additions & 17 deletions src/hooks/useShare.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
// useShare.ts
import { useCallback } from 'react';

type ShareOpts = {
title?: string;
text?: string;
url?: string;
};

export const useShare = (defaults?: ShareOpts) => {
const share = useCallback(async (opts?: ShareOpts) => {
const merged = { ...defaults, ...opts };
const shareData: ShareData = {};
if (merged.title) shareData.title = merged.title;
if (merged.text) shareData.text = merged.text;
shareData.url = merged.url ?? window.location.href;
export const useShare = () => {
const share = useCallback(async () => {
const shareData = {
title: 'kkinicong',
url: window.location.href,
};

try {
if (navigator.share) {
Expand All @@ -24,13 +16,13 @@ export const useShare = (defaults?: ShareOpts) => {
}
} catch {
try {
await navigator.clipboard.writeText(shareData.url!);
await navigator.clipboard.writeText(shareData.url);
alert('클립보드에 링크가 복사되었습니다.');
} catch (err) {
console.error(err);
}
}
}, [defaults]);
}, []);

return { share };
};
};
8 changes: 1 addition & 7 deletions src/pages/community/CommunityPostDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import useCommentActions from '@/hooks/useCommentActions';
import DeleteModal from '@/components/common/DeleteModal';
import ConfirmToast from '@/components/common/ConfirmToast';
import { createPortal } from 'react-dom';
import { Helmet } from 'react-helmet-async';

interface Comment {
commentId: number;
Expand Down Expand Up @@ -241,12 +240,7 @@ const CommunityPostDetailPage = () => {
</div>
<img
src={ShareIcon}
onClick={() =>
share({

url: `${location.origin}/post/${post.communityPostId}`,
})
}
onClick={share}
className="w-[18px] h-[18px] cursor-pointer"
/>
</div>
Expand Down