<?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: Jared Weiss</title>
    <description>The latest articles on DEV Community by Jared Weiss (@jaredcodes).</description>
    <link>https://dev.to/jaredcodes</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%2F1271055%2F9c6df756-6f8d-447e-bf30-4640b1ae9a4b.jpeg</url>
      <title>DEV Community: Jared Weiss</title>
      <link>https://dev.to/jaredcodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaredcodes"/>
    <language>en</language>
    <item>
      <title>Introducing Songzy: The Fun New Way to Share and Explore Music!</title>
      <dc:creator>Jared Weiss</dc:creator>
      <pubDate>Mon, 27 May 2024 06:56:18 +0000</pubDate>
      <link>https://dev.to/jaredcodes/introducing-songzy-the-fun-new-way-to-share-and-explore-music-e5n</link>
      <guid>https://dev.to/jaredcodes/introducing-songzy-the-fun-new-way-to-share-and-explore-music-e5n</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/awschallenge"&gt;The AWS Amplify Fullstack TypeScript Challenge &lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Hey everyone! I’m excited to share my project &lt;strong&gt;Songzy&lt;/strong&gt; with you!&lt;/p&gt;

&lt;p&gt;Given the tight time window and only being able to work on this part-time, it’s obviously a work in progress, but I’m really proud of how it has come along. &lt;strong&gt;Songzy&lt;/strong&gt; is an app where you can upload your own music and explore new tracks in an innovative way.&lt;/p&gt;

&lt;p&gt;The explore page is my favorite part — there's a slider that lets you zoom out to see more songs, creating a giant, interactive grid of cover art. It’s a fun way to discover music, and I hope you’ll enjoy it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo and Code
&lt;/h2&gt;

&lt;p&gt;You can visit the deployed project &lt;a href="https://main.d2bsexmw70kjx2.amplifyapp.com/"&gt;here&lt;/a&gt; and the code &lt;a href="https://github.com/jmw1493/songsy"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is a screenshot tour of the app so far:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Login
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsephz4ycphg5sb0e4li.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsephz4ycphg5sb0e4li.png" alt="Login Page" width="800" height="814"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Upload a song with title, cover art, and audio file
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdkk808n1xdrwdxgw14t8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdkk808n1xdrwdxgw14t8.png" alt="Upload Song" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. See your songs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc52o9l0z0pe9kbmhio0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwc52o9l0z0pe9kbmhio0.png" alt="See Your Songs" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Explore others’ songs. Just hover (desktop) or click (mobile) on one to play it.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F980okcmgw59vsg58iikb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F980okcmgw59vsg58iikb.png" alt="Explore Songs" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Drag the slider and see even more songs!
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbulg62579yr7kafiv6k7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbulg62579yr7kafiv6k7.png" alt="Drag slider to see even more songs" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;p&gt;Amplify's &lt;code&gt;Authenticator&lt;/code&gt; component made handling user login and sign-up processes incredibly simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data
&lt;/h3&gt;

&lt;p&gt;I utilized Amplify’s &lt;code&gt;defineData&lt;/code&gt; function and schema creation to set up and manage the data models for &lt;strong&gt;Songzy&lt;/strong&gt;. This approach allowed me to hook up the schema and generate queries effortlessly. Figuring out the authorization allowances took a bit of time, but once sorted, it provided a straightforward solution for managing access.&lt;/p&gt;

&lt;h4&gt;
  
  
  An Interesting Use Case
&lt;/h4&gt;

&lt;p&gt;On the Explore Page, I needed to programmatically adjust my query as the slider is dragged. I enjoyed that Amplify’s querying syntax made it simple enough to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filter out songs that did not belong to the user.&lt;/li&gt;
&lt;li&gt;Limit the number of results based on a calculation of how many songs could fit on the screen given the screen size and slider position.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;nextToken&lt;/code&gt; to avoid repeating song retrieval in the query.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Functions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image Compression Function&lt;/strong&gt;: I configured my storage access to allow a function called &lt;code&gt;compressImage&lt;/code&gt; to create and read files triggered by the &lt;code&gt;onUpload&lt;/code&gt; event. Initially, I faced several challenges with image compression libraries in the function, but I eventually found a solution using a combination of the &lt;code&gt;jimp&lt;/code&gt; and &lt;code&gt;jpeg-autorotate&lt;/code&gt; libraries (the latter prevented unwanted image rotation). Additionally, I encountered an issue with the function running recursively due to replacing the same file key repeatedly. I solved this by using the &lt;code&gt;Metadata&lt;/code&gt; property to mark compressed images and prevent the function from reprocessing them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  File Storage
&lt;/h3&gt;

