Loading Light/Dark Toggle

All Articles đź“ť

Two Different Types of Frontend Developers 🙌🏻

Frontend development is a broad field, but developers often fall into two distinct categories based on their approach and understanding of the technology. Let’s dive into these two types of frontend developers and explore the key differences.

1. The Implementer

The first type of frontend developer views their role primarily as taking designs from platforms like Figma and translating them into code using popular JavaScript libraries or frameworks such as React, Angular, or Vue.js. This developer focuses on implementing the visual aspects of a project, making sure that the application looks and feels exactly like the design. They are skilled at using pre-built components, styling tools, and libraries to bring designs to life efficiently.

However, this developer might lack a deep understanding of how things work behind the scenes. They might be excellent at crafting user interfaces, but their knowledge often stops at implementation. They don’t necessarily dive into how the framework operates internally, and while they can create functional and attractive applications, their ability to solve complex problems or optimize performance might be limited.

2. The Informed Developer

The second type of frontend developer also starts by implementing designs, but with a deeper approach. This developer not only knows how to use the tools but also understands how they work under the hood. For example, if they’re using Angular, they can explain how change detection works, how the framework’s internal processes function, and how to read and comprehend the open-source code of the framework. They don't just follow best practices—they understand why they are best practices.

This deeper knowledge comes with experience and a commitment to continuous learning. The informed developer can debug complex issues, build custom solutions, and contribute to open-source projects. They often push the boundaries of what’s possible in frontend development, crafting highly optimized, maintainable, and scalable solutions.

The Path of Seniority and Experience

Becoming the second type of developer often takes years of experience and a willingness to dive deep into the technology stack. It’s a choice each developer makes: to remain comfortable with implementation or to strive for a deeper understanding of the tools they use. Surprisingly, many developers with over five years of experience may still not fully grasp how the frameworks they work with operate internally.

Conclusion

Ultimately, each developer chooses their path. Both types have strengths, but understanding how tools work under the hood elevates problem-solving and innovation. It’s about more than just coding—it’s about mastering your craft.

Read Article →

Frontend Development More Than Just Converting Design to Code

Many people starting their frontend development journey often think it's just about converting design into code. While that's an essential part of the job, it's only the tip of the iceberg. Let me explain more.

  • Frontend developers are responsible for ensuring the interface is not only visually appealing but also user-friendly.

  • Discuss the importance of empathy in design, understanding user needs, and making sure the application is intuitive.

  • Beyond the visuals, frontend developers need to ensure the application is fast and responsive.

  • Mention how decisions around loading times, image optimization, and script management impact user experience.

  • Accessibility is a key responsibility. Ensuring the web is usable for everyone, including people with disabilities, is a significant part of the job.

  • ARIA roles, semantic HTML, and other techniques that help make web applications more inclusive.

  • Frontend developers must ensure that applications work seamlessly across different devices and browsers.

  • Discuss the challenges and solutions around media queries, responsive layouts, and cross-browser testing.

  • Frontend developers often manage complex state and data interactions, especially in modern SPAs.

  • Frontend developers also need to be mindful of security. Discuss aspects like XSS prevention, handling user input, and protecting sensitive information.

  • Emphasize the importance of communication and collaboration with designers and backend developers.

  • How understanding the design intent and backend constraints helps create a seamless user experience.

  • Frontend developers often act as a bridge between design and functionality.

Frontend development is a multifaceted discipline that goes beyond just converting design into code. It requires a blend of creative and technical skills, along with a deep understanding of users needs. To excel in frontend development, one must embrace all aspects of the craft—from design to performance optimization, accessibility, and collaboration.

Happy Coding đź’»!

Read Article →

How to generate dynamic OG image with NextJs

Introduction

An Open Graph image or OG image is the image that is displayed on social media accounts when you or someone else post a link to an article or a video from your website.

Steps

Step 1: Add image inside public folder that has empty space og-bg.jpg

background-image

Step 2: Create new folder inside app directory and name it OG then create route.tsx (jsx) file

import { ImageResponse } from 'next/og';
import { NextRequest } from 'next/server';

export const runtime = 'edge';

export async function GET(req: NextRequest) {
  const { searchParams } = req.nextUrl;
  const postTitle = searchParams.get('title');

  return new ImageResponse(
    (
      <div
        style={{
          height: '100%',
          width: '100%',
          display: 'flex',
          flexDirection: 'column',  
          alignItems: 'flex-start',
          justifyContent: 'center',
          backgroundImage: 'url(http://localhost:3000/og-bg.jpg)',
        }}
      >
        <div
          style={{
            marginLeft: 190,
            marginRight: 190,
            display: 'flex',
            fontSize: 130,
            letterSpacing: '-0.05em',
            fontStyle: 'normal',
            color: 'white',
            lineHeight: '120px',
            whiteSpace: 'pre-wrap',
          }}
        >
          {postTitle}
        </div>
      </div>
    ),
    {
      width: 1920,
      height: 1080,
    }
  );
}

