Skip to content

Commit

Permalink
ability to set block margin size
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesknelson committed Jan 20, 2019
1 parent 7d4f4c9 commit 1ca32b8
Show file tree
Hide file tree
Showing 17 changed files with 321 additions and 133 deletions.
24 changes: 10 additions & 14 deletions example/src/document.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ Test Test
This is extra info that you might find handy.

</Doc.Details>
<div style={{backgroundColor: 'lightblue'}}>
<Doc.Gutter>
<Doc.Block marginSize='half' style={{backgroundColor: 'lightblue'}}>

Test

</Doc.Gutter>
</div>
</Doc.Block>
</Doc.Aside>
</Doc.AsideTop>

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

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

<Doc.Gutter half>
<Doc.Block marginSize='half'>

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.

Test Test Test

</Doc.Gutter>
</Doc.Block>

```
hello
```

<Doc.Gutter half>
<Doc.Block marginSize='half'>

```js
//---
Expand Down Expand Up @@ -135,7 +133,7 @@ main()
//--- App.js <-- App.js
```

</Doc.Gutter>
</Doc.Block>

<Doc.Float inset='5rem'>
<Doc.Details>
Expand Down Expand Up @@ -168,20 +166,18 @@ Step 2: Create `navigation`
---------------------------

<Doc.Float minWidth='50%'>
<Doc.Gutter>
<div style={{ border: '2px solid green' }}>
<Doc.Block style={{ border: '2px solid green' }}>
<header>
<Doc.Gutter half>
<Doc.Gutter half horizontal>
<h4>Test</h4>
</Doc.Gutter>
</header>
<Doc.Gutter half>
<Doc.Gutter half horizontal>

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.

</Doc.Gutter>
</div>
</Doc.Gutter>
</Doc.Block>
</Doc.Float>

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.
Expand Down
29 changes: 29 additions & 0 deletions layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$smallGutter: 20px;
$largeGutter: 32px;
$maxSingleBodyWidth: 700px;
$maxTwinBodyWidth: 602px;
$minAsideWidth: 250px;
$maxSingleWidth: 1100px;

$maxSmallSingleColumn: $maxSingleBodyWidth + $largeGutter - $smallGutter;

@mixin when-single-column {
@media (max-width: $maxSingleWidth) {
@content;
}
}
@mixin when-small-single-column {
@media (max-width: $maxSmallSingleColumn) {
@content;
}
}
@mixin when-large-single-column {
@media (min-width: $maxSmallSingleColumn + 1) and (max-width: $maxSingleWidth) {
@content;
}
}
@mixin when-twin-column {
@media (min-width: $maxSingleWidth) {
@content;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@frontarm/doc",
"version": "0.4.2",
"version": "0.4.3",
"description": "A set of components for creating rich, responsive documents built around MDX.",
"author": "James K Nelson <[email protected]>",
"license": "MIT",
Expand Down
6 changes: 0 additions & 6 deletions sizes.module.css

This file was deleted.

4 changes: 2 additions & 2 deletions src/DocContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Object.assign(defaultDocComponents, {
,

Beware: ({ children, className='', title, ...props }) =>
<Block Component='section' {...props} className={'Doc-Beware '+className}>
<Block Component='aside' {...props} className={'Doc-Beware '+className}>
<header>
{title}
</header>
Expand All @@ -163,7 +163,7 @@ Object.assign(defaultDocComponents, {
</Block>
,
Details: ({ children, className='', icon, title, ...props }) =>
<Block Component='section' {...props} className={'Doc-Details '+className}>
<Block Component='aside' {...props} className={'Doc-Details '+className}>
<header>
{title}
</header>
Expand Down
Loading

0 comments on commit 1ca32b8

Please sign in to comment.