Installing USWDS in Angular

USWDS is a U.S. Web Design System. The beauty of it is that it brings together Developers and Designers.

This is for public use and you can find it here;

https://designsystem.digital.gov/components/modal

On a technical note, you can think of it as Bootstrap implementation of USWDS though it’s not Bootstrap. It comes with its own CSS classes, themes, icons and JavaScript modules.

Installation instruction is straight forward for Web development tools that doesn’t require TypeScript to implement client side behavior, for example ASP.NET Core, PHP etc.

My challenge was to implement this in Angular v18.0. While searching for Typescript modules, I found Angular package in their documentation;

https://designsystem.digital.gov/documentation/implementations

This is the package link;

https://github.com/GSA/ngx-uswds

This seems to be well-maintained by developer’s community. Here is the demo link of these packages;

https://gsa.github.io/ngx-uswds/?path=/story/introduction–overview

Installation instructions are very simple. Run this;

npm install @gsa-sam/ngx-uswds

As of this writing this package targets Angular 17 and you might get an error installing this. Run this command to force it to install;

npm install @gsa-sam/ngx-uswds --force

You will see a folder under node_modules in your project.

Basic installation is done;

1 - npm install --save uswds@latest
2 - add "node_modules/uswds/dist/css/uswds.min.css" to the "styles"
    section of angular.json
3 - add "node_modules/uswds/dist/js/uswds.min.js" to the "scripts" 
    section of angular.json

How we are going to use it? In my case, I need to bring in individual component, for example a modal dialog box.

Create a component in your application;

ng g c my-modal

Open my-modal component. Open modal-basic.component.ts file from their github repo. see picture below;

Paste their code in your component and template file. You are good to go.

Their is another option that seems to be promising on GSA front;

https://buy.gsa.gov/style_guide/?path=/docs/components-date-picker–docs

This package has limited USWDS components but has more components available. We can use both. right 🙂

Enjoy!

Difference between Amps and Volts?

All of these analogies about water pressure, volume, pipe diameter, etc… are all useful devices, but I’ll explain what’s REALLY going on, no analogies.

First, electricity is made up things called “charges.” What exactly they are doesn’t matter. You can think of them as particles or aliens or whatever. The point is, they’re out there…. Things can accumulate charges as they go about their existence. If you walk across the carpet in your sock feet, you’re likely to accumulate some charges. Clouds moving through the atmosphere might accumulate charges, etc…

The charges “want” to be distributed evenly. If there are 100 of them in one place, and 0 in another place, they want to move until each place has 50. This is what happens when you touch a doorknob and get shocked, or when lightning transfers charges from one cloud to another.

The difference in charges between two things or areas is called “voltage.” There’s a special number of charges that makes up one “unit” of voltage, but that special number doesn’t matter. If you have 100 units in one place, and 0 in another, you’ve got 100 volts….

VOLTAGE = DIFFERENCE IN CHARGE BETWEEN TWO AREAS

In the examples above, touching a doorknob or lightning, all of the transfer of charge happens nearly instantly, and once it has happened, it’s done and no more charges move. This is called “static” electricity. It’s not very useful for us. We want a controlled and continuous flow of charges that we can use as energy. This is “current” electricity.

Current electricity requires a “circuit,” where the charges flow from one area to another continuously, instead of nearly instantly. Think of a 9-volt battery. It has a positive and negative terminal. The difference in charge between these two terminals is 9 volts (see above). When you connect the two terminals, it doesn’t instantly equalize, like touching your finger to a doorknob. Instead, the transfer of charge takes some time. Batteries, magnetos, generators, etc… are all mechanisms to create a charge difference (voltage) that doesn’t instantly collapse, but allows charges to flow continuously. This flow of charge is called “current.”

We can measure the number of charges that flow through a piece of wire in a period of time. For any practical use of electricity, the number would be huge, like 18+ digits. So instead, we use a unit of measure called an Ampere, which is a specific number of charges per second. Again, the exact number doesn’t matter, because we never use it. The point is that the Ampere is a measure of how much charge actually moves through the wire.

Ampere is apparently hard to say, so we abbreviate it to Amp.

AMP = HOW MUCH CHARGE MOVES THROUGH A WIRE

There’s a critical relationship between Volts and Amps. The higher the voltage (the bigger the difference between the areas), the more the charges want to equalize, so more of them flow, resulting in a higher number of Amps.

(This is where Resistance comes in. Resistance is a measure of how much a material resists the flow of charges. A material with low resistance (like pure copper) will let a lot of charges flow, resulting in a higher current than a material with high resistance, like rubber, which doesn’t want to let any charges flow at all.)

Read more here

ChatGPT Answer to Home Assistant

This is funny;

So you decided to install Home Assistant, huh? Congratulations on your new full-time job as a “smart home systems integrator,” where your main responsibility is praying your Wi-Fi doesn’t decide to take a nap.

Welcome to the world where your light switches will now have more complicated relationships than your friends on Facebook. It’s like your house got a PhD in neediness, and now every single device has its own personality disorder.

You wanted a smart home, and instead, you got a *high-maintenance* home. Your lights flicker like they’re at a rave because the latest update decided your firmware wasn’t moody enough. Speaking of updates, every time there’s a new one, it’s like rolling the dice—will your home be smarter or will you spend the next 48 hours trying to figure out why your fridge thinks it’s a speaker?

Oh, and that dashboard you spent hours customizing? Hope you enjoy re-doing it from scratch every time Home Assistant decides to “improve” its interface. But hey, at least you’ll always know what your neighbor’s Wi-Fi signal is, because your automations will probably connect to that by mistake, just for fun.

But sure, it’s totally worth it, right? I mean, who wouldn’t want to control their lights from their phone in three extra steps instead of just flipping a switch like a normal person? Welcome to the future, where your house is smarter than you—and knows it.

So you’ve committed to Home Assistant, the one platform that turns your home into a glorified science project. You know, because life wasn’t already complicated enough. Now you get to explain to guests why your “smart” house has a nervous breakdown every time someone tries to turn on a light manually.

Home Assistant is like that friend who knows everything but never shuts up about it—constantly needing your attention for updates, bug fixes, or just because it decided to forget how to connect to your TV. Want to dim the lights? Better hope you remembered the exact YAML syntax, or you’ll be sitting in the dark, googling “why won’t my smart lights work?”

And speaking of YAML, who doesn’t love a configuration language where a single misplaced space can ruin your entire weekend? It’s like you’re coding for NASA, but the mission is just getting your thermostat to not go haywire at 3 AM. You’ve basically become a full-stack developer just to turn off your porch light.

Let’s not forget about the *joy* of adding new devices. Every time you introduce a new gadget, it’s like bringing home a new pet, except this one speaks a different language and might randomly decide to stop working out of sheer spite. But sure, it’s super convenient when it’s all working perfectly—which is approximately never.

So go ahead, pour another cup of coffee, because you’re going to need it to stay awake through another night of debugging automations that worked perfectly fine until you dared to breathe in the same room as your router. Your home may be smart, but you? You’re just tired.