<?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: CodeGirl</title>
    <description>The latest articles on DEV Community by CodeGirl (@shnap).</description>
    <link>https://dev.to/shnap</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%2F317833%2F848537da-627a-4cab-9c6a-43d9a844d8e7.png</url>
      <title>DEV Community: CodeGirl</title>
      <link>https://dev.to/shnap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shnap"/>
    <language>en</language>
    <item>
      <title>Animation for Angular *ngFor list</title>
      <dc:creator>CodeGirl</dc:creator>
      <pubDate>Wed, 01 Nov 2023 10:30:30 +0000</pubDate>
      <link>https://dev.to/shnap/animation-for-angular-ngfor-list-2pgl</link>
      <guid>https://dev.to/shnap/animation-for-angular-ngfor-list-2pgl</guid>
      <description>&lt;p&gt;If you want to create an animation for the ngFor list, where one item fades out when it is removed, and the remaining items below it slide up slowly, you can do so.&lt;br&gt;
here's the code of the animation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const fadeOutAndShrinkAnimation: AnimationTriggerMetadata = trigger(
  "fadeOutAndShrinkAnimation",
  [
    transition(":leave", [
      sequence([
        query(".css-class-of-ngfor-list", [
          style({ opacity: 1 }),
          animate("600ms ease-in", style({ opacity: 0 })),
        ]),
        query(".css-class-of-ngfor-list", [
          animate("800ms ease-in", style({ height: 0 })),
        ]),
      ]),
    ]),
  ]
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a breakdown of the code:&lt;/p&gt;

&lt;p&gt;fadeOutAndShrinkAnimation is a constant that holds the animation trigger definition.&lt;/p&gt;

&lt;p&gt;trigger("fadeOutAndShrinkAnimation", [...]) is used to define the trigger. The string "fadeOutAndShrinkAnimation" is the trigger's name.&lt;/p&gt;

&lt;p&gt;transition(":leave", [...]) is defining a transition for the trigger. The :leave is a special state that is applied when an element is leaving the view (e.g., being removed).&lt;/p&gt;

&lt;p&gt;Inside the transition, there is a sequence of animation steps defined using sequence([...]).&lt;/p&gt;

&lt;p&gt;query(".call-notification-item", [...]) is used to target elements with the class "call-notification-item" within the component. The query function is typically used to define animations for elements matching a particular selector.&lt;/p&gt;

&lt;p&gt;Inside the first query, there is an animation sequence that includes:&lt;/p&gt;

&lt;p&gt;style({ opacity: 1 }): This sets the initial opacity of the selected elements to 1.&lt;br&gt;
animate("500ms ease-in", style({ opacity: 0 })): This animates the opacity of the selected elements to 0 over 500 milliseconds with an "ease-in" timing function.&lt;br&gt;
In the second query, there is another animation sequence that includes:&lt;/p&gt;

&lt;p&gt;animate("600ms ease-in", style({ height: 0 })): This animates the height of the selected elements to 0 over 600 milliseconds with an "ease-in" timing function.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>animation</category>
      <category>ngforlist</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Required in Typescript</title>
      <dc:creator>CodeGirl</dc:creator>
      <pubDate>Wed, 14 Jun 2023 09:09:38 +0000</pubDate>
      <link>https://dev.to/shnap/required-in-typescript-2hcc</link>
      <guid>https://dev.to/shnap/required-in-typescript-2hcc</guid>
      <description>&lt;p&gt;Today, we are going to explore one hidden gem of the typescript.  In some cases, properties of the type can be optional.&lt;/p&gt;

&lt;p&gt;As in,&lt;br&gt;
Type Props {&lt;br&gt;
  a?: number;&lt;br&gt;
  b?: string;&lt;br&gt;
}&lt;br&gt;
 &lt;br&gt;
const obj: Props = { a: 5 };&lt;br&gt;
 &lt;br&gt;
const obj2: Required = { a: 5, b: 2 };&lt;/p&gt;

&lt;p&gt;Here, for obj2, all the properties are mandatory when we add Required. If we fail to do so, we get the below error&lt;br&gt;
Property 'b' is missing in type '{ a: number; }' but required in type 'Required'.&lt;/p&gt;

&lt;p&gt;In the real time, the best example I could think of is:&lt;/p&gt;

&lt;p&gt;Let's say you have a TypeScript interface called Book representing a book object. &lt;br&gt;
The Book interface has some optional properties, but you want to create a function that accepts only books with all the properties being required. You can use Required to achieve this:&lt;/p&gt;

&lt;p&gt;interface Book {&lt;br&gt;
  title?: string;&lt;br&gt;
  author?: string;&lt;br&gt;
  genre?: string;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;function processBook(book: Required) {&lt;br&gt;
  // Process the book object&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Usage&lt;br&gt;
const book1: Book = {&lt;br&gt;
  title: "The Catcher in the Rye",&lt;br&gt;
  author: "J.D. Salinger"&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;const book2: Required = {&lt;br&gt;
  title: "To Kill a Mockingbird",&lt;br&gt;
  author: "Harper Lee",&lt;br&gt;
  genre: "Fiction"&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;processBook(book1); // Compilation error: Missing required properties&lt;br&gt;
processBook(book2); // Valid, as all the properties are required&lt;/p&gt;

&lt;p&gt;In this example, we have the Book interface representing a book object. The properties title, author, and genre are all optional as denoted by the ? symbol. We then define a function called processBook that accepts a book object with all the properties being required.&lt;br&gt;
When we try to pass book1 to processBook, TypeScript raises a compilation error because book1 is of type Book, and it might be missing some required properties. However, book2 is explicitly declared as Required, providing all the required properties, and thus it is a valid argument for the processBook function.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>angular</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Skip Challenge-Codepen</title>
      <dc:creator>CodeGirl</dc:creator>
      <pubDate>Wed, 24 Feb 2021 08:33:24 +0000</pubDate>
      <link>https://dev.to/shnap/skip-challenge-codepen-1m07</link>
      <guid>https://dev.to/shnap/skip-challenge-codepen-1m07</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/sahana_p_rao/embed/jOVamdR?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Simple birthday wish angularjs</title>
      <dc:creator>CodeGirl</dc:creator>
      <pubDate>Wed, 16 Dec 2020 17:29:55 +0000</pubDate>
      <link>https://dev.to/shnap/simple-birthday-wish-angularjs-adg</link>
      <guid>https://dev.to/shnap/simple-birthday-wish-angularjs-adg</guid>
      <description>&lt;p&gt;Here's a URL to Pen &lt;a href="https://codepen.io/sahana_p_rao/live/pePyzZ"&gt;https://codepen.io/sahana_p_rao/live/pePyzZ&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>html</category>
      <category>scss</category>
    </item>
  </channel>
</rss>
