<?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 D M on Medium]]></title>
        <description><![CDATA[Stories by D M on Medium]]></description>
        <link>https://medium.com/@cddm?source=rss-7a26c25cfe85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2GFHRFR-ciF8t_zUNt3Teg.jpeg</url>
            <title>Stories by D M on Medium</title>
            <link>https://medium.com/@cddm?source=rss-7a26c25cfe85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 06:59:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cddm/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[React scroll to top button]]></title>
            <link>https://cddm.medium.com/react-scroll-to-top-button-4440d4c4e4d4?source=rss-7a26c25cfe85------2</link>
            <guid isPermaLink="false">https://medium.com/p/4440d4c4e4d4</guid>
            <category><![CDATA[react-components]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[D M]]></dc:creator>
            <pubDate>Thu, 14 Dec 2023 10:35:28 GMT</pubDate>
            <atom:updated>2024-03-29T06:43:48.955Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*pEyLRDUh5soWJuBJ3T40Ag.png" /></figure><p>I wanted to share my implementation for a scroll to top button in react.</p><p>ScrollToTopButton.jsx:</p><pre>import { useState, useEffect } from &quot;react&quot;;<br>import styles from &quot;./scrollToTopButton.module.css&quot;;<br><br>function ScrollToTopButton() {<br>  const [showButton, setShowButton] = useState(&quot;false&quot;);<br><br>  useEffect(() =&gt; {<br>    const handleScrollToTopButtonVisiblity = () =&gt; {<br>      window.scrollY &gt; 500 ? setShowButton(true) : setShowButton(false);<br>    };<br>    window.addEventListener(&quot;scroll&quot;, handleScrollToTopButtonVisiblity);<br>    return () =&gt; {<br>      window.removeEventListener(&quot;scroll&quot;, handleScrollToTopButtonVisiblity);<br>    };<br>  }, []);<br><br>  const handleScrollToTop = () =&gt; {<br>    window.scrollTo({ top: 0, behavior: &quot;smooth&quot; });<br>  };<br><br>  return (<br>    &lt;&gt;<br>      {showButton &amp;&amp; (<br>        &lt;div className=&quot;scrollToTop&quot;&gt;<br>          &lt;a<br>            className={styles.scrollToTop__button}<br>            onClick={handleScrollToTop}<br>          /&gt;<br>        &lt;/div&gt;<br>      )}<br>    &lt;/&gt;<br>  );<br>}<br><br>export default ScrollTopButton;</pre><p>scrollToTopButton.module.css:</p><pre>:root { <br>--textColorRGB: 0, 0, 0;<br>--bg: white;<br>}<br><br>.scrollToTop__button {<br>  position: fixed;<br>  bottom: 2%;<br>  right: 2%;<br>  z-index: 50;<br>  cursor: pointer;<br>  padding: 2rem;<br>  line-height: 50px;<br>  height: 50px;<br>  width: 50px;<br>  background: rgba(var(--textColorRGB), 0.3);<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>}<br><br>.scrollToTop__button:after {<br>  content: &quot;\f106&quot;;<br>  font-family: fontawesome;<br>  vertical-align: top;<br>  color: var(--bg);<br>}</pre><p>If you want to adjust it’s size, make sure to change line-height, height and width to the same value.</p><p>I implemented this button with variables, so that you can change the colors with dark mode on. Example:</p><pre>.dark {<br>  --bg: #0f172a;<br>  --textColorRGB: 255, 255, 255;<br>}</pre><p>For the icon (:after element) to work you need to use font-awesome-4.7.0.</p><p>I can’t assure that it works with other versions, but you can look up the corresponding code on your own:</p><p><a href="https://fontawesome.com/versions">https://fontawesome.com/versions</a></p><p>Search for “angle-up” browsing the Free Icons and replace the content value in the after element if they don’t match.</p><p>Done!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4440d4c4e4d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quill Syntax highlighting with highlight.js import bug]]></title>
            <link>https://cddm.medium.com/quill-syntax-highlighting-with-highlight-js-68dd0b32c7ae?source=rss-7a26c25cfe85------2</link>
            <guid isPermaLink="false">https://medium.com/p/68dd0b32c7ae</guid>
            <category><![CDATA[highlightjs]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[quill]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[D M]]></dc:creator>
            <pubDate>Thu, 14 Dec 2023 09:26:58 GMT</pubDate>
            <atom:updated>2024-01-18T01:33:20.969Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Issue:</h3><p>Enabling syntax highlighting in react-quill will often result in the following error:</p><pre>Error: Syntax module requires highlight.js. Please include the library on the page before Quill.</pre><p>While reading this error the fix seems trivial, it isn’t.</p><p>Even when putting the import for highlight.js and the corresponding css file on top, it won’t be fixed as some might initially assume.</p><h3>The Fix:</h3><pre>import dynamic from &quot;next/dynamic&quot;;<br>import hljs from &quot;highlight.js&quot;;<br>import &quot;highlight.js/styles/monokai-sublime.css&quot;;<br><br>const ReactQuill = dynamic(<br>    () =&gt; {<br>        hljs.configure({<br>            languages: [&#39;javascript&#39;, &#39;CSS&#39;, &#39;HTML&#39;]<br>        })<br>        // @ts-ignore<br>        window.hljs = hljs<br>       return  import (&quot;react-quill&quot;)<br>    }, {<br>    ssr: false,<br>    loading: () =&gt; &lt;p&gt;Quill loading&lt;/p&gt;<br>})</pre><p>By using next/dynamic, the react-quill component will not be included in the page’s initial JavaScript bundle. The page will render the suspense fallback first, followed by the react-quill component when the suspense boundary is resolved.</p><p>On top of that we add highlight.js to the window on client-side and disable server side rendering.</p><p>A tricky fix for a such seemingly trivial error, isn’t it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68dd0b32c7ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AOS.js overflow bug workaround]]></title>
            <link>https://cddm.medium.com/aos-js-overflow-workaround-62fd9ff13167?source=rss-7a26c25cfe85------2</link>
            <guid isPermaLink="false">https://medium.com/p/62fd9ff13167</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css-animation]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[aos]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[D M]]></dc:creator>
            <pubDate>Thu, 14 Dec 2023 09:20:00 GMT</pubDate>
            <atom:updated>2024-01-06T09:30:17.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_P9AnyvTEIfeQrG2JWhIQ.png" /></figure><h3>The Issue:</h3><p>Setting overflow:hidden on the body/html element while using the AOS.js will result in the animations not working at all.</p><h3>The Workaround:</h3><pre>.main &gt; * {<br>  overflow:hidden;<br>}</pre><p>The above code snippet will hide all overflow on the child elements of your main container, assuming that .main is the css class of your main container, while AOS.js animations will keep working.</p><p>I know: it’s very simple, but no one else on github or anywhere else came up with it. This is why I want share my solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62fd9ff13167" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>