<?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: Christian Otto</title>
    <description>The latest articles on DEV Community by Christian Otto (@christianotto).</description>
    <link>https://dev.to/christianotto</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%2F166922%2Fe65759bd-6d32-40fd-8642-f7fdfc2b59f9.jpeg</url>
      <title>DEV Community: Christian Otto</title>
      <link>https://dev.to/christianotto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/christianotto"/>
    <language>en</language>
    <item>
      <title>Enriching a minimal Javascript ToDo-App with ORGENIC UI</title>
      <dc:creator>Christian Otto</dc:creator>
      <pubDate>Mon, 13 May 2019 14:18:07 +0000</pubDate>
      <link>https://dev.to/christianotto/enriching-a-minimal-javascript-todo-app-with-orgenic-ui-ni1</link>
      <guid>https://dev.to/christianotto/enriching-a-minimal-javascript-todo-app-with-orgenic-ui-ni1</guid>
      <description>&lt;p&gt;&lt;strong&gt;A small To-Do list app.&lt;/strong&gt; Well, nothing really new, right? Adding new tasks, then marking them as done or open or even erasing them completely from the list...sounds doable.&lt;/p&gt;

&lt;p&gt;Here´s a little mockup of how it could look like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbbg249weoasp20dx3dg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbbg249weoasp20dx3dg4.png" title="ToDo-App mockup" alt="ToDo-App mockup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I´m pretty sure there are many front-end developers out there who will not really have a problem coding up some lines in Javascript to solve all that. And this is also what we did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here´s a CodePen to see how little it takes.&lt;/strong&gt; &lt;em&gt;(Credits go out to my colleague Tobias for doing the preliminary work)&lt;/em&gt;&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/COT/embed/EzPvQo?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Okay, this may work for the moment, but the native HTML controls used here look a bit boring out of the box, are you with me? Checkboxes with a label, some buttons, maybe a fieldset or someting else that wraps the whole stuff. &lt;strong&gt;Time now to tweak the visual appearance!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you´re not really into CSS that much to do all the styling of these elements on your own, you may be wondering if now the time has come to let a 3rd party tool help you out on that.&lt;/p&gt;

&lt;p&gt;Well, of course a lot of people instantly may think of Bootstrap and the likes to accomplish the styling task. While this may work, it usually means that you have to stick to a certain predefined template structure that can easily blow up the number of lines your HTML is made of.&lt;/p&gt;

&lt;p&gt;So, why not try web components instead, the stuff that everybody speaks of and all the neat SPA frameworks out there already make use of?&lt;/p&gt;

&lt;h2&gt;
  
  
  ORGENIC UI
&lt;/h2&gt;

&lt;p&gt;Alright, time to introduce &lt;strong&gt;&lt;a href="https://orgenic.org/" rel="noopener noreferrer"&gt;ORGENIC UI&lt;/a&gt;&lt;/strong&gt;, a new and growing set of ready-to-use web components that supports theming via CSS custom properties (a.k.a. CSS variables).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkqjmketpffonnxnr1kmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkqjmketpffonnxnr1kmf.png" alt="ORGENIC UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While you can integrate the ORGENIC UI package into your, let´s say, Angular project, pretty easily via npm, you can, of course, also (make use of unpkg to) include the required files in a plain Javascript/HTML-based project. We have done just this and demonstrate it with a modified version of our aforementioned CodePen.&lt;/p&gt;

&lt;p&gt;Here´s a version of the app that features ORGENIC UI components and some modified logic.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/COT/embed/KLzaxY?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
(Have a look at the pen settings to figure out the JS and CSS that need to be included. And head over to &lt;a href="https://docs.orgenic.org" rel="noopener noreferrer"&gt;https://docs.orgenic.org&lt;/a&gt; to find out about the components that currently exist and how to handle them.)&lt;/p&gt;

&lt;p&gt;Basically, we wrapped our main template parts with an &lt;code&gt;&amp;lt;og-card&amp;gt;&lt;/code&gt; (ORGENIC card), which provides two slots to place content in, a &lt;em&gt;content&lt;/em&gt; slot and a &lt;em&gt;footer&lt;/em&gt; slot. The native buttons got replaced by &lt;code&gt;&amp;lt;og-button&amp;gt;&lt;/code&gt; controls (ORGENIC button) that provide a custom &lt;em&gt;clicked&lt;/em&gt; event that we can listen to. And we made use of &lt;code&gt;&amp;lt;og-form-item&amp;gt;&lt;/code&gt; (ORGENIC input) to be our wrapper component for a label and a text input. As a bonus, we even integrated a small toolbar to demonstrate how easily it is possible to switch between the two themes (&lt;em&gt;light&lt;/em&gt; and &lt;em&gt;dark&lt;/em&gt;) that come with the package.&lt;/p&gt;

&lt;p&gt;Are you also satisfied with the updated outcome? It was just a thing of a few minutes to radically change the UI of this little app, basically just by modifying our HTML a little. And best of all, you can easily change the provided layout just by overriding the available CSS custom properties, but I think this is something that is worth its own post, so stay tuned.&lt;/p&gt;

&lt;p&gt;Please visit ORGENIC at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://orgenic.org" rel="noopener noreferrer"&gt;https://orgenic.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/orgenic/orgenic-ui" rel="noopener noreferrer"&gt;https://github.com/orgenic/orgenic-ui&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/orgenicUI" rel="noopener noreferrer"&gt;https://twitter.com/orgenicUI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>orgenicui</category>
      <category>webcomponents</category>
      <category>javascript</category>
      <category>ui</category>
    </item>
  </channel>
</rss>
