<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eric Mignardi</title>
    <description>The latest articles on DEV Community by Eric Mignardi (@ericmignardi).</description>
    <link>https://dev.to/ericmignardi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2570864%2Fe61216ce-9d93-4aca-97f4-68aebdb564f4.png</url>
      <title>DEV Community: Eric Mignardi</title>
      <link>https://dev.to/ericmignardi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ericmignardi"/>
    <language>en</language>
    <item>
      <title>Day 1: Building a Responsive Website Header - React + Tailwind Setup</title>
      <dc:creator>Eric Mignardi</dc:creator>
      <pubDate>Mon, 14 Jul 2025 18:55:10 +0000</pubDate>
      <link>https://dev.to/ericmignardi/day-1-building-a-responsive-website-header-react-tailwind-setup-2f8f</link>
      <guid>https://dev.to/ericmignardi/day-1-building-a-responsive-website-header-react-tailwind-setup-2f8f</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This week, I'm building a full-featured fitness website for a fictional company called &lt;strong&gt;Zenith&lt;/strong&gt;. The purpose of this project is to strengthen my front-end development skills by building and deploying a complete site, adding one key feature each day. My goal is to practice and become deeply proficient in the core web technologies—&lt;strong&gt;HTML&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, and &lt;strong&gt;JavaScript&lt;/strong&gt;—and to build modular, interactive UIs using &lt;strong&gt;React&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To speed up my workflow and maintain a consistent design system, I’m using &lt;strong&gt;TailwindCSS&lt;/strong&gt;. Its mobile-first utility classes make building responsive interfaces faster and more intuitive. To add animations and interactivity, I’m integrating &lt;strong&gt;Framer Motion&lt;/strong&gt;, which pairs nicely with React. Deployment will be handled through &lt;strong&gt;Render&lt;/strong&gt;, which offers a generous free tier for personal projects.&lt;/p&gt;

&lt;p&gt;This blog series will serve as a daily log of what I built, the decisions I made, the challenges I faced, and lessons learned. I'm also using this as an opportunity to improve my technical writing and communication—two crucial soft skills in any developer’s toolkit.&lt;/p&gt;




&lt;h3&gt;
  
  
  Project Setup
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Why I Chose Vite Over Create React App
&lt;/h4&gt;

&lt;p&gt;I used &lt;strong&gt;Vite&lt;/strong&gt; as my build tool instead of Create React App. Vite offers faster development times through its instant server start and hot module replacement. It's also lighter and more modular, making it ideal for small-to-medium React projects. The Vite setup process was fast and clean, and it generated the necessary folders (&lt;code&gt;src&lt;/code&gt;, &lt;code&gt;public&lt;/code&gt;, etc.) and config files (&lt;code&gt;vite.config.js&lt;/code&gt;, &lt;code&gt;index.html&lt;/code&gt;).&lt;/p&gt;

&lt;h4&gt;
  
  
  Dependencies and Configuration
&lt;/h4&gt;

&lt;p&gt;I installed the following packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TailwindCSS&lt;/strong&gt; for styling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framer Motion&lt;/strong&gt; for animations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React Icons&lt;/strong&gt; for vector-based icons&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Fonts&lt;/strong&gt; (Inter) for typography&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tailwind required some setup in &lt;code&gt;tailwind.config.js&lt;/code&gt; and &lt;code&gt;index.css&lt;/code&gt;, but having done this before, I found it fairly straightforward.&lt;/p&gt;

&lt;h4&gt;
  
  
  Folder Structure
&lt;/h4&gt;

&lt;p&gt;After running &lt;code&gt;npm create vite@latest&lt;/code&gt;, I created a &lt;code&gt;components&lt;/code&gt; folder inside &lt;code&gt;src&lt;/code&gt; to keep my project organized. If I were building a multi-page app, I’d also include folders like &lt;code&gt;pages/&lt;/code&gt; or &lt;code&gt;contexts/&lt;/code&gt;. Since this is a single-page application, I opted not to use React Router to avoid unnecessary bloat.&lt;/p&gt;

&lt;p&gt;I also pre-planned the component architecture with help from Claude.ai. The following components will be used across the site:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Header&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Hero&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Services&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Pricing&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Trainers&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Testimonials&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Contact&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Footer&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Header Component
&lt;/h3&gt;

&lt;p&gt;Today’s focus was building the &lt;code&gt;Header&lt;/code&gt; component. It includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zenith’s logo&lt;/li&gt;
&lt;li&gt;Desktop and mobile navigation&lt;/li&gt;
&lt;li&gt;A call-to-action (CTA) button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I rendered the &lt;code&gt;Header&lt;/code&gt; as the first element in &lt;code&gt;App.jsx&lt;/code&gt;. The component includes semantic HTML, mobile-first responsive design using Flexbox, and React state management.&lt;/p&gt;




&lt;h3&gt;
  
  
  Responsive Navigation Strategy
&lt;/h3&gt;

