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

DESKTOP-129: Responsive Best Practices #165

Merged
merged 4 commits into from
May 2, 2018

Conversation

yourpalsonja
Copy link
Contributor

@yourpalsonja yourpalsonja commented Apr 30, 2018

Now that we're building more mobile/tablet/desktop sites, it's time to put our responsive best practices into our code style docs. These will be updated a bit more after we determine our final grid implementation strategy.

I've also updated our docs a bit in reference to React, and de-emphasized the Adaptive.js specific examples.

Changes

  • Added Responsive Best Practices section
  • Updated examples to old Adaptive.js examples to be more "evergreen"
  • Simplified some content as per our Writing Style Guide

How To Test

  • You can browse the changes to the docs by viewing this branch in Github

TODOs:

  • +1
  • Updated CHANGELOG

Copy link
Contributor

@jeffkamo jeffkamo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update looks great! Only had small comments and typos to mention.

@@ -93,14 +90,18 @@ When authoring CSS, you should be always aware of the selectors that you are cre

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.

This can be down by following this simple rule: the first class in a selector is the file it can be found
This can be down by following this simple rule: the first class in a selector is the file it can be found.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an old typo:

This can be down done by...


These guidelines are a summary of our base principles: Our code bases should all...

* Be written like a single person typed it
* Be components first
* Be mobile-first
* Be modular–components are better than page specific styles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the "Be mobile-first" sentence above, it looks like this sentence is meant to read similarly: a continuous thought. But I suspect this is meant to be two thoughts. Can this be clarified? Maybe adding space, or switching to a colon?

@@ -0,0 +1,153 @@
# Responsive Best Practices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other pages have table of contents, can we include one here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


Our philosophy is that _the first breakpoint is no breakpoint_.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "to"

An experience shouldn't depend on a specific viewport width to work well.

1. All component and sub-component styles, including modifiers, are in one place
1. You can easily see what you are building on top of
1. Less scrolling and reduced cognitive overhead
1. Debugger is simpler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugger Debugging is simpler


Instead of:

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to add scss to these block for syntax highlighting.


Instead of:

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add scss for nicer syntax highlighting.



## Global vs. Local Variables/Mixins

Any `$variable` that is used in more than one file should be placed in the `/vellum/variables.scss` file. Others should be placed at the top of the file in which they're used.
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_variables.scss (prefixed with underscore). Since it's not a directory, it might not need the slash.

Copy link

@jbandelin jbandelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one typo I noticed when reading through it!

@@ -308,9 +308,9 @@ Sometimes there are situations when a component makes use of other components, a
</button>
```

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 should be unaware of anything external to itself. Continuing with this example, the Icon is an external component, therefore the Button component should be completely unaware there there is even such thing as icon classes, like `c-icon`.
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`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this say: "...should be completely unaware that of c-icon."

@yourpalsonja yourpalsonja merged commit b0e7ffd into develop May 2, 2018
@yourpalsonja yourpalsonja deleted the DESKTOP-129__responsive-best-practices branch May 2, 2018 00:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants