-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
Having done the (initial) hierarchical sidebar, I've been thinking about the best way to override styles.
My personal feeling is that folks are not going to want to heavily (or granularly) restyle the app, as long as it's fairly neutral and lets them work easily with their components.
As such, the current approach of creating and overriding CSS variables seems like an increasing maintenance burden and a constraint on any styling implementation.
Proposal
In Histoire, every component had a class name we could target, and it worked well.
So I propose two things going forwards:
Targetable classes
In the hierarchy branch, I added bt--prefixed classes to all Nav* elements:
bt-nav-root
bt-nav-folder
bt-nav-folder-title
bt-nav-folder-container
bt-nav-item
bt-nav-item-link
bt-nav-item-title
bt-nav-item-variants
bt-active
bt-icon
It's:
- easy to read and write
- unlikely to clash with user stories
- would be a simple way for users to target bedtime-specific styles
Resets and overrides
And the nice thing about moving away from variables is you basically design so that a user can modify any property, or even reset all properties for targeted elements using the all property:
// override root, or any child
.bt-nav-root *:not(svg) {
all: revert-layer; // there are various options here; see link
}
// target elements
.bt-nav-root .bt-nav-folder-title {
color: red;
}
// increase specificity (if needed)
.bt-nav-root .bt-nav-folder .bt-nav-item-variants {
color: blue;
}Before:
After:
Going in this direction would eliminate the need to maintain an ever-increasing list of variables, and would let anyone override or replace any styling decision.