&lt;p&gt;I took a &lt;strong&gt;mobile-first&lt;/strong&gt; approach. In TailwindCSS, you start with base styles and layer on changes at breakpoints (&lt;code&gt;md:&lt;/code&gt;, &lt;code&gt;lg:&lt;/code&gt;, etc.).&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;desktop nav&lt;/strong&gt; is hidden by default and becomes visible (&lt;code&gt;flex&lt;/code&gt;) at the &lt;code&gt;lg&lt;/code&gt; breakpoint (1024px).&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;menu toggle button&lt;/strong&gt; is only visible below &lt;code&gt;lg&lt;/code&gt;, ensuring a clean layout on larger screens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach keeps things focused and manageable on smaller screens, where space is limited, and then progressively enhances the UI for larger devices.&lt;/p&gt;




&lt;h3&gt;
  
  
  State Management Approach
&lt;/h3&gt;

&lt;p&gt;I used React's &lt;code&gt;useState&lt;/code&gt; hook for two key pieces of state:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Active Tab&lt;/strong&gt;: Tracks which nav link is currently active. Initially set to &lt;code&gt;"home"&lt;/code&gt;. When a link is clicked, &lt;code&gt;setActiveTab()&lt;/code&gt; updates the state, which applies a visual style (e.g., background color) to highlight the active tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mobile Menu Toggle&lt;/strong&gt;: Tracks whether the mobile menu is open. Toggling &lt;code&gt;mobileToggle&lt;/code&gt; from &lt;code&gt;false&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; (and back) determines the visibility of the menu.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;home&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mobileToggle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMobileToggle&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;navItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;
    &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`text-base font-semibold rounded-full px-4 py-2 &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;
      &lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bg-gray-200 flex items-center gap-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;))}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Accessibility Considerations
&lt;/h3&gt;

&lt;p&gt;Accessibility is essential. I used semantic HTML where appropriate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt; for the main site heading&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; for navigation areas&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; for all interactive elements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For screen reader compatibility, I added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;aria-label&lt;/code&gt; attributes to nav buttons&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aria-expanded&lt;/code&gt; to toggle buttons to indicate menu state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These additions help users with assistive technologies better understand the app structure.&lt;/p&gt;




&lt;h3&gt;
  
  
  Code Organization
&lt;/h3&gt;

&lt;p&gt;Using Vite helped keep the project structure clean. I used a dedicated &lt;code&gt;components/&lt;/code&gt; folder to separate concerns. For a larger project, I would create additional folders like &lt;code&gt;hooks/&lt;/code&gt;, &lt;code&gt;contexts/&lt;/code&gt;, and &lt;code&gt;utils/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I also used the &lt;strong&gt;ES7+ React/Redux/React-Native Snippets&lt;/strong&gt; VS Code extension to scaffold components quickly using &lt;code&gt;rafce&lt;/code&gt; (React Arrow Function Component Export).&lt;/p&gt;




&lt;h3&gt;
  
  
  Challenges Faced
&lt;/h3&gt;

&lt;p&gt;Here are a few pain points I encountered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Z-Index Conflicts&lt;/strong&gt;: I struggled to keep the mobile menu toggle button visible above the menu overlay due to conflicting stacking contexts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Positioning Confusion&lt;/strong&gt;: Debated using &lt;code&gt;fixed&lt;/code&gt; vs &lt;code&gt;sticky&lt;/code&gt; headers, and whether to place the mobile menu inside or outside the main &lt;code&gt;header&lt;/code&gt; element.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CTA Design on Mobile&lt;/strong&gt;: I wasn’t satisfied with the look or placement of the CTA in the mobile menu. This is an area I plan to revisit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm learning a lot about layout strategies, relative/absolute positioning, spacing, and responsiveness. These concepts aren’t second nature yet—but they will be with practice.&lt;/p&gt;




&lt;h3&gt;
  
  
  Refactoring Lessons
&lt;/h3&gt;

&lt;p&gt;One big win was learning to &lt;strong&gt;DRY&lt;/strong&gt; (Don't Repeat Yourself) my navigation links.&lt;/p&gt;

&lt;p&gt;Initially, I wrote out each &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag separately, which caused code repetition. Refactoring with a &lt;code&gt;navItems&lt;/code&gt; array and &lt;code&gt;.map()&lt;/code&gt; reduced my nav code from over 40 lines to just 14.&lt;/p&gt;

&lt;p&gt;This improved maintainability and keeps the structure clean as the site grows.&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Day 1 was a solid start. I set up my development environment with Vite, built a responsive and accessible header, managed React state effectively, and refactored repetitive code.&lt;/p&gt;

&lt;p&gt;I’m excited to build on this foundation throughout the week. Tomorrow’s focus: the &lt;strong&gt;Hero section&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/ericmignardi/zenith-site" rel="noopener noreferrer"&gt;Zenith Fitness Website GitHub Repo&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;TailwindCSS Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.framer.com/motion/" rel="noopener noreferrer"&gt;Framer Motion Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>webdev</category>
      <category>react</category>
      <category>tailwindcss</category>
      <category>motion</category>
    </item>
  </channel>
</rss>