The Result http://localhost:3000/og?title=HelloWorld

background-image

Then you can use it in generateMetaData function

export const generateMetadata = ({ params }: ArticleProps) => {
  const post = allPosts.find((post) => post._raw.flattenedPath === params.slug);
  if (!post) notFound();

  let { title, date: publishedTime, summary: description } = post;
  let ogImage = `/og?title=${title}`;

  return {
    title,
    description,
    alternates: {
      canonical: `/articles/${post._raw.flattenedPath}`,
    },
    openGraph: {
      title,
      description,
      type: "article",
      publishedTime,
      url: `/articles/${post._raw.flattenedPath}`,
      images: [
        {
          url: ogImage,
          alt: post.title,
        },
      ],
    },
    twitter: {
      card: "summary_large_image",
      title,
      description,
      images: [ogImage],
    },
  };
};

Happy coding, Check my GitHub repo

Read Article →

The Best React UI Libraries for Your Projects

Hey there, fellow developers! Are you diving into the world of React and seeking the perfect UI library to streamline your projects? Well, you're in luck! React has a vibrant ecosystem of UI libraries that can make your development journey smoother and more efficient. Let's take a closer look at some of the best React UI libraries out there.

1. Shadcn

Shadcn is Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.

2. Material-UI

Material-UI is a popular choice among React developers, and for good reason. It provides a set of beautiful and customizable components based on Google's Material Design guidelines. With Material-UI, you can easily create sleek and modern user interfaces without having to start from scratch. Plus, it offers robust documentation and an active community for support.

3. Ant Design

Ant Design is another fantastic React UI library known for its comprehensive set of components and design principles. Developed by Alibaba, Ant Design follows a cohesive design language and offers a plethora of ready-to-use components for building professional-grade applications. It's highly customizable and comes with a range of themes to suit different project needs.

4. Chakra UI

If you're a fan of simplicity and accessibility, Chakra UI might be the perfect fit for your React projects. This library focuses on providing accessible and reusable components that adhere to the principles of atomic design. With Chakra UI, you can quickly build responsive and accessible interfaces while maintaining consistency and scalability.

5. Semantic UI React

Semantic UI React brings the power of Semantic UI to the React ecosystem, offering a wide range of UI components with intuitive APIs. It promotes clean and readable code by emphasizing the use of human-friendly HTML and CSS class names. Whether you're building a simple website or a complex web application, Semantic UI React can help you achieve your design goals with ease.

6. Tailwind CSS

While not strictly a React UI library, Tailwind CSS deserves a mention for its popularity and versatility. Tailwind CSS provides a utility-first approach to styling, allowing you to quickly create custom designs without writing a lot of CSS code. When combined with React, Tailwind CSS can empower you to build responsive and visually appealing user interfaces with minimal effort.

Conclusion

Choosing the right React UI library can significantly impact your development workflow and the quality of your applications. Whether you prefer the sleekness of Material-UI, the comprehensive nature of Ant Design, the simplicity of Chakra UI, the readability of Semantic UI React, or the versatility of Tailwind CSS, there's a library out there to suit your needs. So go ahead, explore these options, and elevate your React projects to new heights! Happy coding! 🚀

Read Article →

TailwindCSS Tips I Wish I Learned Earlier

Consistent Sizing

When creating square elements or elements with equal height and width, opting for the size class instead of separate height and width classes can enhance readability and maintainability:

{/* Using height and width classes */}
<div className="h-12 w-12 bg-red-300"></div>

{/* Using size class (recommended) */}
<div className="size-12 bg-green-300"></div>

Using Rings in Tailwind CSS

In Tailwind CSS, rings are a powerful feature for enhancing the focus state of interactive elements like buttons. Let's explore how to use rings with a simple example:

<button className="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded focus:ring-2 focus:ring-blue-500">Save Changes</button>

In this example, we have a button styled with Tailwind CSS classes. Here's what each class does:

  • bg-blue-500: Sets the background color of the button to blue.
  • hover:bg-blue-600: Changes the background color to a darker shade of blue when hovered over.
  • text-white: Sets the text color to white.
  • font-bold: Makes the text bold.
  • py-2 px-4: Adds padding to the top and bottom (py) and left and right (px) of the button.
  • rounded: Rounds the corners of the button.

Now, let's focus on the focus:ring-2 and focus:ring-blue-500 classes.

These classes are responsible for adding a ring around the button when it gains focus. The focus:ring-2 class specifies the width of the ring (2 pixels in this case), and focus:ring-blue-500 sets the color of the ring to blue to match the button's color.

