You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Before you can contribute to the codebase, you will need to fork the repo. The f
26
26
cd atomizer
27
27
```
28
28
3. Install dependencies by running `npm install` This repository is a [monorepo] that leverages npm's [workspaces] to build and test packages together.
29
-
4. Verify you've got everything set up forlocal development by running `npm test`
29
+
4. Verify you've got everything set up forlocal development by running `npm run build`then`npm test`
Copy file name to clipboardExpand all lines: docs/breakpoints.md
+86-4Lines changed: 86 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,11 @@ section: docs
5
5
title: Breakpoints
6
6
---
7
7
8
-
You can define your breakpoints as media queries in the config object and then apply those breakpoints to your Atomizer classes through <ahref="{% link guides/syntax.md %}#breakpoint_identifier">the breakpoint suffix</a> or automatic breakpoints.
8
+
You can define your breakpoints as media or container queries in the config object and then apply those breakpoints to your Atomizer classes through <ahref="{% link guides/syntax.md %}#breakpoint_identifier">the breakpoint suffix</a> or automatic breakpoints.
9
9
10
10
## Setting up Breakpoints
11
11
12
-
Pick the breakpoint names and media queries you want, for example:
12
+
Pick the breakpoint names and whichever media or container queries you want, for example:
13
13
14
14
```js
15
15
breakPoints: {
@@ -21,7 +21,7 @@ breakPoints: {
21
21
22
22
Breakpoints may be named anything you want, as long as the characters are valid for use in classnames.
23
23
24
-
## Usage
24
+
## Media Queries
25
25
26
26
There are two ways to make use of breakpoints in your Atomizer classes: explicitly and automatically.
27
27
@@ -72,7 +72,7 @@ In this example, the class `P(logo)` will style a box with a `padding` of `10px`
72
72
73
73
Likewise, any class that uses the variable `gutter` will receive different values depending on the currently active breakpoint.
74
74
75
-
## Examples
75
+
###Examples
76
76
77
77
When using explicit breakpoints, use multiple classes to have styles applied in the context of various breakpoints, for example:
78
78
@@ -97,3 +97,85 @@ When using explicit breakpoints, use multiple classes to have styles applied in
We have added support for container queries using the same syntax as media queries, since you are able to define what the rule is, just ensure the names are different to the media query rules.
104
+
105
+
```js
106
+
breakPoints: {
107
+
sm:'@media screen and (min-width: 700px)',
108
+
mw300:'@container (max-width: 300px)',
109
+
},
110
+
```
111
+
112
+
Same logic as above - append `--<breakpoint name>` to any Atomizer class to associate that styling with the breakpoint of your choice. For example, `Fz(1rem)--mw300` will create the following rule in the related container query:
113
+
114
+
```css
115
+
@container (max-width: 300px) {
116
+
#atomic.Fz(1rem)--mw300 {
117
+
font-size: 1rem;
118
+
}
119
+
}
120
+
```
121
+
122
+
### Named containers
123
+
124
+
It requires an additional config step if you are using [named containers](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries#naming_containment_contexts) which is better suited to atomic anyway.
125
+
126
+
<pclass="noteBox info">the custom value of `width300` matches the named container</p>
You can define a container and its type by using `ContType()` & `ContName()`, using the named container above, your markup would look something like this:
- Below 300px on the container DIV the boxes are displayed on top of each other (`Fxd(c)--contmw300`)
168
+
- Below 300px on the container DIV the headline size will be (`Fz(1.5rem)`)
169
+
170
+
<pclass="noteBox info">The example below is resizable <strong>Give it a try, resize by dragging the bottom right corner of the rounded box</strong></p>
0 commit comments