<?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 Samson Oyebamiji on Medium]]></title>
        <description><![CDATA[Stories by Samson Oyebamiji on Medium]]></description>
        <link>https://medium.com/@samsonoyebamiji02?source=rss-fd8e399b4712------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WKWlVMC8nZ24f6_N</url>
            <title>Stories by Samson Oyebamiji on Medium</title>
            <link>https://medium.com/@samsonoyebamiji02?source=rss-fd8e399b4712------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:21:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samsonoyebamiji02/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[WEB COMPONENTS]]></title>
            <link>https://medium.com/@samsonoyebamiji02/web-components-1bd4f604e7af?source=rss-fd8e399b4712------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bd4f604e7af</guid>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Samson Oyebamiji]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 20:06:11 GMT</pubDate>
            <atom:updated>2022-03-10T20:06:11.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Components in general, are self-containing part of a larger entity. Think of component as a Lego block used by kids, for various form of construction, or like the various Items that goes into cooking. Rice, beans, water etc., are components that are needed for cooking a rice and beans meal.</p><h3>Web component</h3><p>A web component is a stand-alone chunk, of a webpage. The entire page is made up of little stand-alone chunks called components, which are properly arranged to fit together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*XfDSJCQX0Gzdi3WVEWYIUg.png" /><figcaption>A sample webpage</figcaption></figure><p>Consider the twitter page above some of the components are identified<br> 1. The twitter logo.<br> 2. The navigation Items.<br> 3. A button.<br> 4. News feeds.<br> 5. User uploaded Image.<br> 6. Search bar.</p><p>The Idea of seeing a web page as a buildup of smaller components (web component) has been around for a long time. It has become the trend in most, if not all JavaScript frame works. Before the advent of web component, websites were built in pages making it difficult or even impossible to reuse code, as no two pages were closely similar to each other. With the advent of web component, code reusability has been increased rapidly. Take for example an input component can be used to collect email, password, username, etc. The Idea of web component cannot be over emphasized as it is adopted by most if not all JavaScript frame work.</p><h3>Web Component In Vanilla JS</h3><p>Web component not only exists in JavaScript frame works, it also can be implemented using vanilla JS, and as well be used in all JS frame works. Before we dive deeper into Web component in vanilla JS, there are some terms we should get familiar with. These are template tag, slot tag, custom elements and shadow dom.</p><h4>Template tags</h4><p>The &lt;template&gt; tag is used as a container to hold some HTML content hidden from the user when the page loads. It can only be revealed through JavaScript. Like say a wallet, money (block of code) not currently in use, would be kept in the wallet (template tag).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*H9MBIQKA9ABbrzGIWn2u6A.png" /><figcaption>Image showing contents hidden in template tag</figcaption></figure><h4>Slot tag</h4><p>The &lt;slot&gt; tag is used to dynamically add values to the code defined in the template element, it has a name attribute that is used to identify the slot and can be called in our rendered code by passing the name of the slot attribute to the tag containing the real value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*G1HLv9rdH1Hk8llLqoV5fQ.png" /><figcaption>Image showing how the slot tag is used</figcaption></figure><p>the slot attribute is usually called within our custom element.</p><h4>Custom Element</h4><p>Just as the name implies, custom elements are user created Element(s). This is achieved by passing two parameters to the “customElements.define(element-name, ElementConstructor)” function, which is a native JS function.<br> “<em>element-name”</em> can be any string of your choice but must have a hyphen, e.g., “my-name” is valid while “myName” is not valid.<br>“<em>ElementConstructor”</em> is usually gotten by creating a class that extends the HTMLElement class. The HTMLElement class is the class that forms all basic HTML Elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*uyzz23YfLIBiBakoGUi4zw.png" /><figcaption>A simple custom element example</figcaption></figure><h4>Shadow Dom</h4><p>The shadow Dom is a tree of how HTML element(s) are to be rendered on the web page. The shadow Dom is hidden to browser unless revealed to the browser by some JS Dom manipulation function. i.e., dynamically rendering components using JavaScript. <br> The contents of the Shadow Dom are encapsulated i.e., styles and elements defined in the shadow Dom do not affect or are affected by element of the page Dom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*gyPYQToNXLI94Vw6kS0hMg.png" /><figcaption>How the Page Dom and Shadow Dom interact</figcaption></figure><p>The shadow root is the entry point to the shadow Dom. The shadow root is attached to a child element of the main page Dom, and this element is usually our custom element. It is done by calling the attachShadow method on the Html element and passing in an object as a parameter i.e., Element.attachShadow({mode: ‘open’}).</p><h3>Creating A simple web component</h3><p>In creating a simple web component, we combine all these knowledge and use it to create a component which is self-encapsulating and user defined, i.e., we can make it into any shape we want it to be.<br> The web component is written inside a template tag to our taste, stored in the shadow Dom and then rendered in the page Dom through our custom element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*IsXGOVetpe1Qx6pY6zRPAA.png" /><figcaption>A simple web component</figcaption></figure><p>Notice how the styles defined in the CSS file has no effect on the component on the elements in the shadow Dom, but they are only affected by those within the “Style” element in the “template” element.</p><p>In Conclusion, a web component is a simple web building block that can be used to build webpages and applications. A web component in vanilla JS makes use of the concept of shadow Dom to build a self-encapsulating component that is inserted in the web page through a custom element, and is wrapped within a template tag.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bd4f604e7af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS variables and UI improvement]]></title>
            <link>https://medium.com/@samsonoyebamiji02/css-variables-and-ui-improvement-fa2d609bdaa?source=rss-fd8e399b4712------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa2d609bdaa</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Samson Oyebamiji]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 09:21:16 GMT</pubDate>
            <atom:updated>2022-02-21T09:21:16.366Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone my name is Samson. I have been looking for a way to share my thought and what I have learnt so far, but couldn’t figure out how to go about it until I came across this platform.</p><p>Today I would like to share my idea on CSS variables and how they can help improve UI.</p><h4><strong>WHAT IS CSS AND CSS VARIABLES</strong></h4><p>CSS variables basically contains 2 words CSS and Variables.</p><p>CSS stands for Cascading Style Sheets, it is a style sheet language used for describing the presentation of a document written in a markup language such as HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript. It is a language used to beautify a web page according to styles specified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*RG1NmVnw0T_tzWr27VmpsA.png" /><figcaption>A sample CSS code</figcaption></figure><p>Variables on the other hand are quantities that can accept any value.</p><p>A CSS variable is therefore a CSS set of rules that can have any value. Think of it as a container that can be used to store any CSS set of rules. CSS variables can either be globally or locally scoped.</p><p>Globally scoped CSS variables are variables that are accessible throughout the entire CSS file. They are defined in the “: root” block and are available throughout the entire document.</p><p>Local scoped variables are variables which are only available within a specific block of code (within the curly braces “{}” where they are defined).</p><p>The CSS variable name is defined in its block by adding “ —” in front of the variable name. For example — color-red: #F00. This attaches the #F00 value to the key — color-red.</p><p>The value of a defined variable can be used in the document by calling the var() on the variable name. Meaning var( — color-red) returns the value #F00 (as earlier defined).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*7J7ubvpZrlAk49D_WLwKig.png" /><figcaption>Css code showing globally and locally scoped variables</figcaption></figure><p>From the above image, <br> — color-red and –margin-small are global variables and therefore can be called anywhere in the document as seen in the .content__title block, while — color-green and — margin-large are local variable and can only be called in the .content__img block.</p><h4>WHAT IS UI</h4><p>You might be familiar as a front-end developer with the word UI which stands for User Interface. The user interface (UI) is the series of screens, pages, and visual elements that enable a person to interact with a product or service. In simple definition, a user interface is what a user can see and interact with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*Z7XL4y2e6n3Fp62QSTpSBg.png" /><figcaption>Bad UI and Good UI</figcaption></figure><h4>HOW DOES CSS VARIABLE IMPROVE UI</h4><p>A proper UI needs to have consistency. Therefore, there is a need to define a system of value to limit choices and help the designer to stay focused on choosing a value from a selected list of values rather than from all possible values which could be overwhelming.</p><p>These selected values can be stored as a CSS variable making it easier for a designer to pick from his/her own selected pool of values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*cwiCiKztzuJfdD-iZ5tlMg.png" /><figcaption>A system and how it can be improved with CSS variables</figcaption></figure><h4>COMPARISON BETWEEN A BASIC UI AND A CSS VARIABLE UI</h4><p>Coding up a user interface without CSS variable is very possible, but why not save yourself the extra effort you put on getting the right size, color or even spacing and work on something better. A CSS variable is like a restaurant menu. Customers who have the menu finds it easier to make orders than those without the menu, because it is easier to just look at the menu and find the dish which fits your craving. Whereas a customer without the menu will have to crack their head in finding the right dish and also confirm if that dish is available at the restaurant.</p><p>In conclusion a good UI design requires consistency and this consistency can easily be achieved by setting up a system and limiting the availability options.</p><p>CSS variable can help with setting up a system by assigning the selected system values to variables making it easily documented and easy to remember.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa2d609bdaa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>