HE
heygauravshukla/shortly-url-shortener
A URL shortener web application built with Next.js, TypeScript and Tailwind CSS.
URL shortening API landing page
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.
Table of contents
Overview
The challenge
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
formis submitted if:- The
inputfield is empty. - The submitted URL has already been shortened.
- The submitted URL is a previously generated shortened link.
- The
Screenshot
Links
- Solution URL: https://www.frontendmentor.io/solutions/shortly-url-shortening-api-challenge-solution-myO-hSXI8M
- Live Site URL: https://sus-gshukla.vercel.app
My process
Built with
- 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
What I learned
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
cnutility 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
localStorageobject to persist shortened URLs as key-value pairs in the browser.
Continued development
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.
Useful resources
- 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
cnutility function, combiningclsxandtailwind-mergefor efficient class management.
Author
- Website - Gaurav Shukla
- Frontend Mentor - @heygauravshukla
- X - @heygauravshukla
