Skip to content

Commit 1ca32b8

Browse files
committed
ability to set block margin size
1 parent 7d4f4c9 commit 1ca32b8

17 files changed

+321
-133
lines changed

example/src/document.mdx

+10-14
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,11 @@ Test Test
4444
This is extra info that you might find handy.
4545

4646
</Doc.Details>
47-
<div style={{backgroundColor: 'lightblue'}}>
48-
<Doc.Gutter>
47+
<Doc.Block marginSize='half' style={{backgroundColor: 'lightblue'}}>
4948

5049
Test
5150

52-
</Doc.Gutter>
53-
</div>
51+
</Doc.Block>
5452
</Doc.Aside>
5553
</Doc.AsideTop>
5654

@@ -59,19 +57,19 @@ Step 1: Declare some pages
5957

6058
<Doc.YouTube floatInset='200px' videoId='PkIS_Xgf1zc' />
6159

62-
<Doc.Gutter half>
60+
<Doc.Block marginSize='half'>
6361

6462
To declare your pages, you'll use Navi's `createSwitch()` and `createPage()` functions. Switches are used to map URL paths to pages. Pages represent individual locations that you can navigate to.
6563

6664
Test Test Test
6765

68-
</Doc.Gutter>
66+
</Doc.Block>
6967

7068
```
7169
hello
7270
```
7371

74-
<Doc.Gutter half>
72+
<Doc.Block marginSize='half'>
7573

7674
```js
7775
//---
@@ -135,7 +133,7 @@ main()
135133
//--- App.js <-- App.js
136134
```
137135

138-
</Doc.Gutter>
136+
</Doc.Block>
139137

140138
<Doc.Float inset='5rem'>
141139
<Doc.Details>
@@ -168,20 +166,18 @@ Step 2: Create `navigation`
168166
---------------------------
169167

170168
<Doc.Float minWidth='50%'>
171-
<Doc.Gutter>
172-
<div style={{ border: '2px solid green' }}>
169+
<Doc.Block style={{ border: '2px solid green' }}>
173170
<header>
174-
<Doc.Gutter half>
171+
<Doc.Gutter half horizontal>
175172
<h4>Test</h4>
176173
</Doc.Gutter>
177174
</header>
178-
<Doc.Gutter half>
175+
<Doc.Gutter half horizontal>
179176

180177
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
181178

182179
</Doc.Gutter>
183-
</div>
184-
</Doc.Gutter>
180+
</Doc.Block>
185181
</Doc.Float>
186182

187183
Navi does all of the hard work within a `Navigation` object. This is where Navi watches for history events, matches URLs to pages and content, and turns all of this info into an object that you can use.

layout.scss

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$smallGutter: 20px;
2+
$largeGutter: 32px;
3+
$maxSingleBodyWidth: 700px;
4+
$maxTwinBodyWidth: 602px;
5+
$minAsideWidth: 250px;
6+
$maxSingleWidth: 1100px;
7+
8+
$maxSmallSingleColumn: $maxSingleBodyWidth + $largeGutter - $smallGutter;
9+
10+
@mixin when-single-column {
11+
@media (max-width: $maxSingleWidth) {
12+
@content;
13+
}
14+
}
15+
@mixin when-small-single-column {
16+
@media (max-width: $maxSmallSingleColumn) {
17+
@content;
18+
}
19+
}
20+
@mixin when-large-single-column {
21+
@media (min-width: $maxSmallSingleColumn + 1) and (max-width: $maxSingleWidth) {
22+
@content;
23+
}
24+
}
25+
@mixin when-twin-column {
26+
@media (min-width: $maxSingleWidth) {
27+
@content;
28+
}
29+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@frontarm/doc",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"description": "A set of components for creating rich, responsive documents built around MDX.",
55
"author": "James K Nelson <[email protected]>",
66
"license": "MIT",

sizes.module.css

-6
This file was deleted.

src/DocContext.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Object.assign(defaultDocComponents, {
146146
,
147147

148148
Beware: ({ children, className='', title, ...props }) =>
149-
<Block Component='section' {...props} className={'Doc-Beware '+className}>
149+
<Block Component='aside' {...props} className={'Doc-Beware '+className}>
150150
<header>
151151
{title}
152152
</header>
@@ -163,7 +163,7 @@ Object.assign(defaultDocComponents, {
163163
</Block>
164164
,
165165
Details: ({ children, className='', icon, title, ...props }) =>
166-
<Block Component='section' {...props} className={'Doc-Details '+className}>
166+
<Block Component='aside' {...props} className={'Doc-Details '+className}>
167167
<header>
168168
{title}
169169
</header>

0 commit comments

Comments
 (0)