By adding these ring classes, users can easily identify which element has focus, providing better accessibility and user experience.

Tailwind CSS makes it simple to enhance the interactivity and usability of your web applications with features like rings. Experiment with different colors and sizes to find the perfect style for your buttons and other interactive elements.

Group

In Tailwind CSS, the group and group-hover utilities are used to apply styles to elements based on their parent's hover state. This is particularly useful for creating interactive components where you want certain elements within a container to change appearance when the container is hovered over.

Let's start with a simple example of a button with a hover effect using group:

<button class="group bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded">
  Save Changes
  <span class="group-hover:underline ml-1">(Hover me!)</span>
</button>

In this example:

  • The group class is applied to the button element.
  • Inside the button, there's a span element with the class group-hover:underline. This means that the text within this span will be underlined when the parent button is hovered over.

Plugins

Extending Tailwind with reusable third-party plugins. Plugins let you register new styles for Tailwind to inject into the user’s stylesheet using JavaScript instead of CSS.

Here some Tailwind CSS plugins for developers

Read Article →

Unveiling the Architecture Behind My Blog

Introduction

In the vast universe of web development, embarking on the journey of creating your own blog can be both exhilarating and daunting. As I ventured into this endeavor, I found myself faced with choices: Which technologies should I leverage? How can I ensure a seamless user experience while maintaining flexibility and scalability?

In this blog post, I'll walk you through the tech stack I meticulously selected for my blog. From the robust framework of Next.js to the intuitive styling of Tailwind CSS, each tool plays a vital role in shaping my digital sanctuary.

The Tech Stack

Next.js: Powering Performance and Flexibility

At the heart of my blog lies Next.js, a React framework renowned for its versatility and performance. Leveraging server-side rendering and static site generation capabilities, Next.js ensures lightning-fast page loads and optimal SEO performance. With its intuitive routing system and built-in support for TypeScript, Next.js empowers me to create dynamic, interactive web experiences with ease.

Tailwind CSS: Streamlining Styling with Utility-First Approach

In the realm of styling, Tailwind CSS reigns supreme with its utility-first approach. By abstracting common design patterns into reusable utility classes, Tailwind CSS accelerates development workflows while promoting consistency and maintainability. From responsive layouts to custom component styling, Tailwind CSS offers unparalleled flexibility, allowing me to bring my design visions to life effortlessly.

Additional Dependencies

  • @radix-ui/react-icons: Providing a vast collection of accessible icons to enhance user interactions.
  • @theme-toggles/react: Enabling seamless theme switching functionality for enhanced user experience.
  • clsx: Simplifying class names management for conditional styling within React components.
  • contentlayer: Facilitating content management and structuring through Markdown-based files.
  • date-fns: Offering a comprehensive suite of date manipulation utilities for dynamic content rendering.
  • hamburger-react: Enhancing navigation UX with customizable hamburger menu components.
  • next-contentlayer: Integrating Markdown-based content with Next.js for streamlined content management.
  • next-themes: Enabling effortless theme management and customization within Next.js applications.
  • react and react-dom: Foundational libraries for building interactive user interfaces within the React ecosystem.
  • tailwind-merge: Enhancing Tailwind CSS with additional utility classes for advanced styling needs.

Development Dependencies

  • @tailwindcss/typography: Augmenting Tailwind CSS with typographic styles for enhanced readability.
  • @types/node, @types/react, @types/react-dom: Providing TypeScript type definitions for seamless integration within the development environment.
  • autoprefixer: Automatically adding vendor prefixes to CSS properties for improved cross-browser compatibility.
  • eslint and eslint-config-next: Enforcing code quality and adherence to best practices within Next.js projects.
  • postcss: Transforming CSS with JavaScript plugins for enhanced functionality and compatibility.
  • tailwindcss: Core library for implementing Tailwind CSS utility classes within the project.
  • typescript: Enabling static type checking and enhanced developer tooling for JavaScript projects.

Conclusion

In the ever-evolving landscape of web development, selecting the right tech stack is paramount to the success of any project. With Next.js providing unparalleled performance and flexibility, and Tailwind CSS streamlining styling workflows, my blog is poised to deliver an immersive and engaging user experience.

As I continue to refine and expand upon my blog, I'm excited to explore the endless possibilities offered by these technologies. Stay tuned for future updates as I share insights, tips, and lessons learned along the way.

Happy coding, and may your digital endeavors be as fulfilling as mine!

Read Article →

The Art of Cardistry Elevating Playing Cards to a Visual Symphony

Introduction

In the world of magic and entertainment, cardistry stands as a mesmerizing art form that transcends the traditional use of playing cards. It's not just about shuffling or performing tricks; it's a graceful choreography of intricate movements, skillfully executed to create captivating visual displays. In this blog post, we'll delve into the captivating realm of cardistry, exploring its origins, techniques, and the vibrant community that surrounds it.

