DEV Community

Cover image for Remembering the button
Liz
Liz

Posted on • Edited on

4

Remembering the button

Wednesday night is Survivor night which means us and the population of people who still have cable sit down to watch a show that's older than everyone in the apartment. But this also means it's the convention of the nerds.

Because I've been falling behind in literally all of my classes because I've been applying to internships, I took last Wednesday to sit down, relax, and work on the card we're developing for IST 402. And ask my comp sci friend for help. Thank god, I got an internship offer just yesterday, so maybe I'll be able to get my shit together. All I can say is that I'm a cybersecurity major and will be doing cybersecurity related things. Because I'm falling behind on everything, this blog post is also two days late.

Anyway, buttons. We made one a while ago, published it to npm, and now we're using it in our card project. This process really made me realize how import reusability is.

This is how I slotted the button in:

<div slot="button" class="buttonContainer"><cta-button icon="subject" title="${this.type}" style="--psu-background-color: ${this.bannerColor};"></cta-button></div>
Enter fullscreen mode Exit fullscreen mode

Notice how "--psu-background-color" was a called variable.
This allowed the button color to mutable when a type was applied to the card.
Image description

But because I didn't think ahead... the button reverts to the colors it was when it's hovered over.
Image description

When I was creating the button, I didn't think about all the different states I should make accessible. Being able to apply the button to the card has not only helped learn about slots but the considerations that should be made with creating a web component.

The current card project can be accessed at:

GitHub logo runtimeErrorsMadeEasy / project2

Making a card for IST 402

And always, here's the song of the week:

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs