-
Notifications
You must be signed in to change notification settings - Fork 6
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
Re-factor and streamline the SCSS basics. #351
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# SCSS strategy | ||
|
||
In December 2023, we have aimed to streamline the way we write SCSS. | ||
Some of these rules have not been applied on previous code, but moving forward, | ||
this is what we aim to do. | ||
|
||
## BEM naming convention | ||
|
||
rasben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Examples of do's and dont's | ||
|
||
Assuming we have a Counter block: | ||
|
||
- Styling must be placed in a correspondingly named file `counter.scss` | ||
- `.counter__title` ✅ | ||
- `&__title` ❌ (`&__` should be avoided, to avoid massive indention.) | ||
- `.counter-title` ❌ (Must start with `.FILE-NAME__`) | ||
- `.counter__title__text` ❌ (Only one level) | ||
|
||
#### Variants and modifiers | ||
|
||
Sometimes you'll want to add variants to CSS-only classes. This can be done | ||
using **modifier classes** - e.g. `.counter--large`, `.counter__title--large`. | ||
**These classes must not be set alone.** E.g. `.counter__title--large` must not | ||
exist on an element without also having `.counter__title`. | ||
|
||
## Mixins, placeholder and variables | ||
|
||
Shared tooling is saved in [src/styles/scss/tools](../src/styles/scss/tools), | ||
NOT in individual stories. | ||
|
||
### Typography | ||
|
||
Typography is defined in | ||
[src/styles/scss/tools/variables.typography.scss](../src/styles/scss/tools/variables.typography.scss). | ||
These variables, all starting with `$typo__`, can be used, using a mixin, | ||
`@include typography($typo__h2);` in stories. | ||
Generally speaking, font styling should be avoided directly in stories, rather | ||
adding new variants in the `variables.typography.scss` file. | ||
This way, we can better keep track of what is available, and avoid duplicate | ||
styling in the future. | ||
|
||
## Legacy classes | ||
|
||
In the future, we want to apply these rules to old code too. Until then, | ||
the old classes are supported using the files | ||
in [src/styles/scss/legacy](../src/styles/scss/legacy). | ||
|
||
These classes should **not be used in new components** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.article { | ||
background-color: $c-global-primary; | ||
background-color: $color__global-primary; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.event-page { | ||
background-color: $c-global-primary; | ||
background-color: $color__global-primary; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo...