This is a solution to the URL shortening API landing page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the site depending on their device's screen size.
- Shorten any valid URL.
- See a list of their shortened links, even after refreshing the browser.
- Copy the shortened link to their clipboard in a single click.
- Receive an error message when the
form
is submitted if:- The
input
field is empty. - The submitted URL has already been shortened.
- The submitted URL is a previously generated shortened link.
- The
- Solution URL: https://www.frontendmentor.io/solutions/shortly-url-shortening-api-challenge-solution-myO-hSXI8M
- Live Site URL: https://sus-gshukla.vercel.app
- Semantic JSX markup
- Flexbox
- CSS Grid
- Mobile-first workflow
- React - JS library
- Next.js - React framework
- TypeScript - JavaScript with syntax for types
- Tailwind CSS - CSS framework
- Shadcn UI - Open-source component library
- Radix UI - Accessible component primitives
- Spoo.me API - API for URL shortening
- pnpm - Fast, disk space efficient package manager
This project enhanced my understanding of several key concepts, including:
- Ensuring type safety and improving code reliability through TypeScript.
- Leveraging Shadcn UI to create a reusable and maintainable component library.
- Utilizing the
cn
utility function to apply conditional classes efficiently in Tailwind CSS. - Implementing SVG icons as React components to enable dynamic property modifications, such as hover states.
- Employing the
localStorage
object to persist shortened URLs as key-value pairs in the browser.
In future projects, I intend to focus on the following areas for improvement:
- Establishing a centralized constants directory to streamline content management and enhance project organization.
- Tailwind CSS GitHub Repository - This resource provided inspiration on integrating SVG icons as React components, enhancing interactivity.
- cn() - Every Tailwind Coder Needs It (clsx + twMerge) - This video by Wesley on the ByteGrad YouTube channel offered practical guidance on the
cn
utility function, combiningclsx
andtailwind-merge
for efficient class management.
- Website - Gaurav Shukla
- Frontend Mentor - @heygauravshukla
- X - @heygauravshukla