1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Merge pull request #6 from oceanprotocol/feature/content-styling

Content styling
This commit is contained in:
Matthias Kretschmann 2018-11-09 13:12:52 +01:00 committed by GitHub
commit afbd9bebfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 834 additions and 91 deletions

View File

@ -11,6 +11,10 @@
--- ---
**These docs are meant to be viewed on [docs.oceanprotocol.com](https://docs.oceanprotocol.com). You can still browse them here but links or images might not work in some places.**
---
- [Content](#content) - [Content](#content)
- [Editing docs](#editing-docs) - [Editing docs](#editing-docs)
- [Adding docs](#adding-docs) - [Adding docs](#adding-docs)
@ -18,8 +22,6 @@
- [Authors](#authors) - [Authors](#authors)
- [License](#license) - [License](#license)
---
## Content ## Content
...documentation concept... ...documentation concept...

View File

@ -3,8 +3,6 @@ title: Ecosystem
description: The Ocean Protocol network consists of various components. description: The Ocean Protocol network consists of various components.
--- ---
[Architecture](./architecture/)
Learn about all of them here. Learn about all of them here.
- 💧 keeper. See also [Set Up a Keeper](/setup/keeper/) - 💧 keeper. See also [Set Up a Keeper](/setup/keeper/)

View File

@ -1,5 +1,6 @@
--- ---
title: Set Up a Marketplace title: Set Up a Marketplace
description: Fill me
--- ---
If you want to set up a marketplace for the Ocean network, then you could start by running the following tech stack: If you want to set up a marketplace for the Ocean network, then you could start by running the following tech stack:
@ -36,8 +37,8 @@ TODO: Link to instructions.
At the time of writing, Aquarius worked with three databases: At the time of writing, Aquarius worked with three databases:
* MongoDB - MongoDB
* Elasticsearch - Elasticsearch
* BigchainDB - BigchainDB
TODO: Outline the pros and cons of each database. TODO: Outline the pros and cons of each database.

394
content/test.md Normal file
View File

@ -0,0 +1,394 @@
---
title: Content test
description: This is intended as a quick reference and showcase.
---
For more complete info, see [John Gruber's original spec](http://daringfireball.net/projects/markdown/) and the [Github-flavored Markdown info page](http://github.github.com/github-flavored-markdown/).
## Table of Contents
* [Headers](#headers)
* [Emphasis](#emphasis)
* [Lists](#lists)
* [Links](#links)
* [Images](#images)
* [Code and Syntax Highlighting](#code-and-syntax-highlighting)
* [Tables](#tables)
* [Blockquotes](#blockquotes)
* [Inline HTML](#inline-html)
* [Horizontal Rule](#horizontal-rule)
* [Line Breaks](#line-breaks)
* [YouTube Videos](#youtube-videos)
## Headers
```
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
```
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
## Emphasis
```
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
```
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
## Lists
```
1. First ordered list item
2. Another item
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
1. Ordered sub-list
4. And another item.
Some text that should be aligned with the above item.
* Unordered list can use asterisks
- Or minuses
+ Or pluses
```
1. First ordered list item
2. Another item
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
1. Ordered sub-list
4. And another item.
Some text that should be aligned with the above item.
* Unordered list can use asterisks
- Or minuses
+ Or pluses
## Links
There are two ways to create links.
```
[I'm an inline-style link](https://www.google.com)
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself]
URLs and URLs in angle brackets will automatically get turned into links.
http://www.example.com or <http://www.example.com> and sometimes
example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
```
[I'm an inline-style link](https://www.google.com)
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself]
URLs and URLs in angle brackets will automatically get turned into links.
http://www.example.com or <http://www.example.com> and sometimes
example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
## Images
```
Here's our jellyfish (hover to see the title text):
Inline-style:
![alt text](https://github.com/oceanprotocol/art/raw/master/jellyfish/jellyfish-grid%402x.png "Ocean Protocol Jellyfish")
Reference-style:
![alt text][jellyfish]
[jellyfish]: https://github.com/oceanprotocol/art/raw/master/jellyfish/jellyfish-grid%402x.png "Ocean Protocol Jellyfish"
```
Here's our jellyfish (hover to see the title text):
Inline-style:
![alt text](https://github.com/oceanprotocol/art/raw/master/jellyfish/jellyfish-grid%402x.png "Ocean Protocol Jellyfish")
Reference-style:
![alt text][jellyfish]
[jellyfish]: https://github.com/oceanprotocol/art/raw/master/jellyfish/jellyfish-grid%402x.png "Ocean Protocol Jellyfish"
## Code and Syntax Highlighting
Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and *Markdown Here* -- support syntax highlighting.
```
Inline `code` has `back-ticks around` it.
```
Inline `code` has `back-ticks around` it.
Blocks of code are either fenced by lines with three back-ticks, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.
<pre><code>```js
...
```
```python
...
```
```java
...
```
```
No language indicated, so no syntax highlighting.
But let's throw in a &lt;b&gt;tag&lt;/b&gt;.
```
</code></pre>
```js
const { Ocean, Logger } = require('@oceanprotocol/squid');
(async () => {
const ocean = await Ocean.getInstance({
nodeUri: 'http://localhost:8545'
})
const accounts = await ocean.getAccounts()
Logger.log(JSON.stringify(accounts, null, 2))
})()
```
```python
from squid_py.ocean_contracts import OceanContractsWrapper
ocean = OceanContractsWrapper(host='http://localhost', port=8545, config_path='config.ini')
ocean.init_contracts()
```
```java
package com.oceanprotocol.squid.core;
import com.oceanprotocol.squid.models.AbstractModel;
import java.io.IOException;
public interface FromJsonToModel {
static AbstractModel convertToModel(String json) throws IOException {
throw new UnsupportedOperationException();
};
}
```
```
No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
But let's throw in a <b>tag</b>.
```
Again, to see what languages are available for highlighting, and how to write those language names, see the [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
## Tables
Tables aren't part of the core Markdown spec, but they are part of GFM and *Markdown Here* supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.
```markdown
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- | :-----------: | ----: |
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
| | Markdown | Less | Pretty | |
| | ------------- | --------------- | ---------- |------- |
| | *Still* | `renders` | **nicely** | |
| | 1 | 2 | 3 | |
```
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- | :-----------: | ----: |
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
| Markdown | Less | Pretty |
| -------- | --------- | ---------- |
| *Still* | `renders` | **nicely** |
| 1 | 2 | 3 |
## Blockquotes
```markdown
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
```
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
## Inline HTML
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
```html
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
```
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
## Horizontal Rule
```
Three or more...
---
Hyphens
***
Asterisks
___
Underscores
```
Three or more...
---
Hyphens
***
Asterisks
___
Underscores
## Line Breaks
My basic recommendation for learning how line breaks work is to experiment and discover -- hit &lt;Enter&gt; once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.
Here are some things to try out:
```
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
```
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also begins a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
(Technical note: *Markdown Here* uses GFM line breaks, so there's no need to use MD's two-space line breaks.)
## YouTube Videos
They can't be added directly but you can add an image with a link to the video like this:
```html
<a href="http://www.youtube.com/watch?feature=player_embedded&v=8AkLfYOgIrE" target="_blank">
<img src="http://img.youtube.com/vi/8AkLfYOgIrE/0.jpg" alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" />
</a>
```
<a href="http://www.youtube.com/watch?feature=player_embedded&v=8AkLfYOgIrE" target="_blank"><img src="http://img.youtube.com/vi/8AkLfYOgIrE/0.jpg" alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
Or, in pure Markdown, but losing the image sizing and border:
```md
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
```

View File

@ -4,7 +4,7 @@
- title: Setup Guides - title: Setup Guides
description: Setting up the Ocean Protocol components. description: Setting up the Ocean Protocol components.
link: /setup/keeper/ link: /setup/marketplace/
- title: Tutorials - title: Tutorials
description: Browse tutorials for most common setup and development use-cases. description: Browse tutorials for most common setup and development use-cases.

View File

@ -1,8 +1,8 @@
- group: Setup Guides - group: Setup Guides
items: items:
- title: Set Up a Keeper
link: /setup/keeper/
- title: Set Up a Marketplace - title: Set Up a Marketplace
link: /setup/marketplace/ link: /setup/marketplace/
- title: Set Up a Keeper
link: /setup/keeper/
- title: Publish Data or Services - title: Publish Data or Services
link: /setup/publisher/ link: /setup/publisher/

View File

@ -1,6 +1,9 @@
// import global branding styles // import global branding styles
import './src/styles/global.scss' import './src/styles/global.scss'
// import prismjs syntax highlighting styles
import 'prismjs/themes/prism-tomorrow.css'
// IntersectionObserver polyfill for gatsby-image (Safari, IE) // IntersectionObserver polyfill for gatsby-image (Safari, IE)
if (typeof window.IntersectionObserver === 'undefined') { if (typeof window.IntersectionObserver === 'undefined') {
import('intersection-observer') import('intersection-observer')

View File

@ -1,7 +1,8 @@
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
title: 'Ocean Protocol Documentation', title: 'Ocean Protocol Documentation',
description: '', description:
'Learn everything about how to develop with Ocean Prototocol',
siteUrl: process.env.SITE_URL || 'https://docs.oceanprotocol.com' siteUrl: process.env.SITE_URL || 'https://docs.oceanprotocol.com'
}, },
plugins: [ plugins: [
@ -33,7 +34,7 @@ module.exports = {
{ {
resolve: 'gatsby-remark-images', resolve: 'gatsby-remark-images',
options: { options: {
maxWidth: 756, maxWidth: 640,
quality: 80, quality: 80,
withWebp: true, withWebp: true,
linkImagesToOriginal: false, linkImagesToOriginal: false,

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import styles from './Content.module.scss' import styles from './Content.module.scss'
const Content = ({ children }) => ( const Content = ({ children }) => (
<div className={styles.content}>{children}</div> <section className={styles.content}>{children}</section>
) )
Content.propTypes = { Content.propTypes = {

View File

@ -8,13 +8,10 @@
} }
.headerContent { .headerContent {
max-width: $break-point--large; composes: content from './Content.module.scss';
margin-left: auto;
margin-right: auto;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 $spacer;
} }
.headerLogo { .headerLogo {
@ -31,9 +28,10 @@
} }
.headerLogoImage { .headerLogoImage {
width: 60px; width: 4rem;
height: 60px; height: 4rem;
fill: #fff; fill: #fff;
margin: 0;
} }
.headerTitle { .headerTitle {

View File

@ -0,0 +1,37 @@
import React from 'react'
import { StaticQuery, graphql } from 'gatsby'
import { ReactComponent as Logo } from '@oceanprotocol/art/logo/logo-white.svg'
import Content from '../components/Content'
import styles from './HeaderHome.module.scss'
const HeaderHome = () => (
<StaticQuery
query={graphql`
query {
site {
siteMetadata {
title
description
}
}
}
`}
render={data => {
const { title, description } = data.site.siteMetadata
return (
<header className={styles.header}>
<Content>
<Logo className={styles.headerLogo} />
<h1 className={styles.headerTitle}>{title}</h1>
<p className={styles.headerDescription}>
{description}
</p>
</Content>
</header>
)
}}
/>
)
export default HeaderHome

View File

@ -0,0 +1,49 @@
@import 'variables';
@import 'animations';
.header {
background: $brand-black;
width: 100%;
padding: $spacer * 2 0;
min-height: 30rem;
color: $brand-white;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.headerLogo,
.headerTitle,
.headerDescription {
animation: fadeInUp .8s backwards;
}
.headerLogo {
width: 5rem;
height: 5rem;
}
.headerTitle {
margin-bottom: $spacer;
font-size: $font-size-h3;
animation-delay: .2s;
@media (min-width: $break-point--small) {
font-size: $font-size-h1;
}
}
.headerDescription {
margin-bottom: $spacer * 4;
max-width: $break-point--small;
margin-left: auto;
margin-right: auto;
animation-delay: .4s;
@media (min-width: $break-point--small) {
font-size: $font-size-large;
}
}

View File

@ -1,11 +1,9 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby' import { StaticQuery, graphql } from 'gatsby'
import Header from './Header' import Header from './Header'
const Layout = ({ children }) => ( const Layout = ({ children, header }) => (
<StaticQuery <StaticQuery
query={graphql` query={graphql`
query SiteTitleQuery { query SiteTitleQuery {
@ -16,26 +14,23 @@ const Layout = ({ children }) => (
} }
} }
`} `}
render={data => ( render={data => {
<> const { title } = data.site.siteMetadata
<Helmet const headerElement = header || <Header siteTitle={title} />
title={data.site.siteMetadata.title}
meta={[ return (
{ name: 'description', content: 'Sample' }, <>
{ name: 'keywords', content: 'sample, something' } {headerElement}
]} {children}
> </>
<html lang="en" /> )
</Helmet> }}
<Header siteTitle={data.site.siteMetadata.title} />
<section>{children}</section>
</>
)}
/> />
) )
Layout.propTypes = { Layout.propTypes = {
children: PropTypes.node.isRequired children: PropTypes.node.isRequired,
header: PropTypes.element
} }
export default Layout export default Layout

View File

@ -31,6 +31,8 @@
li { li {
display: block; display: block;
&:before { display: none; }
} }
} }

3
src/images/arrow.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="13" viewBox="0 0 12 13">
<polygon points="383.949 1434.201 374.999 1434.201 379.081 1430.202 378.34 1429.476 372.994 1434.714 378.34 1439.952 379.081 1439.227 374.999 1435.227 383.949 1435.227" transform="rotate(-180 192.471 720.714)"/>
</svg>

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@ -3,12 +3,17 @@ import PropTypes from 'prop-types'
import { Link, graphql } from 'gatsby' import { Link, graphql } from 'gatsby'
import Layout from '../components/Layout' import Layout from '../components/Layout'
import Content from '../components/Content' import Content from '../components/Content'
import HeaderHome from '../components/HeaderHome'
import { ReactComponent as Arrow } from '../images/arrow.svg'
import styles from './index.module.scss' import styles from './index.module.scss'
const SectionLink = ({ to, title, children }) => ( const SectionLink = ({ to, title, children }) => (
<Link to={to}> <Link to={to}>
<h3 className={styles.sectionTitle}>{title}</h3> <h3 className={styles.sectionTitle}>{title}</h3>
<p className={styles.sectionText}>{children}</p> <p className={styles.sectionText}>{children}</p>
<span className={styles.sectionMore}>
Learn More <Arrow />
</span>
</Link> </Link>
) )
@ -19,7 +24,7 @@ SectionLink.propTypes = {
} }
const IndexPage = ({ data, location }) => ( const IndexPage = ({ data, location }) => (
<Layout location={location}> <Layout location={location} header={<HeaderHome />}>
<Content> <Content>
<ul className={styles.sections}> <ul className={styles.sections}>
{data.allSectionsYaml.edges.map(({ node }) => ( {data.allSectionsYaml.edges.map(({ node }) => (

View File

@ -1,10 +1,11 @@
@import 'variables'; @import 'variables';
@import 'animations';
.sections { .sections {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
margin-top: $spacer * 2; margin-top: -($spacer * 4);
@media (min-width: $break-point--medium) { @media (min-width: $break-point--medium) {
display: flex; display: flex;
@ -13,27 +14,62 @@
} }
.section { .section {
margin-bottom: $spacer; margin-top: $spacer;
animation: fadeInUp .8s backwards;
&:before { display: none; }
@media (min-width: $break-point--medium) { @media (min-width: $break-point--medium) {
flex: 0 0 30%; flex: 0 0 30%;
margin-bottom: 0;
} }
a { a {
display: block; display: flex;
padding: $spacer * $line-height; flex-wrap: wrap;
padding: $spacer $spacer * $line-height;
border-radius: $border-radius; border-radius: $border-radius;
box-shadow: rgba($brand-black, .1) 0px 9px 18px; box-shadow: rgba($brand-black, .15) 0px 9px 18px;
color: $brand-grey; color: $brand-grey;
background: $brand-white;
height: 100%; height: 100%;
&:hover,
&:focus {
box-shadow: rgba($brand-black, .15) 0px 12px 20px;
}
}
animation-delay: .4s;
&:nth-child(2) {
animation-delay: .6s;
}
&:nth-child(3) {
animation-delay: .8s;
} }
} }
.sectionTitle { .sectionTitle {
margin-top: 0; margin-top: 0;
margin-bottom: $spacer / $line-height;
width: 100%;
} }
.sectionText { .sectionText {
margin-bottom: 0; margin-bottom: 0;
} }
.sectionMore {
align-self: flex-end;
margin-top: $spacer / $line-height;
color: $brand-pink;
width: 100%;
svg {
display: inline-block;
width: $font-size-small;
height: $font-size-small;
fill: $brand-grey-light;
}
}

View File

@ -0,0 +1,21 @@
@keyframes fadeInUp {
0% {
opacity: 0.01;
transform: translate3d(0, 5rem, 0);
}
100% {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes fadeIn {
0% {
opacity: 0.01;
}
100% {
opacity: 1;
}
}

View File

@ -21,6 +21,8 @@ $brand-gradient: linear-gradient(to right bottom, $brand-purple, $brand-pink);
$font-family-base: 'Sharp Sans Medium', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; $font-family-base: 'Sharp Sans Medium', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
$font-family-title: 'Sharp Sans Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; $font-family-title: 'Sharp Sans Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
$font-family-button: 'Sharp Sans Bold', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; $font-family-button: 'Sharp Sans Bold', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
$font-family-monospace: 'Fira Code', 'Fira Mono', Menlo, Monaco, Consolas,
'Courier New', monospace;
$font-size-root: 15px; $font-size-root: 15px;
$font-size-base: 1rem; $font-size-base: 1rem;

View File

@ -51,15 +51,83 @@ a {
p { p {
margin: 0; margin: 0;
margin-bottom: $spacer / 2; margin-bottom: $spacer / $line-height;
} }
// Lists
/////////////////////////////////////
ul {
li {
&::before {
content: ' \25AA'; // Black Small Square: &#9642;
top: -2px;
}
}
}
ol {
counter-reset: ol-counter;
li {
&::before {
content: counter(ol-counter) '.';
counter-increment: ol-counter;
font-family: $font-family-button;
top: -1px;
}
}
ul li::before {
content: ' \25AA';
}
}
ul,
ol {
margin-top: 0;
margin-bottom: $spacer;
padding-left: $spacer / $line-height;
list-style: none;
li {
position: relative;
display: block;
&::before {
position: absolute;
left: -($spacer / $line-height);
color: $brand-grey-light;
user-select: none;
}
}
}
// Inline typography
/////////////////////////////////////
b,
strong, strong,
.strong { .bold {
font-family: $font-family-button; font-family: $font-family-button;
font-weight: 600; font-weight: 600;
} }
em,
.italic {
font-style: italic;
}
abbr[title],
dfn {
text-transform: none;
font-style: normal;
font-size: inherit;
border-bottom: 1px dashed $brand-grey-light;
cursor: help;
font-feature-settings: inherit;
}
h1, h1,
h2, h2,
h3, h3,
@ -91,46 +159,134 @@ h5 {
font-size: $font-size-h5; font-size: $font-size-h5;
} }
.fade { // Responsive Media
&-enter { /////////////////////////////////////
opacity: .01;
figure,
img,
svg,
video,
audio,
embed,
canvas,
picture {
max-width: 100%;
height: auto;
margin: 0 auto;
display: block;
}
hr {
margin: $spacer * $line-height 0;
border: 0;
border-bottom: .1rem solid $brand-grey-lighter;
}
// Quotes
/////////////////////////////////////
q {
font-style: italic;
}
cite {
font-style: normal;
text-transform: uppercase;
}
blockquote,
blockquote > p {
font-style: italic;
}
blockquote {
margin: 0 0 $spacer;
padding-left: $spacer;
}
// Tables
/////////////////////////////////////
table {
width: 100%;
margin-bottom: $spacer * $line-height;
border-collapse: collapse;
th,
td {
border: 0;
margin: 0;
padding: $spacer / 2;
border-bottom: 1px solid $brand-grey-lighter;
text-align: left;
&[align="center"] {
text-align: center;
}
&[align="right"] {
text-align: right;
}
} }
&-enter-active { th {
opacity: 1; font-family: $font-family-button;
transition: opacity 400ms ease-out; font-weight: 600;
}
&-exit {
opacity: 1;
}
&-exit-active {
opacity: .01;
transition: opacity 400ms ease-in;
} }
} }
.grow { // Code
&-enter { /////////////////////////////////////
opacity: .01;
max-height: 0;
}
&-enter-active { code,
opacity: 1; kbd,
max-height: 500px; pre,
transition: 200ms ease-out; samp {
} // lots of !important to overwrite prims.js theme
font-family: $font-family-monospace !important;
font-size: $font-size-small !important;
background: $brand-black !important;
color: $brand-white !important;
border-radius: $border-radius !important;
}
&-exit { pre {
opacity: 1; display: block;
max-height: 500px; margin-bottom: $spacer !important;
} padding: 0 !important;
&-exit-active { // make 'em scrollable
opacity: .01; overflow: auto;
max-height: 0; -webkit-overflow-scrolling: touch;
transition: 200ms ease-in;
code {
padding: $spacer;
white-space: pre;
display: block;
color: inherit;
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
overflow: auto;
} }
} }
// Selection
/////////////////////////////////////
::-moz-selection {
background: $brand-black;
color: #fff;
}
::selection {
background: $brand-black;
color: #fff;
}
// Gatsby specific
/////////////////////////////////////
.anchor {
margin-top: .8rem;
}

View File

@ -23,12 +23,34 @@ export default class DocTemplate extends Component {
<Layout location={location}> <Layout location={location}>
<HeaderSection title={section} /> <HeaderSection title={section} />
<Content> <Content>
<main className={styles.wrapper}> {section ? (
<aside className={styles.sidebar}> <main className={styles.wrapper}>
<Sidebar location={location} sidebar={section} /> <aside className={styles.sidebar}>
</aside> <Sidebar
location={location}
sidebar={section}
/>
</aside>
<article className={styles.main}>
<header className={styles.header}>
<h1 className={styles.title}>{title}</h1>
{description && (
<p className={styles.lead}>
{description}
</p>
)}
</header>
<article className={styles.main}> <div
className={styles.docContent}
dangerouslySetInnerHTML={{
__html: post.html
}}
/>
</article>
</main>
) : (
<article className={styles.mainSingle}>
<header className={styles.header}> <header className={styles.header}>
<h1 className={styles.title}>{title}</h1> <h1 className={styles.title}>{title}</h1>
{description && ( {description && (
@ -38,10 +60,12 @@ export default class DocTemplate extends Component {
<div <div
className={styles.docContent} className={styles.docContent}
dangerouslySetInnerHTML={{ __html: post.html }} dangerouslySetInnerHTML={{
__html: post.html
}}
/> />
</article> </article>
</main> )}
</Content> </Content>
</Layout> </Layout>
) )

View File

@ -3,16 +3,22 @@
.wrapper { .wrapper {
@media (min-width: $break-point--medium) { @media (min-width: $break-point--medium) {
display: flex; display: flex;
justify-content: space-between;
} }
} }
.sidebar { .sidebar {
flex: 0 0 25%; flex: 0 0 30%;
padding-right: $spacer * 2;
+ .main {
flex: 0 0 70%;
max-width: $break-point--small;
}
} }
.main { .mainSingle {
flex: 0 0 70%; max-width: $break-point--small;
margin: auto;
} }
.header { .header {
@ -31,10 +37,20 @@
} }
.docContent { .docContent {
// handling long text, like URLs
overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-word;
figcaption { figcaption {
font-size: $font-size-small; font-size: $font-size-small;
text-align: center; text-align: center;
color: $brand-grey-light; color: $brand-grey-light;
margin-top: $spacer / 2; margin-top: $spacer / 2;
} }
h1, h2 {
margin-top: $spacer;
margin-bottom: $spacer;
}
} }