&lt;p&gt;For file storage, all images and music files are securely stored in Amazon S3:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I used the &lt;code&gt;StorageManager&lt;/code&gt; component in Amplify Forms to handle song uploads. This integration allowed me to connect a GraphQL query seamlessly, creating database entries and properly uploading files to S3. The S3 file link is tightly integrated with the database entry field for new songs.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;StorageImage&lt;/code&gt; component made it easy to retrieve images from S3, and I used the &lt;code&gt;getUrl&lt;/code&gt; function to handle the retrieval of audio files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Thoughts
&lt;/h3&gt;

&lt;p&gt;Overall, I loved how I didn't need to configure much in Amplify's UI, although I believe more documentation on the nuances and different possibilities of the code configuration would be beneficial. &lt;/p&gt;

&lt;p&gt;I loved the sandbox - it made developing with a realistic backend so simple. Unfortunately, I was not able to determine if there’s a visual way to see the data and logs in the sandbox. I should have asked in the help thread. If this is not possible, that would be a great addition to the feature.&lt;/p&gt;

&lt;p&gt;Lastly, the experience of having everything connected so seamlessly, including deploys tied in with Git, was awesome.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connected Components
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authenticator&lt;/strong&gt;: This component made it super easy to handle user sign-ups and logins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amplify Forms&lt;/strong&gt;: To handle song creation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;StorageManager&lt;/strong&gt;: To manage file uploads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;StorageImage&lt;/strong&gt;: To display images stored in S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Feature Full
&lt;/h3&gt;

&lt;p&gt;Songzy includes all four key integrations: data, authentication, serverless functions, and file storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Features
&lt;/h2&gt;

&lt;p&gt;I wanted to add a section here to communicate my full vision since it’s been such a fun idea and project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ability to like songs on Explore Page, and they show up in your Liked Songs Page.&lt;/li&gt;
&lt;li&gt;Ability to create your artist name (at first) and personalize your profile page (later).&lt;/li&gt;
&lt;li&gt;Optimize audio: Compress the audio files.&lt;/li&gt;
&lt;li&gt;Optimize images: Have the image compression function create images at different sizes so that the Explore Page set to the fullest will load songs faster.&lt;/li&gt;
&lt;li&gt;Optimize loading files in general: Use CloudFront in combination with S3.&lt;/li&gt;
&lt;li&gt;Have the explore page show songs completely at random, or at least ordered by newest to oldest.&lt;/li&gt;
&lt;li&gt;And lastly, the UI could use more work of course - unifying theming, adding proper routing, adding better loading placeholders for songs, ensuring that the explore page’s song modal shows up in the right place regardless of screen size and device, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Leveraging AWS Amplify's powerful suite of tools made it possible to bring my vision to life quickly and efficiently. From handling user authentication and tightly coupling forms to data to file storage to functions, the experience was quick and efficient despite the occasional roadblock (usually caused by configuration issues that were difficult to find documentation on).&lt;/p&gt;

&lt;p&gt;While there are still areas to improve and features to add, I'm excited about the foundation that's been laid with AWS Amplify Gen 2. I very much appreciate the code-first approach to architecture. This project has not only deepened my understanding of the AWS tech suite but also highlighted the potential of what can be achieved with the right tools.&lt;/p&gt;

&lt;p&gt;Lastly, I invite you to explore &lt;strong&gt;Songzy&lt;/strong&gt;. It would be so cool if everyone created accounts and uploaded songs with nice cover art to grow the Explore Page!&lt;/p&gt;

