RaspberryPiFoundation / sauce-design-system

https://sauce.raspberrypi.org
1 stars 1 forks source link

Style base elements #62

Closed Jonic closed 9 months ago

Jonic commented 3 years ago

Currently we're in a less-than-ideal situation where we have styles that have opinions about defaults, that are not adequately expressed in the CSS as defaults. Take for example the humble <a>.

In the present state of Sauce, in order to get the "default" styles, you'd need to write this:

<a class="sc-rp-link" href="#">Link text</a>

It doesn't make sense that a "default" is actually being applied by a classname, because it's not a default. We should be able to write:

<a href="#">Link text</a>

The good news is that this is easy to do. Using the CSS :not selector we can target any a element WITHOUT A CLASSNAME and apply our "default" styles. Any components that require different styling of links can override the default with a classname.

This doesn't just apply to the <a> element. There are many other elements that share similar DNA, so having a smaller, more robust set of "bare" selectors will help us get a start on building out new pages. These elements include:

The aim is that we should be able to put any combination of these elements on an otherwise empty page and have something that looks styled, so we've got a nice baseline from which to build out components.