<?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 Sergio Perez on Medium]]></title>
        <description><![CDATA[Stories by Sergio Perez on Medium]]></description>
        <link>https://medium.com/@sergio13prez?source=rss-7cdee254cdc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_TfGYSC4s44qk1GN.jpg</url>
            <title>Stories by Sergio Perez on Medium</title>
            <link>https://medium.com/@sergio13prez?source=rss-7cdee254cdc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:44:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sergio13prez/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[SweetAlert2 my favorite library to use in React]]></title>
            <link>https://medium.com/@sergio13prez/sweetalert2-my-favorite-library-to-use-in-react-873655601dec?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/873655601dec</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 19:22:50 GMT</pubDate>
            <atom:updated>2020-03-02T19:22:50.422Z</atom:updated>
            <content:encoded><![CDATA[<p>My favorite library to use with React that beats using the regular alert functionality that browsers give you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfto33V5lELoKmVS9n1ugQ.png" /></figure><p>When building applications one of the main things I find tedious is working with pop-ups or modals. I would like to alert the member but do not want to use the basic windows alert functionality. This is where the SweetAlert library comes in.</p><p><a href="https://sweetalert2.github.io/">SweetAlert2</a> is a library which is really easy to install and use. Its main usage is to alert the user with whatever info you want. The alerts are styled to be very clean and minimalistic. That way, they can fit into any application you are building!</p><p>I mostly use it when a request to the backend is completed or if a user doesn’t have access to a specific feature.</p><p>Let’s run through the basic set up. First of all is installing it. You will have to run the following line in your terminal:</p><pre>npm install sweetalert2</pre><p>Next, all you have to do is require it in the JS file you will be using the alert.</p><pre>import Swal from &#39;sweetalert2&#39;</pre><p>Now you have access to the alert and you can customize it in any way you want.</p><pre>Swal.fire({</pre><pre>  title: &#39;Error!&#39;,</pre><pre>  text: &#39;Do you want to continue&#39;,</pre><pre>  icon: &#39;error&#39;,</pre><pre>  confirmButtonText: &#39;Cool&#39;</pre><pre>})</pre><p>The following code above is an example directly from the SweetAlert2 documentation.</p><p>The most simple alert takes in 4 settings. The first is the title it can be a string of whatever you want to show up on the top of the alert. The second is the text parameter, this is usually where you can add on to why the alert popped up. Examples would be like “Wrong username or password”, “Successfully created the record”, etc. The third parameter is the icon, it can take in success, error, warning, info and question. The library will handle generating the icon. The last parameter is the type of button you would like to use and what text you want it show inside the button.</p><p>You can also do a lot more with it since once the alert finishes, it does return a promise. You do have the option to handle the promise and do other actions depending on the result.</p><pre>Swal.fire({</pre><pre>   title: &#39;Are you sure?&#39;,</pre><pre>   text: &#39;User will have Admin Privileges&#39;,</pre><pre>   icon: &#39;warning&#39;,</pre><pre>   showCancelButton: true,</pre><pre>   confirmButtonColor: &#39;#3085d6&#39;,</pre><pre>   cancelButtonColor: &#39;#d33&#39;, </pre><pre>   confirmButtonText: &#39;Yes!&#39;</pre><pre>}).then((result) =&gt; {</pre><pre>   if(result.value){</pre><pre>    this.props.submitUser(this.state)</pre><pre>  }</pre><pre>})</pre><p>The following code above is an example of handling the promise. I used it in one of my recent applications. The alert comes up when a new user is being created with admin privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5ARkJygkyLOV369ynLdBg.png" /><figcaption>Example of the alert being used in my application.</figcaption></figure><p>If the user clicks on Yes then it will run the submitUser function which sends the data to the backend to be created. If not, it will stop the function.</p><p>For things like this I find it super useful. This is just a quick intro to the SweetAlert library. It give you a variety of option. You can customize the colors, icon and even add pictures to the alerts.</p><p>Documentation : <a href="https://sweetalert2.github.io/">https://sweetalert2.github.io/</a></p><p>The documentation also gives you clear instructions on how to use it with non React applications. If you need any help setting it up or customizing the sweet alerts please feel free to reach out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=873655601dec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Small Intro to CSS Animations]]></title>
            <link>https://medium.com/@sergio13prez/small-intro-to-css-animations-5d647e742afc?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d647e742afc</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[cascading-style-sheets]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Mon, 24 Feb 2020 21:31:49 GMT</pubDate>
            <atom:updated>2020-02-24T21:31:49.451Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating a bouncing ball animation with basic CSS animation properties and keyframes.</p><h3>What are CSS Animations?</h3><p>CSS animations let us animate transitions from one CSS style configuration to another. They are used to created simple animations. They consist of two components, a style describing the animation you want to create and a set of keyframes.</p><p>Keyframes will allow us to change the styles gradually, they indicate the start and end states of the animation’s style. They are fairly simple to use and get started with, you are able to create them without any knowledge of Javascript!</p><h3>What we’ll be building :</h3><p>For example purposes we will be creating a simple animation of a ball bouncing. I will cover the animation-name, animation-duration, animation-iteration-count and keyframe properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uq8HMw2Nz-9axuuqw7ovbg.png" /><figcaption>Using CodePen.io</figcaption></figure><p>We will be starting with the following code above. It consists of a single div element with the classname “ball”. In the CSS section we are giving it a height and width. The margin set to auto so it can be centered. Border radius set to 50% which will give it the circular shape and a liner-gradient for the background image just to make it look better in my opinion.</p><p>Next we will be creating the keyframe for this animation. Since this is a simple animation we will creating 3 different points/states in the keyframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwdJDZI8JfoRRH_T5cXiJA.png" /><figcaption>Keyframe Example</figcaption></figure><p>In the picture above we have the keyframe manipulating the top, width and height properties through the animation. At 0% of the animation the top property should be 0 which is basically making sure the ball is set to the top. At 50% completion of the animation the ball should be 250 px’s from the top which would move the ball almost to the middle of the screen. The width of the ball is incremented to 350px and the height is lowered to 250px. These changes give the ball the effect that its being squished when it hits the bottom.</p><p>Next comes the fun part which is assigning the keyframe to the div element. First we will be giving the div the ‘animation-name’ property. The animation-name property takes in the name of the keyframe you want to use, which in this case is ‘bounce’.</p><p>Now we have to add the “animation-duration” property to the div. The animation-duration is used to specify how long the animation should take from start to finish. For this example we will be giving it “1s” which equals 1 second. Feel free to mess around with this time, you can speed it up and make the ball bounce even faster.</p><p>Lastly is the “animation-iteration-count” property which sets the number of times an animation cycle should be played before stopping. You can give it a numbered value like 1, 4, 7, etc. But it also takes in a ‘infinite’ value which will play the animation an infinite amount of times. This is the value we will be using to make the ball continue to bounce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEqdsgC1QeBFgQyR4GxyYw.png" /><figcaption>Completed code</figcaption></figure><p>Your code for should look like the following picture above and your animation should be working! Please check out the following CodePen for the live demo of the animation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FNihaprezz%2Fembed%2Fpreview%2FjKbJXv%3Fheight%3D600%26slug-hash%3DjKbJXv%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FNihaprezz%2Fpen%2FjKbJXv%3Feditors%3D1100&amp;image=https%3A%2F%2Fscreenshot.codepen.io%2F1502982.jKbJXv.small.29f9021b-960b-4f29-98bf-eac3826c3522.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ed2d7e1b8ca7dcacd41145884f5c089/href">https://medium.com/media/8ed2d7e1b8ca7dcacd41145884f5c089/href</a></iframe><h3>Conclusion</h3><p>This is just a simple animation created to give an intro into CSS animations. There are still other CSS animation properties out there which can help you make even cooler animations like animation-direction, animation-fill-mode, and animation-play-state. I would look into the following resources given below if it interests you. Also, something that helped me learn was going through <a href="https://codepen.io/">CodePen</a> and seeing what other people had built and trying to recreate it.</p><h4>Resources:</h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations">Using CSS animations - CSS: Cascading Style Sheets | MDN</a></li><li><a href="https://css-tricks.com/almanac/properties/a/animation/">animation | CSS-Tricks</a></li></ul><p><a href="https://youtu.be/jgw82b5Y2MU">https://youtu.be/jgw82b5Y2MU</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d647e742afc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting to MongoDB Atlas]]></title>
            <link>https://medium.com/@sergio13prez/connecting-to-mongodb-atlas-d1381f184369?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1381f184369</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Sun, 16 Feb 2020 02:47:03 GMT</pubDate>
            <atom:updated>2020-02-16T02:47:03.477Z</atom:updated>
            <content:encoded><![CDATA[<p>Quick post on how to connect to MongoDB Atlas from a NodeJS/Express application.</p><h3>What is MongoDB Atlas?</h3><p>It is a global cloud database service developed by MongoDB. You are given the option to choose the cloud service provider. Atlas will handle the<strong> </strong>complexity of deploying, managing, and healing your deployments.</p><h3>Getting Started</h3><p>First of all you will have to make an account on their <a href="https://www.mongodb.com/cloud/atlas">site</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WP4aXWrTPoFGqtsCAf8Wyw.png" /></figure><p>Next up is creating a cluster. Click on the green button that says “Build a Cluster”. It will then ask you what type of cluster you want to create.</p><p>-Starter Cluster</p><p>-Single-Region Cluster</p><p>-Multi-Region Cluster</p><p>We will go with a Starter Cluster since it is free and we will only be using it for a personal project.</p><p>Then it will ask what cloud provider you would like to use. For my case I will be using Google’s Cloud Platform, you have the option to choose AWS or Azure. I will be using the “Iowa” region since it has the “free tier available” tag. You do not need to touch the Cluster Tier or the Additional Settings. Feel free to change the Cluster Name if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*syjVuNKSgO5zRQsciEINeQ.png" /></figure><p>It may take 1–3 minutes for the cluster to be created. Once it is done you should be greeted with the following screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aiNw9fr36mri3He8LkQiPg.png" /></figure><p>Click on the “Connect” button right under the cluster name. It will give you 3 options to connect to it from your application. I will be going with the 2nd one “Connect Your Application”, this option will give you a connecting string and examples on how to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uU8I6054WF_inA3eJIyBXg.png" /></figure><p>Driver option should be set to Node.js and the version should be 3.0 or later. You will need to copy the connection string.</p><p>Example of what my connection string looks like:</p><p><em>“mongodb+srv://SergioP:&lt;password&gt;@cluster0–41rmx.gcp.mongodb.net/test?retryWrites=true&amp;w=majority”</em></p><p>You will need to change the &lt;password&gt; text with your password that you set up when creating the MongoDB Atlas user.</p><h3>Connecting it to your application</h3><p>I have a simple NodeJS application with one route for example purposes. Preferable you will want to connect to the MongoDB Atlas cluster before Node listens for your server.</p><p>Also keep in mind that we will be using mongoose to connect. So if you need to install it you can do so with the following command lines.</p><pre>npm install mongoose</pre><p>And require it in your server js file.</p><pre>const mongoose <strong>=</strong> require(&#39;mongoose&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEBa1vQ3WdqZIBDKccC18A.png" /></figure><p>Now with the connection string we copied we will insert the following code:</p><pre>const uri = “YOUR CONNECTION STRING“;<br></pre><pre>mongoose.connect(uri, {</pre><pre>  useNewUrlParser: true,</pre><pre>  useUnifiedTopology: true</pre><pre>})</pre><pre>.then(() =&gt; {</pre><pre>  console.log(‘MongoDB Connected…’)</pre><pre>})</pre><pre>.catch(err =&gt; console.log(err))</pre><p>Using the connect method that mongoose provides us with we are first passing in the connection string. Then we are passing some parameters useNewUrlParser and useUnifiedTopology.</p><p>The connect method will return a promise, we will need to handle that promise. Attaching a “.then” after the method we can console.log a success message if all goes well. We have also attached a “.catch” after, that will catch any errors if we cannot connect to our MongoDB Atlas Cluster.</p><h3>Last Step Network Access</h3><p>This last step is still a bit tricky for me and I assume it acts as an extra step of security. Back on the MongoDB Atlas dashboard click on “Network Access” under “Security”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkybu-Xzy3-up9_OlFDvKw.png" /></figure><p>You want to click on “Add Current IP Address” and it will automatically generate your IP address into the field, then click “confirm”. You also do have the option to allow access from anywhere. I used this a couple times when I was testing out my connection. MongoDB will email you and tell you how dangerous this is. So I do not recommend it unless you are quickly testing it.</p><h3>Conclusion</h3><p>You should be able to run your node server now and should be receiving your success message in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lw-bj-eVUmQozxQxZLOSzw.png" /></figure><p>I have not deployed my project where I am using this MongoDB Atlas Connection so I am uncertain if it will break once it gets deployed.</p><p>Also, I have had to log back into the MongoDB dashboard and update my IP address when I work in a different location.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1381f184369" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Meme Searcher using React]]></title>
            <link>https://medium.com/@sergio13prez/creating-a-meme-searcher-using-react-7a563e55804f?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a563e55804f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Thu, 12 Dec 2019 14:03:16 GMT</pubDate>
            <atom:updated>2019-12-12T17:30:44.756Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I have become a fan of memes currently circulating social media. Especially the “baby yoda” meme. I do find myself using memes in group chats and find that some memes are perfect replies! However, I sometimes forget the name of the meme or forget the tweet where I saw the meme being used.</p><p>I wanted to create a Meme Searcher to help with this, luckily I was able to find a pretty easy meme api called <a href="https://api.imgflip.com/">Imgflip API</a>. After skimming through the docs for the API, I found an endpoint that would give me back an array of 100 memes. These memes were ordered by how many times they were captioned in the last 30 days. This is the PERFECT data I need, it is giving me back the most used memes in the last month.</p><h3>Getting Started</h3><p>I wanted to use React since it does help whip up a simple application relatively fast. First I need to create a new react app on my computer, we can use the following command line prompt.</p><pre>npx create<strong>-</strong>react<strong>-</strong>app meme-seacher</pre><p>It handles creating the basic file structure, and executes an initial npm install. You can now run npm start and it will run the application on your local host.</p><h3>Building the React App</h3><p>First thing I like to do after creating a new react app. Is to set up the react component tree and whip up a simple wireframe.</p><pre>The App tree :</pre><pre>-App</pre><pre>  -SearchContainer</pre><pre>  -ResultsContainer</pre><pre>  -MemeCard</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EE0Z4Gd7qKofeW6oOLMWFg.png" /></figure><p>The SearchContainer will contain the header and the search input. The ResultsContainer will contain the MemeCard component which will render the meme image and the meme name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*sxeIetSTk6O_LgQ4m4Tykg.png" /></figure><p>Now the create the components I like to create them as class components but that is just a personal preference. I usually just like to return a div with the text of what component they are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VLxY9RBL9B4yVbLefWj-A.png" /></figure><p>In the image above you can see the SearchContainer component that was created and the App.js file which imports that container along with the ResultsContainer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SzOm9Dbgt05cGXcMIAfZlA.png" /></figure><p>In the image above you can see the ResultsContainer and the MemeCard components. The MemeCard lives inside the ResultsContainer, later on we will be mapping through the meme data to create multiple MemeCard components.</p><p>Now if you open up the console of the in the browser you can see the component hierarchy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwKxV1mzd3b0vZKYcGtp3w.png" /></figure><h3>Pulling and Rendering the Data</h3><p>Alright now that we have everything set up we have to think about where the state is going to live in our React application. Since both our SearchContainer and ResultsContainer need to know and manipulate the state, it will live in the App.js file.</p><p>The SearchContainer needs to be able to manipulate the the meme data and filter out only the memes that contain the search word. While the ResultsContainer needs to render those filtered memes.</p><p>As decided the state of our React application will be in the App.js. For now we can define the state with empty values. The state will have a “allMemes” key and it will be set to an empty array. This is where we will have the memes once we pull from the API. The state will also have “searchText” key and it will be set to an empty string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4uZnCGFx8nl2FyaVUTYoTw.png" /></figure><p>Next comes the fun part which is finally getting the data from the api. In our App.js file we will create a componentDidMount() function which basically works as a “DOMContentLoaded”. It waits for out components to load and then pull the data.</p><p>In the componentDidMount() function we will make a fetch to <a href="https://api.imgflip.com/get_memes">https://api.imgflip.com/get_memes</a> this will be a get request and it gives us back a meme array of 100 objects. At the end of our fetch we will be updating our state using “this.setState” and we’ll change the “allMemes” key in our state from empty to the meme array we just received from the get request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KSFZYdoCUjtLXXM3OO9kuA.png" /></figure><p>Now if you check the state in the console you can see we have objects in our allMemes array. Each object has id, width, height, name and url. We can now use this data to create the MemeCard components.</p><p>Since our array data is in our App state. We need to pass down the info as a prop to the ResultsContainer where we will map through that array to create a new array of MemeCards.</p><pre> &lt; ResultsContainer memesArray={this.state.allMemes}/&gt; </pre><pre><br>class ResultsContainer extends React.Component{<br>   render(){</pre><pre>     return (</pre><pre>      &lt;div&gt;This is the Results Container</pre><pre>      {this.props.memesArray.map(meme =&gt; {</pre><pre>      return &lt; MemeCard key={meme.id} memeObject={meme}/&gt;</pre><pre>       })}</pre><pre>     &lt;/div&gt;</pre><pre>     )</pre><pre>    }</pre><pre>  }</pre><p>In the code snipped above you can see we are now mapping through the passed prop and returning a new array of MemeCards to be displayed.</p><p>Now we just have to render the images and title in the MemeCard component.</p><pre>class MemeCard extends React.Component {</pre><pre>  render(){</pre><pre>    return (</pre><pre>     &lt;div&gt;</pre><pre>      &lt;h1&gt;{this.props.memeObject.name}&lt;/h1&gt;</pre><pre>      &lt;img alt=&quot;meme&quot; src={this.props.memeObject.url}&gt;&lt;/img&gt;</pre><pre>    &lt;/div&gt;</pre><pre>    )</pre><pre>  }</pre><pre>}</pre><pre>export default MemeCard</pre><p>In the following code snippet we now our rendering the meme name and the meme name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vNHVH5C4wxRJd77SKLMXyw.png" /></figure><h3>Creating the Search Functionality</h3><p>In our SearchContainer we need to create a form with a text input to take in the text the user wants to look for.</p><pre>&lt;div&gt;</pre><pre>  &lt;h1&gt;Meme Searcher&lt;/h1&gt;</pre><pre>  &lt;form&gt;</pre><pre>  &lt;input type=&quot;text&quot;&gt;&lt;/input&gt;</pre><pre>   &lt;/form&gt;</pre><pre>&lt;/div&gt;</pre><p>Now we have to create a search class function in app that will update the states search text depending on what the user types in the input field.</p><pre>searchMemes = (event) =&gt; {</pre><pre>  this.setState({</pre><pre>  searchText: event.target.value</pre><pre>  })</pre><pre>}</pre><p>We will pass down this function into the SearchContainer as a prop. It will be used by the input field. We want it to fire off on change so we will use React’s “onChange” event listener.</p><pre>&lt;form&gt;</pre><pre>  &lt;input onChange={(event) =&gt; this.props.searchMemes(event)}</pre><pre>   type=&quot;text&quot;&gt;&lt;/input&gt;</pre><pre>&lt;/form&gt;</pre><p>Now that state is being updated depending on what is being typed in the input field. The last thing step to do is to filter through the memesArray we are passing to the results container by the search text that was entered.</p><pre>&lt; ResultsContainer memesArray={this.state.allMemes.filter(meme =&gt; meme.name.includes(this.state.searchText))}/&gt;</pre><p>With the code above the memesArray is now being filtered but after testing it, it does look like it is case-sensitive. I am not a fan of using capitalizing in my searches so to fix that we will just manipulate the name of the meme.</p><p>In our memesArray prop we are passing to the resultsContainer, inside the filter function we will change the meme.name to all lowercased using .toLowerCase()</p><p>Now our ResultsContainer inside of app looks like this :</p><pre>&lt; ResultsContainer memesArray={this.state.allMemes.filter(meme =&gt; meme.name.toLowerCase().includes(this.state.searchText) ) }/&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KYZHa-tY9gJafqcNNJ7Fmg.gif" /></figure><p>And that is it, now we have a fully functional meme searcher. I will add some styling to clean it up but we technically are done with the app.</p><p>You can check out the finished product at the following GitHub repository:</p><p><a href="https://github.com/Nihaprezz/meme_searcher.git">https://github.com/Nihaprezz/meme_searcher.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a563e55804f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Grid Mini Intro]]></title>
            <link>https://medium.com/@sergio13prez/css-grid-mini-intro-52fd1101df65?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/52fd1101df65</guid>
            <category><![CDATA[grid-layout]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[grid]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 16:45:51 GMT</pubDate>
            <atom:updated>2019-11-21T16:45:51.908Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-I_FRNa3xGkNWjO-sLCahw.png" /></figure><p>Recently I have been using CSS grid a lot more to set up my HTML pages and honestly it has made my life so much easier. I no longer waste hours trying to position elements on the HTML page.</p><p>I will be going over how to set up a basic CSS grid layout, its basic properties and the properties I find myself using a lot.</p><h3>What is CSS grid?</h3><p>CSS grid is layout method that supports a 2-dimensional system. Basically what that means is it can handle both columns and rows. Unlike Flexbox which is a 1 — dimensional system, it can only handle a row (Flexbox is still great if you were to be working with only one row). CSS grid gives you more control of your layout, you can assign rules to the parent and to the child elements of the parent</p><h4>Setting up the Grid Container</h4><p>First of all you would have to set up your page inside of a ‘container’ div. You can give this ‘container’ div whatever class or ID you want. Just make sure you give it the property of ‘display: grid’. This will now make any elements inside of the ‘container’ div a grid child element (item). For demo/example purposes I have 4 divs inside of the main ‘container’ div which we will manipulate. The main container also has a blue border styling so we can visual see where the container is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RgZQyQMsfXujYE6RsCjegg.png" /><figcaption>Starter Code</figcaption></figure><p>Also quick tip that has helped me a lot is if you use google chrome and inspect the page the grid elements will have a dashed border around them. I have also read that Firefox has some really good CSS Grid tools in their browser (I have not used their browser so I cannot vouch for it 100% ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlW8E89-5dWb2OM_8m6N3g.png" /><figcaption>A dashed border shows up when you inspect a grid element</figcaption></figure><p>Now that our container knows it will be a grid we can start assigning it grid properties. The main three that are commonly used are grid-template-columns, grid-template-rows, and grid-template-areas.</p><h4>Grid Template Columns</h4><p>Grid-template-columns defines how many columns you want in the layout. You define the column with a size. You can use any size types. The main ones I use are px, %, fr and auto. So how would the CSS look? The syntax might trip you up at first but I promise its not as funky as it looks and it becomes easier to understand the more you play with it.</p><p>To define the columns using grid-template-columns you would do :</p><pre>grid-template-columns: 50px 50px;</pre><p>In the above code example two columns have been defined each with a width of 50px.</p><p>Say you want 3 columns, that can just be added to the grid-template-columns property with another size attribute.</p><pre>grid-template-columns: 50px 50px 50px;</pre><p>As I mentioned before the syntax can be a bit tricky at first but all we are doing is telling the grid container that we want another column by just adding another sizing attribute. (The space in between the size attributes does matter.)</p><p>The sizing attribute you decide to use is up to you. I would recommend using %, auto or fr if you want the columns to be responsive.</p><pre>Example:</pre><pre>grid-template-columns: 20% 50% auto</pre><p>In the above example the first column will be 20% of the screen, the second column will be 50% of the screen, and the third one by giving it ‘auto’ it will use the remaining width of the screen which in this case will be 30%. Since our first 2 columns take up 70% together.</p><pre>Example:</pre><pre>grid-template-columns: 1fr 1fr 50%</pre><p>In the above example I am using ‘fr’ for the size attribute. Fr means fraction of the screen, so in the above code. I have two columns that will each take up 2 fractions of the screen. Since my third column is at 50% the first column which is 1 fr will take 25% and the second column which is also set tot 1fr will also take another 25% of the screen. For a more in detail description of FR I would check out the following post : <a href="https://css-tricks.com/introduction-fr-css-unit/"><em>https://css-tricks.com/introduction-fr-css-unit/</em></a></p><p>For our demo I will be setting up 2 columns. Each with a size of 50%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlreUdcoiLXTIcBhasTBjw.png" /></figure><h4>Grid Template Rows</h4><p>Grid-template-rows does generally does the same thing as grid-template-columns but instead of columns you will be defining rows (height). You define the rows with a size attribute. The columns also take in the same size attributes px, %, fr and auto.</p><pre>Example:</pre><pre>grid-template-row: 30% 40% auto</pre><p>In the above code example we are making 3 rows. First row will take 30% of the height of the screen, the second row will take 40% of the height of the screen and the last container will take the remaining height of the screen since its sizing set to ‘auto’. In this case the third row will be 30% since the first two rows take up 70% all together.</p><p>For our demo will be defining two rows. The first row will be 30% and the second row we will be set to auto.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkOLUyHr2TbL4S9lBWjPmw.png" /></figure><p>In the above picture we inspecting the page and we can see the first row is smaller than the second row because it is set to 30% and the second row is set to auto which takes the remaining height of the screen.</p><h4>Grid Template Areas</h4><p>As of right now our demo layout looks pretty legit with 2 rows and 2 columns. However if we want to be more specific one which row or column is which we can use grid-template-areas. It can be used to name the grid areas you currently have and pass them on the appropriate child element using ‘grid-area’.</p><pre>Example:</pre><pre>grid-template-areas:</pre><pre>“item-a item-b”</pre><pre>“item-c item-d”</pre><p>In the above example you are going through each row and defining the name for that area. Think of it as a 2x2 grid sheet of paper. You have 4 cells in your 2x2 layout. The first cell in the first row of the grid is defined to item-a, the second cell in the first row of the grid is defined to item-b, the first row in the SECOND row of the grid is defined to item-c, and the second cell in the SECOND row is defined to item-d.</p><p>Now you have these named grid areas consisting of item-a, item-b, item-c and item-d. You can now pass these names to the children elements using the ‘grid-area’ property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBgz5g5v5QYOljDJW8P7jA.png" /></figure><p>In the above picture you see the grid-area name being applied to the respective div. This makes the grid-area more specific. Now wherever the grid-area name is defined that div will move to that cell that was defined in the grid-template-area. This was a very hard concept to understand but if you mess around with mismatching the grid-area names to different divs you will see the cells change in the layout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_B2bLQFpST79UWcC754Mw.png" /></figure><p>In the above picture I switch the grid-area names of div-2 and div-4. You can see that their cells were moved in the layout because of the switched grid-area name.</p><h4>Properties to manipulate the children/grid items</h4><p>The following properties are useful for positioning any elements inside of grid-items. For our demo will now have a div inside of the all the grid-items that we will manipulate using the child/grid item properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RPvxZ40VNCJp0KN0yKlQ9g.png" /></figure><p>In the above picture there is a green border around the div inside of the grid items for visual representations.</p><p>On the grid container CSS selector you can use <strong>grid-column-gap </strong>and <strong>grid-row-gap</strong> which add gaps between the cells.</p><pre>Example:</pre><pre>grid-column-gap: 10px</pre><pre>grid-row-gap: 20px</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1e3BXLZIPLUig1hJi4IuSg.png" /></figure><p>In the picture above you can see the minimal gaps in between the cells.</p><p>Another property is <strong>justify-items</strong>. This property can also be defined on the grid container. It aligns items along the inline (row) axis. This value applies to all grid items inside the container. It takes in the following values: start, end, center, and stretch.</p><pre>Example:</pre><pre>justify-items: center;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9haIOzzHOoV8kQN4MzRtQ.png" /></figure><p>In the picture above you can see that the divs were all centered to the middle of their grid item container.</p><p>Another property is <strong>align-items</strong>. This property is also defined on the grid container. It aligns all grid items along the block (column) axis. It takes in the following values as well: start, end, center, and stretch.</p><pre>Example:</pre><pre>align-items: center;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJ5IWFfzZ57CQaun0v_gXw.png" /></figure><p>In the above picture you can see that the divs inside the grid items have all been centered vertically.</p><h4>Conclusion</h4><p>I just went overviewed some of my favorite components of CSS grid building a simple 2x2 layout. If you are looking for a more in detail post I highly recommend the following article on CSS tricks, <a href="https://css-tricks.com/snippets/css/complete-guide-grid/">https://css-tricks.com/snippets/css/complete-guide-grid/</a>. When I was first learning about CSS grid I used the article a lot and even now I still go back to it whenever I need clarification on a grid property.</p><p>You can find the demo layout that was coded out in this blog post on code pen<a href="https://codepen.io/Nihaprezz/pen/PooLKox">: https://codepen.io/Nihaprezz/pen/PooLKox</a></p><p>Other CSS Grid Layout examples :</p><p><a href="https://codepen.io/Nihaprezz/pen/BaabbJx">https://codepen.io/Nihaprezz/pen/BaabbJx</a></p><p><a href="https://codepen.io/Nihaprezz/pen/jOOJJXR">https://codepen.io/Nihaprezz/pen/jOOJJXR</a></p><p><a href="https://codepen.io/Nihaprezz/pen/pooYBvz">https://codepen.io/Nihaprezz/pen/pooYBvz</a></p><p>I do recommend playing around with the properties and feel free to fork any of my codepens!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52fd1101df65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fetching Them All / Poke API]]></title>
            <link>https://medium.com/@sergio13prez/fetching-them-all-poke-api-62ca580981a2?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/62ca580981a2</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[pokemon]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Thu, 07 Nov 2019 21:17:46 GMT</pubDate>
            <atom:updated>2019-11-26T18:42:13.680Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fetching the original Pokemon using the Poke API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lXH0CroMTAQKIfDzn-brPw.png" /></figure><p>One of the main things I wanted to learn when joining Flatiron was how to manipulate an API and use that data to make a web application. One of the main API’s I wanted to use was the Pokemon API. To my surprise everyone who I talked to in reference to the Pokemon API has told me it is such a hassle to work with. Since it is a nested API and you will have to make multiple calls with it.</p><p>First thing is reading through the docs of the Poke API (<a href="https://pokeapi.co/docs/v2.html">https://pokeapi.co/docs/v2.html</a>) to get an understanding of how to make the API calls and how to get/extract the data that you need. Just like any other API the Poke API does have a lot of data that I will not be using.</p><h3>Overview</h3><p>I will be making a small application that shows the original 151 Pokemon on a single page. Every Pokemon will have a card like styling. Every Pokemon card will have the name, picture, their number, and their type. I will be using <a href="https://semantic-ui.com/">Semantic </a>to generate the card stylings.</p><p>The set up for this application will consist of one HTML file, a JavaScript file and a CSS file. I will be fetching the data from the API and will be using DOM manipulation to create the individual cards.</p><h3>Starting to code out the Application</h3><p>First fetch will be too ‘<a href="https://pokeapi.co/api/v2/pokemon?limit=151&#39;">https://pokeapi.co/api/v2/pokemon?limit=151&#39;</a>, luckily the Poke API lets us pass in a query parameter which is ‘limit’ which just like the name suggests lets us limit the Pokemon to 151 which is exactly what we are looking to do.</p><pre>function fetchKantoPokemon(){</pre><pre>  fetch(‘https://pokeapi.co/api/v2/pokemon?limit=151&#39;)</pre><pre>  .then(response =&gt; response.json())</pre><pre>  .then(allpokemon =&gt; console.log(allpokemon))</pre><pre>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCfPyo_SlOy3W1TQ1cBwkw.png" /><figcaption>Console.log the data returned from the API fetch.</figcaption></figure><p>First thing I like to do is to console.log the data I received from the API to make sure it is what I think it is. From the examples above you can see the console does log all 151 Pokemon in an array. Unfortunately it looks like this first call only gave us the name of the Pokemon and another url for every Pokemon dataset. Another fetch has to be made to every Pokemon’s url to get their data(type, number, etc). For example if we wanted to get Bulbasaur’s info another fetch call will have to be made to the following url <a href="https://pokeapi.co/api/v2/pokemon/1/">https://pokeapi.co/api/v2/pokemon/1/</a>. Since the info is in an array of hashes, a method can be made that will go trough that array and make the fetch calls to those URLs.</p><pre>function fetchKantoPokemon(){</pre><pre> fetch(&#39;https://pokeapi.co/api/v2/pokemon?limit=151&#39;)</pre><pre>  .then(response =&gt; response.json())</pre><pre>  .then(function(allpokemon){</pre><pre>  allpokemon.results.forEach(function(pokemon){</pre><pre>    fetchPokemonData(pokemon); </pre><pre>  })</pre><pre> })</pre><pre>}</pre><p>In the above code example, it is now going through every Pokemon in the results array using the forEach method and the hash ( hash example: {name: “bulbasaur”, url: “<a href="https://pokeapi.co/api/v2/pokemon/1">https://pokeapi.co/api/v2/pokemon/1</a><a href="https://pokeapi.co/api/v2/pokemon/1/">/</a>“} ) is being sent to the fetchPokemonData function, which is where we will make the second fetch call to get the details of every Pokemon.</p><pre>function fetchPokemonData(pokemon){</pre><pre>let url = pokemon.url // &lt;--- this is saving the pokemon url to a      variable to us in a fetch.(Ex: https://pokeapi.co/api/v2/pokemon/1/)</pre><pre>  fetch(url)</pre><pre>  .then(response =&gt; response.json())</pre><pre>  .then(function(pokeData){</pre><pre>  console.log(pokeData)</pre><pre>  })</pre><pre>}</pre><p>In the above code example the fetchPokemonData method is taking in a Pokemon hash as the parameter. It saved the pokemon.url to a variable which we use in the fetch call. Again I used console.log to make sure it is receiving the right data which in this case is the data in the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cLeWwuZQSPz_2ZsrmTJgA.png" /><figcaption>Example of the data received for when a fetch call is made for an individual Pokemon.</figcaption></figure><p>Now that we know the data is coming in the right way we can start to extract the data from the hash and start printing it out to the HTML.</p><pre>function renderPokemon(pokeData){</pre><pre>let allPokemonContainer = document.getElementById(&#39;poke-container&#39;);</pre><pre>let pokeContainer = document.createElement(&quot;div&quot;) //div will be used to hold the data/details for indiviual pokemon.{}<br></pre><pre>let pokeName = document.createElement(&#39;h4&#39;)</pre><pre>pokeName.innerText = pokeData.name</pre><pre>let pokeNumber = document.createElement(&#39;p&#39;)</pre><pre>pokeNumber.innerText = `#${pokeData.id}`<br></pre><pre>let pokeTypes = document.createElement(&#39;ul&#39;) <br>//ul list will hold the pokemon types</pre><pre>createTypes(pokeData.types, pokeTypes) <br>// helper function to go through the types array and create li tags for each one</pre><pre>pokeContainer.append(pokeName, pokeNumber, pokeTypes);   <br>//appending all details to the pokeContainer div</pre><pre>allPokemonContainer.appendChild(pokeContainer);       <br>//appending that pokeContainer div to the main div which will                                                             hold all the pokemon cards</pre><pre>}</pre><p>In the following code example above all of the HTML elements were made and the inner text of each one was assigned to the Pokemon data which we passed in as a parameter. At the end of the function we are appending all the elements to the container DIV for it to show on the DOM. We also used a helper method called createTypes for the types of every Pokemon, since the types came in as an array for those Pokemon that have more than one type. In the function we use a forEach to go through every type in an array, create a new Li(list item) element, make the inner text of that Li to the type name and append that Li to the Ul(unordered list). Code shown below.</p><pre>function createTypes(types, ul){</pre><pre>  types.forEach(function(type){</pre><pre>  let typeLi = document.createElement(&#39;li&#39;);</pre><pre>  typeLi.innerText = type[&#39;type&#39;][&#39;name&#39;];</pre><pre>  ul.append(typeLi)</pre><pre>  })</pre><pre>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MWmey1cqqeyGrjIQN6LOg.png" /><figcaption>Data now being rendered to the DOM (HTML page)</figcaption></figure><p>Finally some info is now being shown on the HTML! In the screenshot shown above. However, it looks like we are missing the image for the Pokemon. The Poke API does have sprites it can render but they show a bit small and the sprites have an old school feel to them. For the images we will be using the <a href="https://pokeres.bastionbot.org/">https://pokeres.bastionbot.org</a> Pokemon (Pokeres) API. To use their API you would usually have to require some headers but luckily since we are only getting the images from them we do not need to add any headers or make a fetch call.</p><p>For each Pokemon we will be creating a new image tag, setting the source to the pokers url and appending that image tag to the container DIV. For example setting the image source to <a href="https://pokeres.bastionbot.org/images/pokemon/1.png">https://pokeres.bastionbot.org/images/pokemon/1.png</a> will give us an image of Bulbaser. Code shown below.</p><pre>function createPokeImage(pokeID, containerDiv){</pre><pre>  let pokeImage = document.createElement(&#39;img&#39;)</pre><pre>  pokeImage.srcset =    `https://pokeres.bastionbot.org/images/pokemon/${pokeID}.png`</pre><pre>  containerDiv.append(pokeImage);</pre><pre>}</pre><p>Now the images are loaded for each Pokemon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH8Ax7ZCJkgj8d3ldAuzTw.png" /></figure><p>And that is it! The HTML page is now showing the Pokemon name, number, types and the picture. Now with some Semantic classes we will turn it into a more visually appealing page. I will not go through the styling process but if you need to reference it you can check the GitHub linked at the bottom of the post. You can choose not to use semantic and style it in your own way with another CSS framework.</p><p>Github Repo : <a href="https://github.com/Nihaprezz/kanto-pokemon">https://github.com/Nihaprezz/kanto-pokemon</a></p><p>Example of how my page came to look with Semantic UI’s minimalist styling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LvC-N5iv5YTeoZ5DF_QPpA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62ca580981a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Form Input Types and Elements]]></title>
            <link>https://medium.com/@sergio13prez/form-input-types-and-elements-4a026d8bfacb?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a026d8bfacb</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Thu, 17 Oct 2019 13:43:20 GMT</pubDate>
            <atom:updated>2019-10-17T13:43:20.221Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*uOni8fZR8FDT-xDIMwpxAQ.png" /></figure><p>Recently I have been coding up so many HTML forms I feel like I know how to set up a form in my sleep. However, after looking more into the &lt;form&gt; tag I realized that it has more elements and input types than just the regular text field input I’m used to using. (In the examples I do use a lot of &lt;br&gt; tags to create a line break in the HTML document for a cleaner looking form.)</p><p>I will go over the most common used input types and form elements that I have come across:</p><p>Input Types — Input type is probably the most common element you see inside the form tags. It has a variety of types you can use. I will go over some of the more common ones.</p><p>Type text — This is the default input type. It’s a single line text field, the default width of the text field is 20 characters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rnFktAV2cduHwin0hxN_dA.png" /><figcaption>Example of the text type and submit type. ( &lt;br&gt; tags used to put the next input on the next line)</figcaption></figure><p>Type submit — This type defines a submit button which submits all form values to a form handler. Only clicked on when the user wants to submit the form to the server.</p><p>Type password — This type defines a password field. When typing in the field the characters become masked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fVMQW2rMDXXAGaTdIOmyQ.png" /><figcaption>Form using the password input type.</figcaption></figure><p>Type reset — This type is rendered as a button. Once clicked it resets all of the inputs in the form to their initial values.</p><p>Type radio — This type presents radio buttons which allow a user to only select one option from a limited number of choices. They come in radio groups and only one radio button in a group can be selected.</p><p>Type checkbox — This type is rendered by default as a square box that are checked when activated. They are used to allow the user to select one or more options from a limited number of choices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5J2jxDwc3fkyBQ5C4XP4yw.png" /><figcaption>Form using radio and checkbox input types.</figcaption></figure><p>Type date — This created an input field which lets the user enter a date or use a special data picker interface. The resulting value includes the year, month, and day.</p><p>Type email — Creates a field for an e-mail address. The input value is validated to ensure it is a properly formatted e-mail address.</p><p>Type number — This type allows a use to enter a number. It has a built in validation to reject non numerical entries. Some browsers provide a stepper arrow to let the user increase or decrease the value by tapping on the arrows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkzUfKut64-XjrDABFsqrA.png" /><figcaption>Form using date, number, and email input types. Example of select and option tags being used.</figcaption></figure><p>Required — When this attribute is added to an input field it specifies that the input field must be filled out before submitting the form.</p><p>Textarea — Creates a multi-line input control. This is useful when you want the user to enter a sizeable amount of free-form text.</p><p>Select/Option — The select tag is used to create a drop down list. It holds the option tags which will be the values you want to show in the drop down list. The option tags should have a value attribute. Once the user clicks submit that value attribute is what will be passed to the server.</p><p>I coded out these examples on codepen.io which is online code editor. I would recommend you play around with the input types and form elements in your code editor or on<a href="https://codepen.io/"> codepen.io</a> just make sure to not hit the submit button if you are using codepen.</p><h4>Useful Links For More Info:</h4><p><a href="https://www.w3schools.com/tags/tag_form.asp">W3Schools.com</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form">MDN Web Docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a026d8bfacb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How CSS Images helped me practice CSS attributes]]></title>
            <link>https://medium.com/@sergio13prez/how-css-images-helped-me-practice-css-attributes-a5b15078f6e6?source=rss-7cdee254cdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5b15078f6e6</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[illustration]]></category>
            <dc:creator><![CDATA[Sergio Perez]]></dc:creator>
            <pubDate>Thu, 03 Oct 2019 01:27:09 GMT</pubDate>
            <atom:updated>2019-10-03T03:27:01.263Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Pure CSS Bee Imahe" src="https://cdn-images-1.medium.com/max/1024/1*CBEwjmbmptlmOlN6u9AoDA.png" /><figcaption><a href="https://codepen.io/Nihaprezz/full/QxqxRN">Pure CSS Bee Image</a></figcaption></figure><p>On my journey of learning how to code I have always leaned more to the frontend side of web development. Growing up I have always liked to draw and the visuals from CSS really got me hooked. While learning CSS tricks and best practices through Google or Medium posts I came across pure CSS Images. I immediately wanted to give it a try.</p><h4>What are pure CSS images?</h4><p>They are images/illustrations that were built entirely from HTML and CSS only.</p><p>You use simple HTML div elements to create the shapes and set up the base for the images/illustrations. Then you use CSS attributes to give the HTML divs the style needed. You will create many HTML divs when you begin to create the shapes needed to built out the image you want. Once you get the hang of the process you will be using less divs and more CSS attributes.</p><p>While looking into CSS images and trying to figure out how to start I came across blogs, articles and projects which have helped me along the way. The Coding Artist “<a href="https://medium.com/coding-artist/a-beginners-guide-to-pure-css-images-ef9a5d069dd2">A Beginner’s Guide to Pure CSS Images</a>” goes into depth on how to create your first pure CSS image step by step which is a Koala.</p><p>One of the projects I came across was Lynn Fisher’s “<a href="https://a.singlediv.com/">A Single Div</a>” CSS drawing project. She uses one single HTML div to create some amazing illustrations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9kKSHNQSgzimPsWQzUafkA.png" /><figcaption><a href="https://codepen.io/Nihaprezz/full/gzKoMW">First CSS Image I created with no tutorial</a>.</figcaption></figure><h4>Why CSS images?</h4><p>At first I just wanted a way to create illustrations while continuing to learn how to code. I did find out that you could use SVG and use applications like Sketch to make illustrations. However, there’s no fun in that. Creating CSS images is a great way to to learn new CSS attributes and also a great way to use some of the CSS attributes you already know in ways you probably didn’t think of.</p><p>For example, I learned how to use the relative and absolute position attributes to move HTML divs to where I want them to be on the page. How Z indexes can be used to stack HTML divs on top of each other and choose which div I want on top. How the border-radius attribute can be used to round the edges of a border but also can be used to create full circles. Other CSS attributes would be box-shadow, overflow, before/after pseudo elements, and many more. Now when I am creating a website I will at times go back to my CSS images to reference how I used a CSS attribute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kMrNxkS3QPst69-wTztAoA.png" /><figcaption>Pure CSS House. Example of how the CSS code will look like.</figcaption></figure><p>In conclusion, there is are “faster” and “easier” ways to create illustrations/images on the web. However, CSS images will help you practice the attributes and help you get a better understand of how/when to use the attributes. Also, you get to create some really cool images out of just CSS and basic HTML which is really fun and a great way to get your creative juices flowing. I will continue to create CSS images for fun and hope you get inspired to try to create some of your own as well. P.S. I have found <a href="https://dribbble.com/">dribbble</a> to be a great inspiration source.</p><h4>Tools and References</h4><p><a href="https://codepen.io/"><em>Codepen</em></a><em> — Great for coding out ideas on the fly and for inspiration.</em></p><p><a href="https://bennettfeely.com/clippy/"><em>Clippy </em></a><em>— Can be used to create some odd shapes.</em></p><p><a href="https://www.w3schools.com/css/"><em>W3Schools.com</em></a><em> — Great for learning more CSS attributes and they have examples.</em></p><p>Lets connect: <a href="https://twitter.com/nihaprezz">Twitter</a> | <a href="https://codepen.io/Nihaprezz">Codepen</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5b15078f6e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>