forked from jaredLunde/stellar-apps
-
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.
- Loading branch information
1 parent
2ef05dc
commit 7292ded
Showing
12 changed files
with
2,797 additions
and
20 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
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,16 @@ | ||
{ | ||
"presets": [ | ||
["@inst-app/react", {"removePropTypes": false}] | ||
], | ||
|
||
"env": { | ||
"cjs": { | ||
"presets": ["@inst-app/esx"] | ||
}, | ||
"es": { | ||
"presets": [ | ||
["@inst-app/esx", {"env": {"modules": 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,6 @@ | ||
.git | ||
node_modules | ||
.DS_Store | ||
*.log | ||
dist | ||
.idea |
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 @@ | ||
node_modules | ||
.babelrc | ||
*.log | ||
.idea |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Jared Lunde | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,49 @@ | ||
# @stellar-apps/content | ||
A component for establishing site-wide content widths | ||
|
||
## Installation | ||
`yarn add @stellar-apps/content` | ||
|
||
## Usage | ||
```js | ||
import Content from '@stellar-apps/content' | ||
|
||
|
||
function HomePage(props) { | ||
return ( | ||
<Box> | ||
<Content> | ||
Some content constrained to the content width | ||
</Content> | ||
|
||
<Content slim> | ||
Some content constrained to the slim content width | ||
</Content> | ||
</Box> | ||
) | ||
} | ||
``` | ||
|
||
### `Content` | ||
### Props | ||
In addition to the props below, this component accepts any prop that `curls/Box` accepts. | ||
- `slim {bool}` | ||
- **default** `width * 0.61803398875 // golden ratio` | ||
- Uses the `slimWidth` defined in the theme | ||
|
||
### defaultCSS | ||
```js | ||
const defaultCSS = css` | ||
width: 100%; | ||
margin-left: auto; | ||
margin-right: auto; | ||
` | ||
``` | ||
|
||
### defaultTheme | ||
```js | ||
const defaultTheme = { | ||
width: 1360, | ||
slimWidth: null // width * 0.61803398875 | ||
} | ||
``` |
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,33 @@ | ||
{ | ||
"name": "@stellar-apps/content", | ||
"version": "1.0.0", | ||
"main": "dist/cjs/index.js", | ||
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"module": "dist/es/index.js", | ||
"repository": "https://github.com/jaredLunde/stellar-apps/tree/master/packages/content", | ||
"scripts": { | ||
"build": "yarn run build:es && yarn run build:cjs", | ||
"build:es": "rimraf dist/es && cross-env NODE_ENV=production BABEL_ENV=es babel src --out-dir dist/es && npm run prettier:es", | ||
"build:cjs": "rimraf dist/cjs && cross-env NODE_ENV=production BABEL_ENV=cjs babel src --out-dir dist/cjs && npm run prettier:cjs", | ||
"watch:es": "rimraf dist/es && cross-env NODE_ENV=production BABEL_ENV=dist/es babel src -w --out-dir dist/es", | ||
"prettier": "prettier --single-quote --no-semi --no-bracket-spacing --trailing-comma es5 --write", | ||
"prettier:es": "yarn prettier \"dist/es/**/*.js\"", | ||
"prettier:cjs": "yarn prettier \"dist/cjs/**/*.js\"" | ||
}, | ||
"devDependencies": { | ||
"@inst-app/babel-preset-esx": "^1.0.15", | ||
"@inst-app/babel-preset-react": "^1.0.4", | ||
"prettier": "^1.15.3" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.2.0" | ||
}, | ||
"peerDependencies": { | ||
"curls": "^1.1.5", | ||
"emotion": "^10.0.6", | ||
"prop-types": "^15.6.0", | ||
"react": "^16.7.0" | ||
} | ||
} |
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,54 @@ | ||
import React from 'react' | ||
import {css} from 'emotion' | ||
import PropTypes from 'prop-types' | ||
import {createComponent, renderNode, FlexBox} from 'curls' | ||
|
||
|
||
const nodeType = 'div' | ||
const defaultCSS = css` | ||
width: 100%; | ||
margin-left: auto; | ||
margin-right: auto; | ||
` | ||
|
||
const defaultTheme = { | ||
width: 1360, | ||
slimWidth: null | ||
} | ||
|
||
const SFC = createComponent({ | ||
name: 'Content', | ||
propTypes: { | ||
slim: PropTypes.bool | ||
}, | ||
CSS: { | ||
__base: (val, theme) => css`max-width: ${theme.width}px;`, | ||
slim: (val, theme) => val === true && ( | ||
css`max-width: ${theme.slimWidth || theme.width * 0.61803398875}px;` | ||
) | ||
}, | ||
defaultTheme, | ||
themePath: 'content' | ||
}) | ||
|
||
|
||
export default React.forwardRef( | ||
function Content (props, innerRef) { | ||
return SFC({ | ||
__base: true, | ||
innerRef, | ||
...props, | ||
children: function (boxProps) { | ||
boxProps.children = function (nodeProps) { | ||
nodeProps.children = props.children | ||
nodeProps.nodeType = nodeProps.nodeType || nodeType | ||
delete nodeProps.__base | ||
|
||
return renderNode(nodeProps, defaultCSS) | ||
} | ||
|
||
return FlexBox(boxProps) | ||
} | ||
}) | ||
} | ||
) |
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 @@ | ||
export default from './Content' |
Oops, something went wrong.