&lt;p&gt;Your feedback and interaction will be invaluable in encouraging me to continue to refine and enhance the app.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br&gt;
Jared&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>awschallenge</category>
      <category>amplify</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Finally Understand Responsive Design!</title>
      <dc:creator>Jared Weiss</dc:creator>
      <pubDate>Thu, 11 Apr 2024 15:39:27 +0000</pubDate>
      <link>https://dev.to/jaredcodes/finally-understand-responsive-design-3con</link>
      <guid>https://dev.to/jaredcodes/finally-understand-responsive-design-3con</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qrl0h-gbafA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;In the realm of web development, the concept of responsive design often presents a steep learning curve for beginners. Even after moving on to more advanced topics, many still struggle to fully grasp the essence of responsive design, a shortfall that becomes evident in their projects.&lt;/p&gt;

&lt;p&gt;Responsive design is an elusive goal for many engineers, primarily because the crunch of deadlines often shifts their focus to functionality and how the project looks on their personal device. This narrow focus can lead to oversight of how a website or app performs across different devices.&lt;/p&gt;

&lt;p&gt;Even established websites can falter in responsiveness. Personally, I find that the proverbial amazon.com loses its aesthetic appeal when I shrink the browser on my laptop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw976yce0lip6ieikrvdv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw976yce0lip6ieikrvdv.jpg" alt="Image description" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That said, I don’t believe it’s too difficult nowadays to achieve a decent level of proficiency with responsive design. I just think there has been a lack of educational focus on the topic, and in presenting it in a clear comprehensive way. That is what I intend to do in this article / video.&lt;/p&gt;

&lt;p&gt;I’ve identified seven CSS properties/concepts that one must know in order to achieve almost any responsive design. While there may be additional techniques to enhance responsiveness, these seven are comprehensive enough to tackle most scenarios. Unless you’re making your app ultra-complex, you should be able to understand and apply these concepts in a reasonable amount of time.&lt;/p&gt;

&lt;p&gt;Of course, to truly understand these concepts, practice is essential. That's why I've put together a video tutorial to complement this guide, offering a practical demonstration of the principles discussed. Remember, with each practice session, these concepts will become more intuitive.&lt;/p&gt;

&lt;p&gt;Here are the main topics I’ve identified as crucial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Size units

&lt;ul&gt;
&lt;li&gt;Relative to screen - &lt;code&gt;vw&lt;/code&gt;, &lt;code&gt;vh&lt;/code&gt;
  - Relative to other elements - &lt;code&gt;%&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;max-width&lt;/code&gt; and &lt;code&gt;min-width&lt;/code&gt; properties&lt;/li&gt;
&lt;li&gt;Flexbox&lt;/li&gt;
&lt;li&gt;CSS grid&lt;/li&gt;
&lt;li&gt;Media queries&lt;/li&gt;
&lt;li&gt;Responsive images properties&lt;/li&gt;
&lt;li&gt;JavaScript for more complex responsive behaviors&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Size units
&lt;/h2&gt;

&lt;p&gt;Most beginners focus on creating a design that fits their screen nicely. Therefore, they don’t realize the downsides of specifying elements’ size, padding, margin, etc in exact terms, usually with pixels (px). The problem is that those elements will never change size as the screen size changes. Transitioning to using less absolute units like percentages and viewport units (vw/vh) is key for a flexible design.&lt;/p&gt;

&lt;h3&gt;
  
  
  Percentages
&lt;/h3&gt;

&lt;p&gt;Beginners must be careful with percentages. It takes time to understand the concept of parent-child relationships and that when a percentage is given to a child, it is a percentage of the size of its parent/container (interchangeable terms), not the whole screen.&lt;/p&gt;

