#3: Please push my buttons
I highly recommend checking out Josh Comeau's CSS button tutorial, which does a great job explaining how to craft snazzy buttons. After an afternoon of tinkering on my end, I was able to build some handy buttons for this site's nav. I also made buttons that link to the Discord and wiki, but they're not available on the public website yet. 😇
I approached the task by creating a base button component and style that looks like this:
Out of the box, the button can be configured to use any CSS variable color as an overlay and can handle an onClick function. For example, here's a button that increments a counter and changes its own color when clicked:
The color names just work because they're already in :root as CSS variables, but in the future I want to make this more robust. In the process of composing this post, I also made a few tweaks and removed some unhelpful code. It was helpful to practice using the button different ways directly on the blog post since the site uses MDX.