<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abiodun Ajiboye on Medium]]></title>
        <description><![CDATA[Stories by Abiodun Ajiboye on Medium]]></description>
        <link>https://medium.com/@abiodunjayb?source=rss-d93d3296a3a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PJKBmX6EydR32HzWr2pqSw@2x.jpeg</url>
            <title>Stories by Abiodun Ajiboye on Medium</title>
            <link>https://medium.com/@abiodunjayb?source=rss-d93d3296a3a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:26:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abiodunjayb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Being Blocked by Backend Development: Why Frontend Developers Shouldn’t Have to Wait for Deployment…]]></title>
            <link>https://medium.com/@abiodunjayb/being-blocked-by-backend-development-why-frontend-developers-shouldnt-have-to-wait-for-deployment-695815bb55f8?source=rss-d93d3296a3a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/695815bb55f8</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend-engineering]]></category>
            <category><![CDATA[api-design]]></category>
            <dc:creator><![CDATA[Abiodun Ajiboye]]></dc:creator>
            <pubDate>Wed, 11 Nov 2026 12:18:07 GMT</pubDate>
            <atom:updated>2026-11-11T12:18:07.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>Being Blocked by Backend Development: Why Frontend Developers Shouldn’t Have to Wait for Deployment to Start Integrating</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7L-uSQpSXgVPIazA7lSLXw.png" /><figcaption>Frontend and backend can build in parallel.</figcaption></figure><p>One thing I’ve experienced as a frontend developer is being ready to integrate a feature but having to put everything on hold because the backend isn’t ready.</p><p>Sometimes, it’s a deployment issue. Other times, the API documentation isn’t accessible, the endpoints aren’t available, or there’s simply nothing concrete to work with yet.</p><p>And while I understand that backend development comes with its own complexities, deployment challenges, and dependencies, I’ve started questioning something:</p><p><strong>Does the frontend really have to wait until the backend is fully deployed before integration work can begin?</strong></p><p>For a while, I treated this as one of those things that simply came with working in a team. The backend developer was still working, deployment wasn’t ready, and there wasn’t much I could do until everything was available.</p><p>But lately, my interaction with backend development and programming languages has changed how I look at this problem.</p><h4>The problem isn’t always that the backend isn’t ready</h4><p>Let’s say I’m working on a feature that requires data from a backend service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fn08sgfFWSrdEX3CjF-4oA.png" /><figcaption>What a frontend developer needs before integrating.</figcaption></figure><p>As a frontend developer, I need to understand things like:</p><ul><li>What endpoints are available?</li><li>What does each endpoint expect?</li><li>What does the response look like?</li><li>Which fields are required or optional?</li><li>What happens when a request fails?</li><li>What authentication or authorization requirements exist?</li></ul><p>I don’t necessarily need the entire backend implementation to be completed before I can start working with these details.</p><p>I need an understanding of the interface through which the frontend and backend will communicate.</p><p>Unfortunately, there have been situations where even accessing the documentation explaining how the backend works becomes difficult because the backend developer is still dealing with implementation or deployment issues.</p><p>This creates an unnecessary dependency.</p><p>The frontend developer is ready to build, but progress becomes tied to something that doesn’t necessarily need to be a blocker.</p><h4>Then I started looking at backend development differently</h4><p>Recently, as I’ve started interacting more with backend languages and understanding how backend applications are structured, something became clearer to me.</p><p>There was a way this could have been handled differently.</p><p>Even if the backend wasn’t fully implemented or deployed, the backend developer could have provided an API contract.</p><p>Something that clearly defines:</p><ul><li>Available endpoints and their HTTP methods.</li><li>Expected request parameters and payloads.</li><li>Response structures and data types.</li><li>Required and optional fields.</li><li>Expected error responses.</li><li>Authentication requirements.</li></ul><p>For example, if I’m building a frontend feature that retrieves a list of courses, I don’t necessarily need the actual endpoint to be live before I can start.</p><p>I can work with an agreed contract that tells me something like:</p><p>GET /api/courses</p><p>And defines the expected response:</p><pre>{<br>  &quot;data&quot;: [<br>    {<br>      &quot;id&quot;: &quot;course-001&quot;,<br>      &quot;title&quot;: &quot;Introduction to Programming&quot;,<br>      &quot;level&quot;: &quot;beginner&quot;,<br>      &quot;duration&quot;: 8<br>    }<br>  ],<br>  &quot;totalCount&quot;: 1,<br>  &quot;page&quot;: 1,<br>  &quot;pageSize&quot;: 10<br>}</pre><p>With this information, I can start building the frontend around the expected data structure.</p><p>I can create TypeScript interfaces, prepare my API service functions, handle loading and error states, build components, and even use mock data to simulate responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5SgjiVfNLeg9kHH_cb8fvQ.png" /><figcaption>One agreed contract gives the frontend a head start.</figcaption></figure><p>The actual backend implementation might still be in progress. The endpoint might not even be accessible until deployment is completed.</p><p>But I’m no longer completely blocked.</p><p>Once the endpoint becomes available, I can connect the implementation to the actual service, verify the response against the contract, and resolve any discrepancies.</p><p>Of course, this requires both developers to agree on the contract and communicate when it changes.</p><h4>Something else caught my attention</h4><p>What I found even more interesting was that the things required to create this contract aren’t really additional work that backend developers should have to do just to accommodate frontend developers.</p><p>They are fundamental parts of structuring a backend application in the first place.</p><p>Defining routes, request and response models, data types, validation rules, and expected behaviour are all important parts of building a maintainable backend system.</p><p>These decisions help establish the structure of the application before the implementation gets deeper.</p><p>They also make life easier for the backend developer.</p><p>Instead of constantly explaining how an endpoint works or answering questions about expected payloads, there’s a documented reference that everyone can work with.</p><p>It also becomes valuable when another developer joins the project or takes over the codebase in the future.</p><p>They don’t have to depend entirely on conversations with the original developer to understand how the system is supposed to work.</p><p>There’s already a documented agreement.</p><p>This is where tools and approaches like OpenAPI/Swagger, API specifications, typed request and response models, and mock servers become particularly useful.</p><p>They help turn assumptions into something concrete that different parts of the engineering team can work with.</p><h4>Frontend and backend development should be parallel, not unnecessarily sequential</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8ZuxhQRxOlzl6Iy3voqRQ.png" /><figcaption>Without a contract the frontend waits. With one, both sides progress and then connect.</figcaption></figure><p>I don’t think frontend and backend development will always move at exactly the same pace.</p><p>There will be dependencies. There will be deployment issues. There will be changes to requirements, data structures, and implementation decisions.</p><p>That’s normal.</p><p>But I think we should distinguish between a genuine technical dependency and a coordination problem.</p><p>If the frontend needs an API contract to begin integration work, the absence of a deployed backend shouldn’t automatically prevent that contract from being shared.</p><p>With a clearly defined contract, frontend and backend developers can make progress independently while still working towards the same outcome.</p><p>The frontend can work against mock responses, while the backend developer continues implementing the actual functionality.</p><p>Both sides can then meet at an agreed interface.</p><p>And when the backend is ready, integration becomes a process of connecting and verifying rather than starting from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CAW8656VxC_LKEY5cAKGw.png" /><figcaption>From agreeing on the contract to verifying the real API.</figcaption></figure><h4>What I’m taking away from this</h4><p>This experience has changed how I think about collaboration between frontend and backend developers.</p><p>I’ve realised that understanding the interface between two systems is just as important as understanding how each system is implemented.</p><p>As frontend developers, we shouldn’t always have to wait for backend implementation to be completed before making meaningful progress.</p><p>And as backend developers, providing a clear contract isn’t just a favour to the frontend team. It’s part of building software that other people can understand, integrate with, test, and maintain.</p><p><strong>Good engineering isn’t just about getting your part of the application working. It’s also about making sure the next person can work with what you’ve built.</strong></p><p>Sometimes, the difference between an entire team being blocked and everyone making progress is simply having a well-defined contract.</p><p>And that’s something I think more engineering teams should take seriously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLrMpDB33RhkpuqRrKz29w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=695815bb55f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Fixed My Next.js App Not Loading on My Domain (Nginx, Docker, and Port 3000 Issue)]]></title>
            <link>https://medium.com/@abiodunjayb/how-i-fixed-my-next-js-app-not-loading-on-my-domain-nginx-docker-and-port-3000-issue-76c1cd2b9bdf?source=rss-d93d3296a3a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c1cd2b9bdf</guid>
            <dc:creator><![CDATA[Abiodun Ajiboye]]></dc:creator>
            <pubDate>Thu, 05 Nov 2026 20:27:35 GMT</pubDate>
            <atom:updated>2026-11-05T20:27:35.885Z</atom:updated>
            <content:encoded><![CDATA[<p>Deploying a modern web application with <strong>Docker, Nginx, and Next.js</strong> should be straightforward. But sometimes small configuration conflicts can cause confusing behavior — like your app only loading with :3000 or the wrong service appearing on your main domain.</p><p>Recently, I ran into exactly that problem while deploying a project called <strong>Vivida</strong>. My Next.js app was running correctly inside Docker, but when I visited my domain it either:</p><ul><li>Only worked when I added :3000</li><li>Loaded the wrong application (my AI backend instead of the frontend)</li><li>Didn’t route correctly through Nginx</li></ul><p>This article walks through <strong>what went wrong, how I diagnosed it, and the exact steps that fixed it</strong>.</p><h3>The Setup</h3><p>My production stack looked like this:</p><pre>Internet<br>   │<br>Nginx (Reverse Proxy)<br>   │<br> ├── yourdomain.com  → Next.js (Docker container on port 3000)<br> └── ai.yourdomain.com → FastAPI AI service (port 8000)</pre><p>Docker was running the Next.js container:</p><pre>0.0.0.0:3000-&gt;3000/tcp</pre><p>And Nginx was supposed to proxy requests from the domain to the container.</p><h3>The Problem</h3><p>When I opened:</p><pre>http://mydomain.com</pre><p>I saw <strong>the wrong application</strong> (my AI service) instead of the Next.js frontend.</p><p>But when I opened:</p><pre>http://mydomain.com:3000</pre><p>The Next.js app worked perfectly.</p><p>This told me something important:</p><p><strong>The container was fine. The problem was Nginx routing.</strong></p><h3>Step 1: Confirm the App Was Running</h3><p>First I verified the container was alive.</p><pre>docker ps</pre><p>Output:</p><pre>CONTAINER ID   IMAGE                          PORTS<br>17f71da83346   ghcr.io/.../gitproject:latest      0.0.0.0:3000-&gt;3000/tcp</pre><p>Then I tested the app locally:</p><pre>curl http://localhost:3000</pre><p>It returned the HTML of my Next.js app.</p><p>So the container was <strong>working correctly</strong>.</p><h3>Step 2: Check Nginx Configurations</h3><p>Next I checked which Nginx sites were enabled.</p><pre>ls /etc/nginx/sites-enabled</pre><p>Output:</p><pre>ai<br>default<br>nextjs<br>backend</pre><p>This was the first red flag.</p><p>Multiple configs were enabled, which can cause <strong>domain conflicts</strong>.</p><h3>Step 3: Check Which Domains Each Config Claimed</h3><p>I inspected the active server_name declarations.</p><pre>sudo nginx -T | grep server_name</pre><p>Output included:</p><pre>server_name _;<br>server_name mydomain.com www.mydomain.com;<br>server_name backend.mydomain.com www.backend.mydomain.com;<br>server_name ai.mydomain.com www.ai.mydomain.com;</pre><p>The critical line was:</p><pre>server_name _;</pre><p>That comes from Nginx’s <strong>default configuration</strong>.</p><p>The _ means:</p><blockquote><em>“Catch any domain not matched elsewhere.”</em></blockquote><p>So Nginx was routing my traffic to the wrong configuration before it even reached my Next.js block.</p><h3>Step 4: Remove Conflicting Configurations</h3><p>The solution was to remove unnecessary configs.</p><p>I disabled the default site:</p><pre>sudo rm /etc/nginx/sites-enabled/default</pre><p>Now only three configs remained:</p><pre>ai<br>nextjs<br>backend</pre><h3>Step 5: Ensure the Next.js Config Was Correct</h3><p>My Next.js Nginx config needed to explicitly handle the domain.</p><pre>/etc/nginx/sites-available/nextjs</pre><pre>server {<br>    listen 80;<br>    server_name mydomain.com www.mydomain.com;</pre><pre>    location / {<br>        proxy_pass <a href="http://127.0.0.1:3000;">http://127.0.0.1:3000;</a><br>        proxy_http_version 1.1;</pre><pre>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &#39;upgrade&#39;;</pre><pre>        proxy_set_header Host $host;<br>        proxy_cache_bypass $http_upgrade;</pre><pre>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><p>This tells Nginx:</p><pre>Requests to mydomain.com → forward to localhost:3000</pre><h3>Step 6: Reload Nginx</h3><p>After fixing configs, always test first:</p><pre>sudo nginx -t</pre><p>Then reload:</p><pre>sudo systemctl reload nginx</pre><h3>The Result</h3><p>Now the routing works perfectly:</p><p>DomainServiceget-vivida.comNext.js frontendai.get-vivida.comAI backend</p><p>No more :3000 required.</p><h3>Bonus: Improve Docker Security</h3><p>Originally the container exposed port 3000 publicly:</p><pre>0.0.0.0:3000</pre><p>In production it’s safer to bind it only to localhost:</p><pre>-p 127.0.0.1:3000:3000</pre><p>This ensures traffic must pass through Nginx.</p><p>Final architecture:</p><pre>Internet<br>   │<br>Nginx (80/443)<br>   │<br> ├── get-vivida.com → Next.js<br> └── ai.get-vivida.com → FastAPI</pre><h3>Key Lessons</h3><h3>1. Always verify the container first</h3><p>If curl localhost:3000 works, the issue is likely <strong>Nginx or DNS</strong>.</p><h3>2. Check enabled Nginx sites</h3><p>Too many configs often cause domain conflicts.</p><pre>ls /etc/nginx/sites-enabled</pre><h3>3. Avoid the default catch-all config</h3><p>The server_name _; block can hijack traffic.</p><h3>4. One domain = one server block</h3><p>Avoid multiple configs claiming the same domain.</p><h3>5. Test Nginx before restarting</h3><pre>sudo nginx -t</pre><h3>Final Thoughts</h3><p>Deploying modern apps with <strong>Docker + Nginx + Next.js</strong> is powerful but small configuration mistakes can lead to confusing routing issues.</p><p>The key is to debug methodically:</p><ol><li>Confirm the container works</li><li>Verify Nginx configs</li><li>Remove conflicts</li><li>Reload and test</li></ol><p>Once the routing is correct, everything falls into place.</p><p>If you’re deploying a similar stack and run into the same issue, hopefully this guide saves you hours of debugging.</p><p>Happy shipping 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c1cd2b9bdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Smooth Image Comparison Slider in Next.js]]></title>
            <link>https://medium.com/@abiodunjayb/building-a-smooth-image-comparison-slider-in-next-js-f4022cecc74b?source=rss-d93d3296a3a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4022cecc74b</guid>
            <category><![CDATA[gallery]]></category>
            <category><![CDATA[slider]]></category>
            <category><![CDATA[image-comparison]]></category>
            <category><![CDATA[image-slider]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Abiodun Ajiboye]]></dc:creator>
            <pubDate>Sun, 15 Sep 2024 12:27:43 GMT</pubDate>
            <atom:updated>2024-09-15T12:27:43.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JygKuEnCYg4jtFPkjJ_riw.png" /></figure><p>I’ve always been fascinated by how things work, which is one of the main reasons I started my web development journey — to learn how to create those ‘magical’ experiences myself 😂. Recently, I started working on a project that pushed my creativity to a new level. The challenge was to build a slider that lets users reveal one image over another by dragging across the screen. At first, it seemed daunting since I’d never built anything like it before. But as I progressed, it turned out to be much easier than expected.</p><blockquote><strong>In this article, I’ll walk you through how to create an interactive image comparison slider in Next.js using a simple but effective component. This slider allows users to reveal one image over another as they drag across the screen, making it perfect for things like before-and-after comparisons.</strong></blockquote><p>Below is the code I’ll be working with, followed by a breakdown of each part to ensure you understand how it works.</p><pre>const CompareSlider = ({<br>    beforeImage,<br>    afterImage,<br>  }: {<br>    beforeImage: any;<br>    afterImage: any;<br>  }) =&gt; {<br>    const [sliderPosition, setSliderPosition] = useState(50); // Initial slider position at 50%<br>    const sliderRef: any = useRef&lt;HTMLDivElement&gt;(null);<br>    const [width, setWidth] = useState();<br>    const [height, setHeight] = useState();<br><br>    useEffect(() =&gt; {<br>      const sliderRect = sliderRef.current?.getBoundingClientRect();<br>      setWidth(sliderRect?.width);<br>      setHeight(sliderRect?.height);<br>    }, []);<br><br>    const handleMouseMove = (event: MouseEvent | TouchEvent) =&gt; {<br>      if (!sliderRef.current) return;<br><br>      const sliderRect = sliderRef.current.getBoundingClientRect();<br>      const offsetX =<br>        &quot;touches&quot; in event<br>          ? event.touches[0].clientX - sliderRect.left<br>          : event.clientX - sliderRect.left;<br>      const width = sliderRect.width;<br>      const newSliderPosition = (offsetX / width) * 100;<br><br>      // Clamp value between 0 and 100<br>      setSliderPosition(Math.min(100, Math.max(0, newSliderPosition)));<br>    };<br><br>    return (<br>      &lt;div<br>        className=&quot;relative w-full h-full cursor-col-resize&quot;<br>        ref={sliderRef}<br>        onMouseMove={(event: any) =&gt; handleMouseMove(event)}<br>        onTouchMove={(event: any) =&gt; handleMouseMove(event)}<br>      &gt;<br>        {/* Before Image - Initial Image */}<br>        &lt;Image<br>          src={beforeImage}<br>          alt=&quot;Before Image&quot;<br>          className=&quot;absolute top-0 left-0 h-full w-full object-cover&quot;<br>        /&gt;<br><br>        {/* After Image - Will be revealed */}<br>        &lt;div<br>          className=&quot;absolute top-0 left-0 h-full overflow-hidden pointer-events-none&quot;<br>          style={{ width: `${sliderPosition}%` }}<br>        &gt;<br>          &lt;div className=&quot;&quot; style={{ width: width, height: height }}&gt;<br>            &lt;Image<br>              src={afterImage}<br>              alt=&quot;After Image&quot;<br>              className=&quot;object-cover top-0 w-full h-full&quot;<br>              // style={{ width: &#39;720px&#39;, height: &quot;700px&quot; }}<br>            /&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br><br>        {/* Slider Line */}<br>        &lt;div<br>          className=&quot;absolute top-0 h-full bg-transparent bg-opacity-50 pointer-events-none&quot;<br>          style={{ left: `${sliderPosition}%`, width: &quot;2px&quot; }}<br>        /&gt;<br><br>        {/* Swiper Image for visual feedback on where to drag */}<br>        &lt;Image<br>          src={SwiperImage}<br>          alt=&quot;swiper&quot;<br>          className=&quot;absolute pointer-events-none&quot;<br>          style={{<br>            left: `${sliderPosition}%`,<br>            top: &quot;50%&quot;,<br>            transform: &quot;translate(-50%, -50%)&quot;,<br>          }}<br>        /&gt;<br>      &lt;/div&gt;<br>    );<br>  };</pre><h3>Component Setup</h3><p>The C<strong>ompareSlider</strong> component takes two images as input: a <strong><em>beforeI</em>mage</strong> and an <strong><em>afterI</em>mage</strong>. These images are passed as props, meaning you can easily reuse this component with different images by providing new ones maybe passing it locally or dynamically getting it from an API endpoint.</p><pre>const CompareSlider = ({<br>  beforeImage,<br>  afterImage,<br>}: {<br>  beforeImage: any;<br>  afterImage: any;<br>}) =&gt; {</pre><p>This part simply defines the component and its props which are the two images (<strong><em>beforeImage</em></strong> and <strong><em>afterImage</em></strong>) that will be displayed in the slider.</p><h3>Managing the Slider’s Position</h3><p>I use React’s <strong><em>useState</em></strong> hook to track the position of the slider. The slider starts in the middle (50%), meaning both images will be equally visible at the beginning before the user start to interact with the slider .</p><pre>const [sliderPosition, setSliderPosition] = useState(50); // Initial slider position at 50%</pre><p>Here, <strong><em>sliderPosition</em></strong> holds the current position of the slider (a value between 0 and 100), and <strong><em>setSliderPosition()</em></strong> is used in updating the value as the user interacts with the slider.</p><p>I also create a reference to the slider’s container using the <strong><em>useRef </em></strong>hook, which helps me to get the slider’s dimensions later.</p><pre>const sliderRef = useRef&lt;HTMLDivElement&gt;(null);</pre><p>To accurately capture the width and height of the slider container, I used the React <strong><em>useEffect</em></strong> hook to initialize the values as soon as the page loads.</p><pre>useEffect(() =&gt; {<br>  const sliderRect = sliderRef.current?.getBoundingClientRect();<br>  setWidth(sliderRect?.width);<br>  setHeight(sliderRect?.height);<br>}, []);</pre><h3>Handling Mouse and Touch Events</h3><p>The core of the slider is the <strong><em>handleMouseMove</em></strong> function, which reacts to mouse (on desktops and computers) or touch (on mobile phones and tablets) movements. It calculates where the user is dragging or touching the slider and adjusts its position (<strong><em>sliderPosition</em></strong>) using the <strong><em>setSliderPosition() </em></strong>hook function accordingly.</p><pre>const handleMouseMove = (event: MouseEvent | TouchEvent) =&gt; {<br>  if (!sliderRef.current) return;<br><br>  const sliderRect = sliderRef.current.getBoundingClientRect();<br>  const offsetX =<br>    &quot;touches&quot; in event<br>      ? event.touches[0].clientX - sliderRect.left<br>      : event.clientX - sliderRect.left;<br>  const width = sliderRect.width;<br>  const newSliderPosition = (offsetX / width) * 100;<br><br>  setSliderPosition(Math.min(100, Math.max(0, newSliderPosition)));<br>};</pre><p><strong>Breaking this down:</strong></p><ul><li><strong><em>getBoundingClientRect()</em></strong> gives the position and size of the slider’s container.</li><li>I calculate <strong><em>offsetX</em></strong>, which is the distance the mouse or touch point is from the left side of the slider.</li><li>I convert that distance into a percentage by dividing by the width of the slider and multiplying by 100.</li><li>Finally, <strong><em>setSliderPosition()</em></strong> updates the slider’s position, but make sure the value stays between 0 and 100 using <strong><em>Math.min</em></strong> and <strong><em>Math.max</em></strong>.</li></ul><h3><strong>Rendering the Images</strong></h3><p>The component displays two images which are partially visible because the default position of the <strong><em>sliderPosition</em></strong> is set to 50% and they are revealed according to how the user interact with the slider inside the application. The two images are:</p><ul><li>The <strong><em>beforeImage</em></strong>.</li><li>The <strong><em>afterImage</em></strong>.</li></ul><pre>&lt;Image<br>  src={beforeImage}<br>  alt=&quot;Before Image&quot;<br>  className=&quot;absolute top-0 left-0 h-full w-full object-cover&quot;<br>/&gt;</pre><p>The <strong><em>beforeImage</em></strong> is absolutely positioned to fill the entire container. The <strong><em>afterImage</em></strong> is also positioned absolutely, but its width changes based on the <strong><em>sliderposition</em></strong>:</p><pre>&lt;div<br>  className=&quot;absolute top-0 left-0 h-full overflow-hidden pointer-events-none&quot;<br>  style={{ width: `${sliderPosition}%` }}<br>&gt;<br>  &lt;div className=&quot;&quot; style={{ width: width, height: height }}&gt;<br>    &lt;Image<br>      src={afterImage}<br>      alt=&quot;After Image&quot;<br>      className=&quot;object-cover top-0 w-full h-full&quot;<br>     /&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>The container for the <strong><em>afterImage</em></strong> has an adjustable width. The higher the <strong><em>sliderPosition</em></strong> value, the more of the <strong><em>afterImage</em></strong> is revealed and the less the <strong><em>beforeImage</em></strong>.</p><h3>Slider Line and Swiper Icon</h3><p>To provide visual feedback, I display a thin line that moves with the slider, as well as an image (like a small handle) to show the user where they can drag.</p><pre>&lt;div<br>  className=&quot;absolute top-0 h-full bg-transparent bg-opacity-50 pointer-events-none&quot;<br>  style={{ left: `${sliderPosition}%`, width: &quot;2px&quot; }}<br>/&gt;<br>&lt;Image<br>  src={SwiperImage}<br>  alt=&quot;swiper&quot;<br>  className=&quot;absolute pointer-events-none&quot;<br>  style={{<br>    left: `${sliderPosition}%`,<br>    top: &quot;50%&quot;,<br>    transform: &quot;translate(-50%, -50%)&quot;,<br>  }}<br>/&gt;</pre><ul><li>The line (<em>div</em>) moves along with the slider and visually separates the two images.</li><li>The <strong><em>SwiperImage</em></strong> is the icon that indicates where the user should drag. It stays centered vertically and moves horizontally based on <strong><em>sliderPosition</em></strong>.</li></ul><h3>Full Implementation</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b351c71972041a676903d43cc2a415fa/href">https://medium.com/media/b351c71972041a676903d43cc2a415fa/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9SamEkcH3kJPtu3J7jRVXg.jpeg" /><figcaption>Default view when the slider position is at 50%</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a25HD_eazgdaAfZ_qn7Cmw.jpeg" /><figcaption>View when the slider position is dragged to around 10%</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9PH5hp7G7DpEesfpYDTEw.jpeg" /><figcaption>View when the slider position is dragged to around 90%</figcaption></figure><blockquote><strong>The major challenge I faced while implementing the image slider was ensuring that both images were perfectly aligned and matched in size. Any difference in their dimensions could result in noticeable gaps or misalignment when the user interacted with the slider, affecting the smoothness of the experience. To resolve this, I used tailwind CSS techniques like `object-cover` to make sure the images fit their containers without distortion, ensuring that they overlapped perfectly and provided a seamless user experience.</strong></blockquote><p>Hope this helps! Please leave a comment or feedback if you have any.</p><p>You can also reach out through <a href="https://x.com/jaybcodes"><strong><em>twitter</em></strong></a> or <a href="https://www.linkedin.com/in/abiodunjayb/"><strong><em>linkedin</em></strong></a></p><p>Gracias ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4022cecc74b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The New Me]]></title>
            <link>https://medium.com/@abiodunjayb/the-new-me-d30a1bc954ce?source=rss-d93d3296a3a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d30a1bc954ce</guid>
            <category><![CDATA[new-start]]></category>
            <category><![CDATA[new-me]]></category>
            <category><![CDATA[fresh-start]]></category>
            <category><![CDATA[new-beginnings]]></category>
            <dc:creator><![CDATA[Abiodun Ajiboye]]></dc:creator>
            <pubDate>Sat, 07 Sep 2024 09:59:42 GMT</pubDate>
            <atom:updated>2024-09-07T09:59:42.290Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dHfDfxz_uF11UXaAgnOE-w.jpeg" /><figcaption>A new beginning</figcaption></figure><p>For a while now, I’ve been feeling the urge to pick up something new, something different from just my usual developer skills 😂. But finding that one thing — something I truly connect with and feel passionate about — hasn’t been easy. I wanted it to be something I could pour my heart into, and I didn’t want to rush the process.</p><p>Then, recently, a friend came up with a challenge: Why don’t we start writing about the things we’ve been working on? Initially, I thought, “Writing? Me?” But something about the idea stirred something inside me, a feeling I hadn’t expected. It wasn’t just the act of writing; it was the idea of expressing myself in a way that could boost my confidence.</p><p>You see, if you follow me on social media, you probably know that I’m not exactly the most active guy online. Honestly, I’ve always been the type to just scroll through other people’s posts, silently wondering what I had to contribute. What did I really have to say that anyone would want to hear? 😂 But this challenge felt different. It wasn’t about posting for the sake of posting. It was about telling my story, sharing the things I’ve been working on, and maybe, just maybe, connecting with people in a way I hadn’t before.</p><p>So, here I am. This is the new me, stepping out of my usual “developer-only” routine and doing something that feels like a fresh start. It’s me, taking those baby steps towards something that helps me communicate not just what I do, but how I feel about it all. And yeah, it’s exciting! I’m exploring a new way to express myself, and it feels like the beginning of something special.</p><p>So, I’m giving myself the space to grow, learn, and embrace this journey with open arms. I might still be a developer at heart, but this feels like a new chapter in my life, one where I’m not just coding away in silence, but actually sharing the highs, the lows, and everything in between.</p><p>Gracias ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d30a1bc954ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>