&lt;p&gt;Another point here is that all the outside elements that seemingly “don’t have a parent” actually do - the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element. And the body’s size is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Width - the width of the screen&lt;/li&gt;
&lt;li&gt;Height - the height of the content inside of it (0 if nothing is in the body)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Viewport width/height (&lt;code&gt;vw&lt;/code&gt;/&lt;code&gt;vh&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;When you want an element to be sized relative to the &lt;em&gt;screen&lt;/em&gt;, thus having no relation to the size of its &lt;em&gt;direct container&lt;/em&gt;, you want to use &lt;code&gt;vw&lt;/code&gt; and &lt;code&gt;vh&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One example is the following. Let’s say your website is meant to have a &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt; then a &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; section, and you want to specifically size the height of the header and have the main section take up the rest of the screen’s height.&lt;/p&gt;

&lt;p&gt;One way to accomplish this is the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header {
    height: 300px;
}

main {
    height: calc(100vh - 300px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One &lt;code&gt;vh&lt;/code&gt; unit is basically 1% of the viewport height (the height of the screen). Therefore, &lt;code&gt;100vh&lt;/code&gt; means 100% of the height of the screen, and thus &lt;code&gt;calc(100vh - 300px)&lt;/code&gt; means “100% of the screen height minus 300px.”&lt;/p&gt;

&lt;p&gt;This ensures the main section will take up the remainder of the height of the screen after the header. &lt;/p&gt;

&lt;p&gt;You could also achieve this result with flex, but I’ll talk about that later. In this specific case, I think either is fine. Maybe one method will prove better as the project grows in complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use px
&lt;/h3&gt;

&lt;p&gt;Having these other options and the ones I will detail below definitely do not mean that the px unit has no place in CSS nowadays. There are still many situations in which you want something to have a specific size that doesn’t change along with the screen.&lt;/p&gt;

&lt;p&gt;Many elements in a UI design may prefer a specific size that will never change. Often buttons are sized this way, for example.&lt;/p&gt;

&lt;h2&gt;
  
  
  The &lt;code&gt;max-width&lt;/code&gt; and &lt;code&gt;min-width&lt;/code&gt; properties
&lt;/h2&gt;

&lt;p&gt;These properties become useful when you want an element to grow or shrink in size, but only to a certain point.&lt;/p&gt;

&lt;p&gt;One common scenario for this is with search bars at the top of the UI. The search bar will likely take up the majority of the screen width on mobile devices. And though the search bar will be bigger for a laptop than a mobile phone, once the devices get larger, you won’t want the search bar to remain almost the full screen width.&lt;/p&gt;

&lt;p&gt;Take a look at how Airbnb’s input bar changes (just the width of it, I mean) as the screen grows.&lt;/p&gt;

&lt;p&gt;Mobile:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdmzs9j5c697xdh0z0a46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdmzs9j5c697xdh0z0a46.png" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tablet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga7c6m2lmbyeyvqg2267.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga7c6m2lmbyeyvqg2267.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Big tablet / small laptop:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5khnujz7u4qovyvwyb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5khnujz7u4qovyvwyb9.png" alt="Image description" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Laptop:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8mgnemzpbc5rm776xd9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8mgnemzpbc5rm776xd9l.png" alt="Image description" width="800" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a little hard to tell with these images, but on mobile, the search bar takes up most of the width of the screen, but is still small in terms of px). Then it grows for tablets and small laptops. But at a certain point, it stops growing more as the screen further increases in size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flexbox
&lt;/h2&gt;

&lt;p&gt;I count myself very lucky to have not had to learn CSS before flexbox was invented. “Flex,” for short, is an amazing method of relating elements to each other in terms of position and size.&lt;/p&gt;

&lt;p&gt;With flex, you write &lt;code&gt;display: flex;&lt;/code&gt; on the parent element, then it becomes a “flex container,” and all of its direct children become “flex items.” There are several intuitive flex-related properties you can set on the flex container to describe how the flex items should behave. There are also properties you can set on the flex items themselves to distinguish their styling from the rest of the flex items.&lt;/p&gt;

&lt;p&gt;It is common that beginners don’t understanding that the flex relationship is strictly between parent and child. Not parent and grandchild, and so on. You can have flex items that are also flex containers themselves. All that means is one element has &lt;code&gt;display: flex;&lt;/code&gt; and one of its children also has &lt;code&gt;display: flex;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here are two of the most common scenarios in which flex becomes handy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flex allows you to create positional/spacial relationships between elements that are all next to or on top of each other. So if, for example, you have a few items in a row, you can space them evenly from each other in that row with just one or two simple CSS properties.&lt;/li&gt;
&lt;li&gt;With flex, you can easily change the direction in which sibling elements are positioned. By direction, I mean from horizontal (row) to vertical (column), or vice versa. For example, think links in a nav at the top of the screen that become organized vertically under a hamburger menu for mobile.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  CSS grid
&lt;/h2&gt;

&lt;p&gt;There is one shortcoming of flex, and that is when you are trying to control elements in two directions (x-axis AND y-axis) at the same time. Flex is all about defining properties for elements that are aligned along the same one axis (x-axis OR y-axis). The most common scenario for wanting to do this is when making a grid of items.&lt;/p&gt;

&lt;p&gt;You may run into trouble when trying to ensure they’re all the same size. See the below image for an example of this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kdcz1gzqzjrd68gncie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kdcz1gzqzjrd68gncie.png" alt="Image description" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With grid, you can just apply one or two easy CSS properties, and bam, problem solved. See below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#card-container {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    justify-content: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note - Some people actually choose to use grid for the entire layout of their website. To be honest, I have never spent enough time to explore this option because I learned flex first (grid came out later), and flex is good for 95+% of my needs. I really have only needed grid for actual grid layouts, which are typically a subsection of my websites, if I need them at all.&lt;/p&gt;

&lt;p&gt;There is nothing wrong with using flex and grid in different parts of your UI!&lt;/p&gt;

&lt;h2&gt;
  
  
  Media queries
&lt;/h2&gt;

&lt;p&gt;In almost any design, you will need things to change more drastically when the screen hits a certain size. Small screens favor vertical scrolling. With larger computer screens, you can fit more elements horizontally.&lt;/p&gt;

&lt;p&gt;With media queries, you can define what are called “breakpoints” - points at which some styles are to be overridden to accommodate the tweaked designs for other devices.&lt;/p&gt;

&lt;p&gt;You have a choice to either create the mobile or desktop UI first, then create a breakpoint at which you define new styles to override the existing ones for the platforms that you didn’t initially design for.&lt;/p&gt;

&lt;p&gt;Let’s use the example where for mobile devices, certain elements should be organized in a column, but on larger devices, they should be organized in a row.&lt;/p&gt;

&lt;p&gt;Let’s assume that we have chosen “mobile first design,” which means designing the mobile UI first, then figuring out the responsiveness to achieve the larger devices’ designs. This choice, rather than designing for laptop/desktop first, is considered better today since the populus spends more time on phones than larger computers, and a company will prefer to make more users happy.&lt;/p&gt;

&lt;p&gt;Well, the way to tell your app to change its appearance at tablet width and larger is to basically - with a media query breakpoint - say, “at this pixel width and higher, change the organization of these items to be a row now.”&lt;/p&gt;

&lt;p&gt;This change may mean just changing a flex container’s flex-direction property from column to row, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#flex-container {
    display: flex;
    flex-direction: column;
}

screen and (min-width: 768px) {
    #flex-container {
        flex-direction: row;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This snippet means that the element with ID “flex-container” will have &lt;code&gt;flex-direction: column&lt;/code&gt;; for screens less than 768px in width, but for screens with width 768px and above, the element will have &lt;code&gt;flex-direction: row;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Side note - There are relatively standard pixel widths for each device, so you can look up the pixel width at which to set a breakpoint to indicate a transition from mobile to tablet, tablet to laptop, and so on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive images properties
&lt;/h2&gt;

&lt;p&gt;Often a combination of the above properties will be used to dictate the size of images in your website, and no further CSS will be needed.&lt;/p&gt;

&lt;p&gt;However, there are times when the image is not scaling property with the screen. I wanted to provide a couple properties you could explore when this happens.&lt;/p&gt;

&lt;p&gt;One property is &lt;code&gt;aspect-ratio&lt;/code&gt;. This property allows you to define a preferred aspect ratio for images so that it always maintains the same height-to-width ratio across different screen sizes.&lt;/p&gt;

&lt;p&gt;Another property is &lt;code&gt;object-fit&lt;/code&gt;, which can take values such as &lt;code&gt;fill&lt;/code&gt;, &lt;code&gt;contain&lt;/code&gt;, &lt;code&gt;cover&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;, and &lt;code&gt;scale-down&lt;/code&gt;, allowing for flexible control over how images adapt to different screen sizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript for more complex responsive behaviors
&lt;/h2&gt;

&lt;p&gt;Finally, JS plays a crucial role in responsive design for more dynamic and complex adjustments that CSS alone cannot handle, allowing for custom behaviors based on user interactions or device specifications.&lt;/p&gt;

&lt;p&gt;With JS, you can react to more event types than just screen size changes, such as button clicks, scrolling, dragging and dropping, and more.&lt;/p&gt;

&lt;p&gt;With JS, you can write logic to dynamically adjust the sizes of elements based on whatever conditions you want. For example, you can adapt content based on the user's device, behavior, preferences, and/or location.&lt;/p&gt;

&lt;p&gt;JS will be the bulk of the code for your UI, so if something is not easily attainable with HTML and CSS, often the solution will require JS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Achieving responsive design is a balancing act, requiring a blend of CSS finesse and strategic JavaScript. By understanding and applying the seven key concepts outlined above, developers can create websites that are not only visually appealing but also adaptable across all the necessary devices.&lt;/p&gt;

&lt;p&gt;The journey to mastering responsive design is one of continuous learning and practice. To see these concepts in action, don't forget to check out the accompanying video tutorial.&lt;/p&gt;

&lt;p&gt;Remember that responsive design is within reach, and with each project, the process becomes more intuitive.&lt;/p&gt;

&lt;p&gt;Hopefully I have managed to make responsive design a less foggy and daunting concept for you with this article and video.&lt;/p&gt;

&lt;p&gt;I wish you the best of luck with your future projects, and I thank you for reading.&lt;/p&gt;

&lt;p&gt;Until next time,&lt;br&gt;
Jared&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>frontend</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Become a Frontend JavaScript Pro in Steps - A Series</title>
      <dc:creator>Jared Weiss</dc:creator>
      <pubDate>Tue, 02 Apr 2024 10:26:14 +0000</pubDate>
      <link>https://dev.to/jaredcodes/become-a-frontend-javascript-pro-in-steps-a-series-5f1c</link>
      <guid>https://dev.to/jaredcodes/become-a-frontend-javascript-pro-in-steps-a-series-5f1c</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Ksu7ks6U9mA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Hey y’all, &lt;/p&gt;

&lt;p&gt;I created a 4-part video series where I build a frontend app in increasingly professional coding paradigms. &lt;/p&gt;

&lt;p&gt;I think this will be a &lt;em&gt;huge&lt;/em&gt; breakthrough for beginning developers in learning how to write code as a professional would - taking into account maintainability and scalability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 1
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I recreate a design from frontendmentor.io. &lt;/li&gt;
&lt;li&gt;When implementing the JS, I rely on the DOM nodes themselves as the state of the application. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the most common sense approach for a newbie. The downside is that for every feature you want to implement, you have to react to a user action, take stock of the DOM elements on the screen, then update the right ones. &lt;br&gt;
This will likely require messy, nit-picky logic that gets difficult to maintain as the project grows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 2
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt; I restructure the JS to represent the state of the application as stored JS data.&lt;/li&gt;
&lt;li&gt;The process becomes: the user does something, I update the state data, and then I render out the UI according to the data. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the rendering logic more modular - if things aren’t rendering properly, I can isolate the rendering logic more easily. &lt;br&gt;
Also, the rendering logic will be largely the same for new features, so making new features becomes faster as the project complexity increases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 3
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I note that neither approach thus far has led us to a fully functional frontend app.&lt;/li&gt;
&lt;li&gt;We have hardcoded the user’s data, and upon refreshing the browser window, we are back to where we started. The user’s progress is not recorded.&lt;/li&gt;
&lt;li&gt;We fix this by using localStorage as our place to store the user’s updates, allowing us to bring the user right back to where they were if the screen is refreshed. &lt;/li&gt;
&lt;li&gt;I end by noting that by this point, you know all you need to deploy a legitimate and potentially successful application, mentioning the game “2048” as an example.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Level 4
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I take you on a massive refactoring journey and paradigm shift to make your code as clean, maintainable, and scalable as possible. &lt;/li&gt;
&lt;li&gt;I start simply with the latest JS syntaxes and tricks, then I go deeper into how to structure your project to be less buggy and more maintainable/scalable as it grows - by:

&lt;ul&gt;
&lt;li&gt;Implementing naming conventions&lt;/li&gt;
&lt;li&gt;Implementing Object-Oriented Programming (OOP)&lt;/li&gt;
&lt;li&gt;Breaking the project into modular folders and files&lt;/li&gt;
&lt;li&gt;Using Webpack to bundle and minify the files for optimization&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the end of this journey you will be a significantly better developer who understands more professional levels of thinking, which will help with your future projects and communication in interviews, and separate you from other beginners.&lt;/p&gt;

&lt;p&gt;Here’s the link to the beginning of the series - &lt;a href="https://youtu.be/Ksu7ks6U9mA"&gt;https://youtu.be/Ksu7ks6U9mA&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you like it! I know it’s long, but it’s worth it!&lt;/p&gt;

&lt;p&gt;Best of luck,&lt;br&gt;
 Jared&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>From JS Basics to Actually Building Stuff</title>
      <dc:creator>Jared Weiss</dc:creator>
      <pubDate>Tue, 06 Feb 2024 04:43:41 +0000</pubDate>
      <link>https://dev.to/jaredcodes/from-js-basics-to-actually-building-stuff-55i7</link>
      <guid>https://dev.to/jaredcodes/from-js-basics-to-actually-building-stuff-55i7</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/S7_ApcLsRv4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro⁣
&lt;/h2&gt;

&lt;p&gt;⁣I often get/see the question of how to go from understanding the building blocks of JavaScript (data types, variables, conditionals, loops, functions, etc.) to actually building things. Hopefully I can offer some help here.⁣⁣&lt;/p&gt;

&lt;p&gt;Most people give the advice to start with small goals and work your way up. I would say exactly the same if I were limited by text and time. ⁣⁣&lt;/p&gt;

&lt;p&gt;But let's be honest, figuring out what those small projects should be can be a challenge in itself. It’s tough as a beginner to know how to experiment. &lt;/p&gt;

&lt;p&gt;⁣⁣I'll expand to the best of my ability in this post with text, but I will link the YouTube video I made at the bottom in case you want to see a code demonstration with more detail that is difficult to accomplish with words.⁣&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation⁣
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Defining Small Goals⁣&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⁣Anyway, to expand a little in words while we're here, I believe it's easiest to learn through frontend JavaScript, interacting with HTML and CSS. This way you can apply variables, functions, loops, and conditionals to practical, visible things. ⁣&lt;/p&gt;

&lt;p&gt;You can play around with text, lists, cards, forms, drop-downs, images, modals, and more. Think of changing visibility, size, color, boldness, capitalization, item addition/removal, and so on. These small goals will reinforce your understanding and provide a foundation upon which you can build more complex applications.⁣⁣&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Mentality⁣&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⁣Also, transitioning from learning to doing requires a mindset shift. Embrace experimentation and don't fear making mistakes. Accept that you will initially have no idea how to accomplish these tasks, but they're so small that with repetition, you can start to see the patterns in how the JavaScript building blocks are used. Don't be afraid to look at the answers, but make sure you take the time to understand the answers (Don't just copy and paste them then move on.).⁣⁣&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scaling Up⁣&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⁣As you gain confidence with small projects, start scaling up. Eventually try to replicate real websites' UIs, then you can try using sample data from free APIs. Before you know it, you'll have confidence in your frontend abilities, and you will have learned how to use the JavaScript basics along the way.⁣⁣&lt;/p&gt;

&lt;p&gt;Then you will be able to create your own applications, utilizing a combination of JavaScript fundamentals. This might be an interactive game or a web app that fetches data from an API. Remember, every complex project is just a series of simple steps combined. With every next project, you will see this breakdown more easily.⁣⁣&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks for Reading!⁣
&lt;/h2&gt;

&lt;p&gt;⁣Here's the YouTube video link: &lt;a href="https://youtu.be/S7_ApcLsRv4?si=c7CZ3aEATuQkHZ6x%E2%81%A3"&gt;https://youtu.be/S7_ApcLsRv4?si=c7CZ3aEATuQkHZ6x⁣&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
