Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 85a0b34

Browse files
committed
DESKTOP-129: πŸ’„ address PR feedback
1 parent 6500b67 commit 85a0b34

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

β€Žcss/class-naming-conventions/readme.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Sometimes there are situations when a component makes use of other components, a
308308
</button>
309309
```
310310

311-
In situations like this it is tempting to just style the icon's class inside of the button. However, this practice is poor and creates tight coupling between the Button and Icon components that shouldn't exist. As a rule of thumb, a component should only know about what it's responsible for; it shouldn't be aware of anything external to itself. Since Icon is an external component, the Button component should be completely unaware that of `c-icon`.
311+
In situations like this it is tempting to just style the icon's class inside of the button. However, this practice is poor and creates tight coupling between the Button and Icon components that shouldn't exist. As a rule of thumb, a component should only know about what it's responsible for; it shouldn't be aware of anything external to itself. Since Icon is an external component, the Button component should be completely unaware of `c-icon`.
312312

313313
The solution to this challenge is to instead give the external component a new class that our new component can know about, like `c-button__icon`. This way, the component is treated like a sub-component of Button, and eliminates any tight coupling between the components. Both components can change, be added or removed, without affecting the other in an unpredictable way.
314314

β€Žcss/css-best-practices/readme.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ When authoring CSS, you should be always aware of the selectors that you are cre
9090

9191
Strive to create selectors that actually fully describe where it is authored. Put another way, any given selector should tell you which file and where in the file it is written.
9292

93-
This can be down by following this simple rule: the first class in a selector is the file it can be found.
93+
This can be done by following this simple rule: the first class in a selector is the file it can be found.
9494

9595
For example `.t-pdp .c-product` would be written in `_pdp.scss` and NOT `_product.scss`.
9696

@@ -101,7 +101,7 @@ The exception to this rule is when a base or root class is dependent on a global
101101

102102
## Mobile First
103103

104-
When styling responsively, we use min-width queries and build on top of them when we need to. Learn more about our other responsive best practices [here](responsive-best-practices/readme.md).
104+
When styling responsively, we use min-width queries and build on top of them when we need to. Learn more about our other responsive best practices [here](responsive-best-practices/readme.md).
105105

106106
## Single Direction Rule
107107

β€Žcss/introduction/readme.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ These guidelines are a summary of our base principles: Our code bases should all
2828

2929
* Be written like a single person typed it
3030
* Be mobile-first
31-
* Be modular–components are better than page specific styles
31+
* Be modular: components are better than page specific styles
3232
* Be page specific only as a last resort
3333
* Be written with nesting no deeper than 4 levels
3434
* Be written with selectors that self document their location

β€Žcss/responsive-best-practices/readme.mdβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# Responsive Best Practices
22

3+
## Table of Contents
4+
5+
* [Mobile First](#mobile-first)
6+
* [Use 4 or Less Major Breakpoints](#use-4-or-less-major-breakpoints)
7+
* [Keep Your Queries With Their Components](#keep-your-queries-with-their-components)
8+
39
## Mobile First
410

511
Our philosophy is that _the first breakpoint is no breakpoint_.
612

7-
There are plenty of good reasons to approach [design](https://www.lukew.com/ff/entry.asp?933) and [content strategy](https://alistapart.com/article/your-content-now-mobile) from this perspective, and the same goes for styling. An experience shouldn't depend on a specific viewport width work well.
13+
There are plenty of good reasons to approach [design](https://www.lukew.com/ff/entry.asp?933) and [content strategy](https://alistapart.com/article/your-content-now-mobile) from this perspective, and the same goes for styling. An experience shouldn't depend on a specific viewport width to work well.
814

915
When writing your CSS, a mobile-first mindset will help keep your code DRY. *Using `min-width` only queries is the key.*
1016

1117
Instead of:
1218

13-
```
19+
```scss
1420
// Button
1521
// ===
1622

@@ -29,7 +35,7 @@ Instead of:
2935

3036
Try:
3137

32-
```
38+
```scss
3339
// Button
3440
// ===
3541

@@ -64,11 +70,11 @@ SCSS allows you to write media queries inside a declaration. This has several ad
6470
1. All component and sub-component styles, including modifiers, are in one place
6571
1. You can easily see what you are building on top of
6672
1. Less scrolling and reduced cognitive overhead
67-
1. Debugger is simpler
73+
1. Debugging is simpler
6874

6975
Instead of:
7076

71-
```
77+
```scss
7278
// Some Component
7379
// ===
7480

@@ -112,7 +118,7 @@ Instead of:
112118

113119
Try:
114120

115-
```
121+
```scss
116122
// Some Component
117123
// ===
118124

β€Žcss/sass-best-practices/readme.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Chances are you'll have to use a combination of all these strategies that works
4545

4646
## Global vs. Local Variables/Mixins
4747

48-
Any `$variable` that is used in more than one file should be placed in the `/variables.scss` file. Others should be placed at the top of the file in which they're used.
48+
Any `$variable` that is used in more than one file should be placed in the `_variables.scss` file. Others should be placed at the top of the file in which they're used.
4949

5050
Any `@mixin` that is used in more than one file should be placed in the `/utilities` folder.
5151

0 commit comments

Comments
Β (0)