Skip to content

feat: add ShareButton component and sonner(Snackbar for notify users)#126

Open
AnitusA wants to merge 4 commits into
sunithvs:mainfrom
AnitusA:main
Open

feat: add ShareButton component and sonner(Snackbar for notify users)#126
AnitusA wants to merge 4 commits into
sunithvs:mainfrom
AnitusA:main

Conversation

@AnitusA

@AnitusA AnitusA commented Jun 16, 2026

Copy link
Copy Markdown

📝 Description

This PR introduces a native sharing feature for developer portfolios.

✨ New Features

  • Share Button Component: Added a new ShareButton in the profile section.
    • Uses the Web Share API for native mobile sharing.
    • Provides a Copy to Clipboard fallback for desktops.
  • Snackbar Notifications: Integrated sonner to provide visual feedback ("Link Copied") when sharing, positioned at the bottom-center for better UX.

🛠️ Bug Fixes & Improvements

  • Syntax & Imports: Fixed a parsing error in ProfileSection.tsx and ensured all new components (Toaster, ShareButton, toast) are correctly imported.

🚀 Technical Changes

  • Installed sonner for toast notifications.
  • Added www/components/ShareButton.tsx.
  • Updated www/app/layout.tsx with the global Toaster provider.

📸 UI Changes

  • New "Share" icon button added next to the "Download Resume" button.
  • Neon-green themed toast notification appears at the bottom-center upon successful copy.

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

@AnitusA is attempting to deploy a commit to the lamsta Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new ShareButton component that allows users to share a developer portfolio using the Web Share API, falling back to copying the link to the clipboard if the API is unsupported. It also integrates the sonner library for toast notifications. The review feedback focuses on improving the implementation of the ShareButton component. Key recommendations include managing the clipboard copy timeout within a useEffect hook to prevent memory leaks, simplifying the Web Share API check to avoid unnecessary fallbacks, handling expected AbortError exceptions gracefully, and refactoring styles and prop types for better maintainability and adherence to Tailwind CSS best practices.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread www/components/ShareButton.tsx Outdated
Comment thread www/components/ShareButton.tsx
Comment thread www/components/ShareButton.tsx Outdated
Comment thread www/components/ShareButton.tsx
TooltipTrigger,
} from "@/components/ui/tooltip";

export default function ShareButton({ username }: { username: string }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better readability and maintainability, it's a good practice to define component props using an interface or a type alias instead of an inline type.

interface ShareButtonProps {
  username: string;
}

export default function ShareButton({ username }: ShareButtonProps) {

Comment on lines +25 to +27
} catch (err) {
console.error("Error sharing:", err);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When using navigator.share, if the user cancels the share dialog, it throws a DOMException with the name AbortError. This is expected user behavior and not a technical error, so it shouldn't be logged to the console to avoid unnecessary noise.

Suggested change
} catch (err) {
console.error("Error sharing:", err);
}
} catch (err) {
if (!(err instanceof DOMException && err.name === "AbortError")) {
console.error("Error sharing:", err);
}
}

Comment thread www/components/ShareButton.tsx
Comment thread www/components/ShareButton.tsx Outdated
AnitusA and others added 3 commits June 17, 2026 02:32
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@AnitusA

AnitusA commented Jun 16, 2026

Copy link
Copy Markdown
Author

Desktop view:

screenshot-2026-06-17_01-43-04

Mobile view:

screenshot-2026-06-17_01-43-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant