Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variants layer? #57

Open
eric-harms opened this issue Jan 22, 2020 · 1 comment
Open

Variants layer? #57

eric-harms opened this issue Jan 22, 2020 · 1 comment

Comments

@eric-harms
Copy link

eric-harms commented Jan 22, 2020

Lets say that I have a container object that sections off content from the rest of the page.

.o-container {
    margin-left: auto;
    margin-right: auto;
    max-width: 1024px;
} 

It could have modifiers to create sizing variants.

.o-container--width-medium {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

I also might have utility classes to change its color or center text.

.u-align-center {
    text-align: center;
}

.u-color-accent {
    color: #eee;
 }

The markup for this simple example would look like this

<div class="o-container o-container--width-medium u-align-center u-color-accent">
</div>

Is it bad practice for me to create a variants layer of sorts in the inverted triangle? The idea would be to keep the modify and utility classes, but create an additional class that combines what a region of the page might need.

.v-container-header { } /* might combine u-color-primary and u-ualign-right with other rules */
.v-container-footer { } /* might combine u-color-accent and u-ualign-center with other rules */

I'm noticing that I have things abstracted out too well for other people on the team. I really don't know if this is a good idea, or if there is a better way to handle occurrences where I'm using four or five classes.

@eric-harms
Copy link
Author

I guess this would be similar to the BEVM (Block Element Variation Modifier) methodology, minus Sass @extends

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant