<?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: Shahnshah</title>
    <description>The latest articles on DEV Community by Shahnshah (@shahnshahmalik).</description>
    <link>https://dev.to/shahnshahmalik</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%2F600695%2Fef715473-d4fe-4ad4-b74a-3f9416750e2e.png</url>
      <title>DEV Community: Shahnshah</title>
      <link>https://dev.to/shahnshahmalik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shahnshahmalik"/>
    <language>en</language>
    <item>
      <title>Adding custom styles to matTooltip</title>
      <dc:creator>Shahnshah</dc:creator>
      <pubDate>Sun, 28 Mar 2021 08:34:16 +0000</pubDate>
      <link>https://dev.to/shahnshahmalik/adding-custom-styles-to-mattooltip-395p</link>
      <guid>https://dev.to/shahnshahmalik/adding-custom-styles-to-mattooltip-395p</guid>
      <description>&lt;p&gt;I recently came across this requirement and after getting stuck to style the matTooltip I finally managed to do it and thought it’s a good idea to share what I learned, here.&lt;/p&gt;

&lt;p&gt;It’s very difficult to look at the structure of the Angular Material Tooltip because of it’s behavior when you try to inspect, so let me share the HTML first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="cdk-overlay-container"&amp;gt;
     &amp;lt;div class="cdk-overlay-connected-position-bounding-box" dir="ltr"style="top: 0px; left: 0px; height: 100%; width: 100%;"&amp;gt;
      &amp;lt;div id="cdk-overlay-1" class="cdk-overlay-pane mat-tooltip-panel"style="pointer-events: auto; top: 8px; left: 417.625px;"&amp;gt;
      &amp;lt;mat-tooltip-component aria-hidden="true" class="ng-tns-c34-15 ng-star-inserted" style="zoom: 1;"&amp;gt;
          &amp;lt;div class="mat-tooltip ng-trigger ng-trigger-                state"style="transform-origin: left center; transform: scale(1);"&amp;gt;Info about the action&amp;lt;/div&amp;gt;
      &amp;lt;/mat-tooltip-component&amp;gt;
     &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s half the problem solved when you can clearly see the structure of the HTML, next we’ll try to style it. Make sure to put these styles in your custom mixin.scss or styles.scss&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.cdk-overlay-pane {  
 &amp;amp;.mat-tooltip-panel {  
  .mat-tooltip { 
  color: pink;
  background-color: white;
  border:  1px solid #eeeeee;
  border-radius:  3px;
  font-size:  15px;
  padding:  10px; 
  } 
 } 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it. Now you know how to style a tooltip.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Publish your Storybook components on npm</title>
      <dc:creator>Shahnshah</dc:creator>
      <pubDate>Sat, 20 Mar 2021 17:37:24 +0000</pubDate>
      <link>https://dev.to/shahnshahmalik/publish-your-storybook-components-on-npm-17pd</link>
      <guid>https://dev.to/shahnshahmalik/publish-your-storybook-components-on-npm-17pd</guid>
      <description>&lt;h2&gt;
  
  
  Storybook and Library setup
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Create a new Angular Library using the steps from Angular.io
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng new my-workspace --create-application=false

cd my-workspace

ng generate library storybook-library
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After these run the storybook installation simply by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx sb init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will install storybook, the required dependencies and update the scripts. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Once done run npm run storybook to launch it. There’s some existing boilerplate code when you run storybook for the first time to get you started with it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Publish configuration
&lt;/h2&gt;

&lt;p&gt;If you intend to publish your packages to a private or public repository you’ll need to change the configuration a little to include the registry url for the repository you’ll be using.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Open package.json from the projects folder of your workspace.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s important to add configuration to the right package.json. You now have two package.json files one in the root of your workspace and another under the projects folder.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Add the below configuration to enable publishing of your packages
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"publishConfig": {
    "registry": "http://myprivaterepo.com/repository/private/"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you’re using a public npm repository, you might need to create and account if you don’t have one. You’ll also need to login by using command npm login and then you can use npm publish from the build directory to publish your packages.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; To build your storybook components or modules, you can run
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will build your project and will put the final contents inside a directory similar to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dist / yourProjectName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now run npm publish from this directory to publish your packages.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
