-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jakewies/develop
Added Docs!
- Loading branch information
Showing
37 changed files
with
3,909 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docs/out | ||
docs/.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
__tests__ | ||
docs | ||
src | ||
|
||
flexomatic.png | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [["styled-components", { "ssr": true, "displayName": true, "preprocess": false }]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
exportPathMap: function() { | ||
return { | ||
'/': { page: '/' }, | ||
'/docs': { page: '/docs' } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react' | ||
import Document, { Head, Main, NextScript } from 'next/document' | ||
import { ServerStyleSheet } from 'styled-components' | ||
|
||
export default class MyDocument extends Document { | ||
static getInitialProps({ renderPage }) { | ||
const sheet = new ServerStyleSheet() | ||
const page = renderPage(App => props => sheet.collectStyles(<App {...props} />)) | ||
const styleTags = sheet.getStyleElement() | ||
return { ...page, styleTags } | ||
} | ||
|
||
render() { | ||
return ( | ||
<html> | ||
<Head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>flexomatic</title> | ||
<link href="/static/styles/styles.css" rel="stylesheet" /> | ||
{this.props.styleTags} | ||
</Head> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</html> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import Head from 'next/head' | ||
import { Page, Example } from '../src/components' | ||
import examples from '../src/examples' | ||
|
||
const navRoutes = ['Home'] | ||
|
||
const Docs = () => ( | ||
<div> | ||
<Head> | ||
<link href="/static/styles/docs.css" rel="stylesheet" /> | ||
</Head> | ||
<Page childrenMaxWidth="1400px" routes={navRoutes}> | ||
<div>{examples.map((example, i) => <Example key={i} example={example} />)}</div> | ||
</Page> | ||
</div> | ||
) | ||
|
||
export default Docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import { | ||
Page, | ||
Section, | ||
UnorderedList, | ||
ListItem, | ||
TextBlock, | ||
Code, | ||
FancyLink | ||
} from '../src/components' | ||
|
||
const navRoutes = ['Docs'] | ||
|
||
const Home = () => ( | ||
<Page routes={navRoutes} childrenMaxWidth="1400px"> | ||
<Section title="Motivation"> | ||
<TextBlock> | ||
<Code>flexomatic</Code> aims to be a very simple, lightweight grid system with a flexible | ||
API that allows you to get up and running in seconds. It is based on the methodology | ||
proposed in{' '} | ||
<FancyLink href="https://philipwalton.github.io/solved-by-flexbox/demos/grids/"> | ||
Solved by Flexbox | ||
</FancyLink>, where the goal is to expose a minimal grid system that doesn't weigh the | ||
user down with a multitude of options. | ||
</TextBlock> | ||
</Section> | ||
<Section title="Features"> | ||
<UnorderedList pl="36px"> | ||
<ListItem> | ||
Each <Code>Cell</Code> component is the same width by default | ||
</ListItem> | ||
<ListItem> | ||
Full control over individual <Code>Cell</Code> components, including width and alignment | ||
</ListItem> | ||
<ListItem>Responsive, with media query support</ListItem> | ||
<ListItem>Nested Grids</ListItem> | ||
</UnorderedList> | ||
</Section> | ||
<Section title="Getting Started"> | ||
<UnorderedList pl="36px" mb="1rem"> | ||
<ListItem> | ||
Make sure <Code>styled-components</Code> is installed in your project | ||
</ListItem> | ||
<ListItem> | ||
<Code>yarn add flexomatic</Code> | ||
</ListItem> | ||
<ListItem> | ||
See the{' '} | ||
<Link href="/docs"> | ||
<a style={fancyNextLinkStyles}>docs</a> | ||
</Link>{' '} | ||
for examples and usage! 🚀 | ||
</ListItem> | ||
</UnorderedList> | ||
</Section> | ||
</Page> | ||
) | ||
|
||
const fancyNextLinkStyles = { | ||
borderBottom: '2px solid #000', | ||
color: '#000', | ||
textDecoration: 'none', | ||
paddingBottom: '2px' | ||
} | ||
|
||
export default Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react' | ||
import { object } from 'prop-types' | ||
import styled from 'styled-components' | ||
import ReactMarkdown from 'react-markdown' | ||
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live' | ||
import slugify from '@sindresorhus/slugify' | ||
import { SectionHeader, FancyLine } from './Section' | ||
import { Header2 } from './Typography' | ||
import { Grid, Cell, Demo } from '../../../src' | ||
|
||
const scope = { Grid, Cell, Demo } | ||
|
||
const Example = ({ example }) => { | ||
const slug = slugify(example.title) | ||
return ( | ||
<ExampleContainer> | ||
<SectionHeader> | ||
<Header2 id={slug}>{example.title}</Header2> | ||
<FancyLine /> | ||
</SectionHeader> | ||
<ExampleContent> | ||
<ReactMarkdown source={example.md} className="example__md" escapeHtml={false} /> | ||
<LiveProvider code={example.code} scope={scope}> | ||
<LiveContainer> | ||
<LiveEditor /> | ||
<LivePreview /> | ||
</LiveContainer> | ||
<StyledError /> | ||
</LiveProvider> | ||
</ExampleContent> | ||
</ExampleContainer> | ||
) | ||
} | ||
|
||
Example.propTypes = { | ||
example: object.isRequired | ||
} | ||
|
||
const ExampleContainer = styled.div` | ||
margin-bottom: 8rem; | ||
` | ||
|
||
const ExampleContent = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 50px; | ||
@media (min-width: 768px) { | ||
flex-direction: row; | ||
justify-content: space-between; | ||
margin-bottom: 25px; | ||
} | ||
` | ||
|
||
const LiveContainer = styled.div` | ||
display: flex; | ||
flex-direction: column-reverse; | ||
pre { | ||
overflow: auto; | ||
} | ||
.react-live-preview { | ||
border: 1px solid #eee; | ||
padding: 1em; | ||
min-height: 150px; | ||
} | ||
` | ||
|
||
const StyledError = styled(LiveError)` | ||
background: crimson; | ||
color: #fff; | ||
font-size: 12px; | ||
padding: 5px; | ||
font-family: Menlo, monospace; | ||
@media (min-width: 900px) { | ||
width: 50%; | ||
} | ||
` | ||
|
||
export default Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import styled from 'styled-components' | ||
|
||
const FancyLink = styled.a` | ||
border-bottom: 2px solid #000; | ||
color: #000; | ||
text-decoration: none; | ||
padding-bottom: 2px; | ||
` | ||
|
||
export default FancyLink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { Grid, Cell, Demo } from '../../../src' | ||
|
||
const StyledGrid = styled(Grid)` | ||
width: 100%; | ||
max-width: 125px; | ||
margin: 0 auto; | ||
` | ||
|
||
const GridDemo = () => ( | ||
<StyledGrid spacing="8px"> | ||
<Cell width={0.6}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.4}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.33}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.33}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.33}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={1}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.25}> | ||
<Demo /> | ||
</Cell> | ||
<Cell width={0.75}> | ||
<Demo /> | ||
</Cell> | ||
</StyledGrid> | ||
) | ||
|
||
export default GridDemo |
Oops, something went wrong.