Origins and Evolution

Cardistry traces its roots back to the early 20th century, emerging alongside the flourishing art of magic. Magicians and sleight-of-hand artists began experimenting with card flourishes and displays as a means of enhancing their performances. Over time, these flourishes evolved into a distinct art form, characterized by its emphasis on aesthetics and visual appeal.

In the 1990s, pioneers like Brian Tudor and De'vo Vom Schattenreich pushed the boundaries of cardistry, introducing innovative moves and techniques that captivated audiences worldwide. With the advent of the internet and social media, cardistry experienced a renaissance, as enthusiasts from around the globe connected and shared their passion for this mesmerizing art form.

Techniques and Moves

At the core of cardistry lies a repertoire of techniques and moves, each requiring precision, dexterity, and hours of practice to master. From the elegant cascade of a riffle shuffle to the intricate fan of a deck spread, cardists employ a diverse array of moves to create stunning visual effects. Some of the most iconic techniques include:

  • Charlier Cut: A fundamental one-handed cut where a packet of cards is rotated using the thumb.
  • Sybil Cut: A complex series of cuts and displays that create a mesmerizing cascade effect.
  • Spring: A dynamic move where cards are released from one hand and cascade down in a fluid motion.
  • Card Fan: A display where cards are fanned out in a semicircle, showcasing the vibrant colors and patterns of the deck.

Community and Culture

Beyond the technical aspects, cardistry is a vibrant and inclusive community that celebrates creativity, collaboration, and self-expression. Online forums, social media platforms, and dedicated gatherings provide avenues for cardists to connect, share ideas, and inspire one another. Whether it's attending a cardistry convention, participating in online challenges, or simply sharing a new move on Instagram, enthusiasts find camaraderie and support within the global cardistry community.

Conclusion

In a world filled with digital distractions, cardistry offers a refreshing escape into the realm of analog artistry. Through its elegant movements and mesmerizing displays, it reminds us of the beauty and wonder that can be found in the simplest of objects. As you embark on your own journey into the world of cardistry, remember that patience, practice, and passion are the keys to unlocking its true potential. So pick up a deck, let your creativity flow, and prepare to be amazed by the endless possibilities that lie within the humble playing card.

Happy flourishing!

Read Article →

Dai Vernon

Magic, as an art form, has its luminaries, those whose names resonate through the ages, leaving an indelible mark on the world of illusion. Among these titans stands Dai Vernon, a master conjurer whose innovations and contributions have shaped modern magic in profound ways.

Born in Ottawa, Canada, in 1894, Dai Vernon, also known as "The Professor," embarked on a lifelong journey dedicated to the pursuit of magic. His fascination with sleight of hand and illusion led him to study under some of the greatest magicians of his time, honing his skills and refining his craft to perfection.

Vernon's impact on the world of magic is immeasurable, with his influence felt across generations of magicians. His relentless pursuit of perfection and his unwavering dedication to his art set him apart as a true visionary in the realm of illusion.

The Magic of Dai Vernon

One of Vernon's most celebrated contributions to magic is his mastery of sleight of hand. His hands were renowned for their dexterity and precision, capable of executing seemingly impossible maneuvers with effortless grace. From the legendary "Ambitious Card" routine to the elusive "Triumph" effect, Vernon's sleight of hand prowess knew no bounds.

But Vernon's genius extended far beyond mere technical skill. He was a masterful storyteller, weaving narratives of mystery and wonder that captivated audiences around the world. His performances were not just displays of skill, but journeys into realms of enchantment and intrigue.

The Vernon Touch

What truly set Dai Vernon apart was his relentless pursuit of perfection. He was a perfectionist in every sense of the word, constantly refining and perfecting his techniques to achieve the impossible. His quest for mastery knew no bounds, inspiring generations of magicians to push the boundaries of their own creativity and skill.

Vernon's impact on magic is perhaps best encapsulated by his famous quote: "In magic, today as always, the effect is what counts. The method should be subservient to the effect." For Vernon, magic was not just about fooling the eye; it was about creating moments of wonder and astonishment that lingered in the minds of audiences long after the performance had ended.

A Legacy of Inspiration

Though Dai Vernon may have passed from this world, his legacy lives on in the hearts and minds of magicians everywhere. His contributions to the art of magic continue to inspire and influence countless performers, reminding us that true magic lies not in the hands, but in the imagination and spirit of those who dare to dream.

In the pantheon of magical greats, Dai Vernon stands as a beacon of innovation and inspiration, a testament to the enduring power of the human spirit to create wonder and enchantment in the world. As we continue to marvel at the mysteries of magic, let us never forget the indelible mark left by "The Professor" himself.

Read Article →

All rights reserved © Yassine Haimouch 2024