react-outline 1.7.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -116
- package/dist/Styles.js +34 -35
- package/dist/element.js +69 -88
- package/dist/main.js +22 -35
- package/dist/reactOutline.js +241 -0
- package/dist/reactOutline.js.map +7 -0
- package/dist/styleItem.js +105 -91
- package/dist/utils/buildCssString.js +2 -2
- package/dist/utils/genCss.js +21 -32
- package/dist/utils/genStyles.js +13 -26
- package/dist/utils/hasKids.js +2 -4
- package/dist/utils/index.js +80 -66
- package/dist/utils/makeid.js +3 -6
- package/dist/utils/object2css.js +10 -22
- package/dist/utils/pubsub.js +10 -24
- package/dist/utils/replaceColors.js +3 -4
- package/dist/utils/replacedStyleFn.js +5 -10
- package/dist/utils/sanitizeOutlineInput.js +8 -24
- package/dist/utils/separateCssStyle.js +5 -8
- package/dist/wrapStyles.js +18 -14
- package/index.d.ts +149 -0
- package/package.json +38 -24
- package/.babelrc +0 -6
- package/.travis.yml +0 -7
- package/__snapshots__/cornerCases.test.js.snap +0 -139
- package/__snapshots__/example.test.js.snap +0 -408
- package/cornerCases.test.js +0 -367
- package/dist/utils/sanitizeStyleObj.js +0 -22
- package/empty-module.js +0 -1
- package/example/.babelrc +0 -4
- package/example/.storybook/config.js +0 -7
- package/example/.storybook/webpack.config.js +0 -14
- package/example/README.md +0 -11
- package/example/package.json +0 -55
- package/example/stories/Animate/basic.js +0 -73
- package/example/stories/Basics/CreatingAndApplyingAStyle.js +0 -12
- package/example/stories/Basics/Form.js +0 -24
- package/example/stories/Basics/ImpliedTags.js +0 -40
- package/example/stories/Basics/PassingStyleAndFuntion.js +0 -13
- package/example/stories/Basics/PassingStyleAndFuntionAsArray.js +0 -13
- package/example/stories/Basics/ReusingElements.js +0 -13
- package/example/stories/Basics/Share.js +0 -19
- package/example/stories/Basics/UsingTheTagCreater.js +0 -13
- package/example/stories/Basics/WrappingAnExistingElement.js +0 -19
- package/example/stories/Button.js +0 -27
- package/example/stories/CSSHelpers/CssSelector.js +0 -24
- package/example/stories/CSSHelpers/CssSource.js +0 -18
- package/example/stories/CSSHelpers/DynamicCssSelectors.js +0 -24
- package/example/stories/CSSHelpers/Hover.js +0 -20
- package/example/stories/CSSHelpers/MediaQuery.js +0 -22
- package/example/stories/CSSHelpers/VendorPrefix.js +0 -19
- package/example/stories/CombineStyles/CreatingAndApplyingAStyle.js +0 -16
- package/example/stories/CombineStyles/LogicFnWithGenerateElement.js +0 -16
- package/example/stories/CombineStyles/PassStyleObjToGenerateElement.js +0 -9
- package/example/stories/CombineStyles/UsingAPropFlag.js +0 -16
- package/example/stories/CombineStyles/UsingTheTagCreater.js +0 -16
- package/example/stories/Ref/byFn.js +0 -51
- package/example/stories/Ref/onEvent.js +0 -43
- package/example/stories/RuntimeFunctions/DynamicStyles.js +0 -32
- package/example/stories/RuntimeFunctions/FunctionWithOutStyle.js +0 -31
- package/example/stories/RuntimeFunctions/ModifyingStyles.js +0 -36
- package/example/stories/RuntimeFunctions/WithGeneratedElements.js +0 -38
- package/example/stories/Welcome.js +0 -90
- package/example/stories/index.js +0 -88
- package/example/stories/load.js +0 -229
- package/example.test.js +0 -16
- package/source/Styles.js +0 -23
- package/source/element.js +0 -100
- package/source/main.js +0 -56
- package/source/styleItem.js +0 -105
- package/source/utils/buildCssString.js +0 -6
- package/source/utils/genCss.js +0 -30
- package/source/utils/genStyles.js +0 -19
- package/source/utils/hasKids.js +0 -6
- package/source/utils/index.js +0 -27
- package/source/utils/makeid.js +0 -9
- package/source/utils/object2css.js +0 -20
- package/source/utils/pubsub.js +0 -22
- package/source/utils/replaceColors.js +0 -11
- package/source/utils/replacedStyleFn.js +0 -30
- package/source/utils/sanitizeOutlineInput.js +0 -72
- package/source/utils/sanitizeStyleObj.js +0 -13
- package/source/utils/separateCssStyle.js +0 -25
- package/source/wrapStyles.js +0 -30
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
title:{ backgroundColor: "red" },
|
|
7
|
-
"title, content":{
|
|
8
|
-
textShadow: "2px 2px 2px black"
|
|
9
|
-
},
|
|
10
|
-
content:{ base:{ color: "red"} },
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
styles = outline(styles);
|
|
14
|
-
const Title = styles.title`div`
|
|
15
|
-
|
|
16
|
-
export default <div>
|
|
17
|
-
<Title>basic</Title>
|
|
18
|
-
<span style={styles.content()}>content</span>
|
|
19
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
class HelloMessage extends React.Component {
|
|
5
|
-
render() {
|
|
6
|
-
return <div style={this.props.style}>Hello, {this.props.name}</div>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let styles = {
|
|
11
|
-
base : {
|
|
12
|
-
title:{ base : {backgroundColor: "red"} }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
styles = outline(styles);
|
|
16
|
-
|
|
17
|
-
const Title = styles.title`${HelloMessage}`
|
|
18
|
-
|
|
19
|
-
export default <Title name="basic"/>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const buttonStyles = {
|
|
4
|
-
border: '1px solid #eee',
|
|
5
|
-
borderRadius: 3,
|
|
6
|
-
backgroundColor: '#FFFFFF',
|
|
7
|
-
cursor: 'pointer',
|
|
8
|
-
fontSize: 15,
|
|
9
|
-
padding: '3px 10px',
|
|
10
|
-
margin: 10,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const Button = ({ children, onClick }) => (
|
|
14
|
-
<button
|
|
15
|
-
style={buttonStyles}
|
|
16
|
-
onClick={onClick}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</button>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
Button.propTypes = {
|
|
23
|
-
children: React.PropTypes.string.isRequired,
|
|
24
|
-
onClick: React.PropTypes.func,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default Button;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
import { Styles } from 'react-outline'
|
|
4
|
-
|
|
5
|
-
let styles = {
|
|
6
|
-
base : {
|
|
7
|
-
title:{
|
|
8
|
-
base:{ background: "lightblue", color:"black" },
|
|
9
|
-
"div:nth-child(even)":{ background: "darkblue" , color:"white" }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
styles = outline(styles);
|
|
14
|
-
|
|
15
|
-
const Title = styles.title`div`
|
|
16
|
-
|
|
17
|
-
export default <div>
|
|
18
|
-
<Styles/>
|
|
19
|
-
<Title>
|
|
20
|
-
<div>foo</div>
|
|
21
|
-
<div>bar</div>
|
|
22
|
-
<div>baz</div>
|
|
23
|
-
</Title>
|
|
24
|
-
</div>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Styles } from 'react-outline'
|
|
3
|
-
|
|
4
|
-
const Title = <div>
|
|
5
|
-
<Styles>{`
|
|
6
|
-
|
|
7
|
-
.title{
|
|
8
|
-
font-size: 25px;
|
|
9
|
-
background-color: yellow;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
`}</Styles>
|
|
13
|
-
|
|
14
|
-
<div className="title">basic</div>
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
export default Title
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
import { Styles } from 'react-outline'
|
|
4
|
-
|
|
5
|
-
let styles = {
|
|
6
|
-
base : {
|
|
7
|
-
title:{
|
|
8
|
-
base:{ background: "lightblue", color:"black" },
|
|
9
|
-
"div:nth-child(even)":{ background: "darkblue" , color:"white" }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
styles = outline(styles);
|
|
14
|
-
|
|
15
|
-
const Title = styles.title`div`
|
|
16
|
-
|
|
17
|
-
export default <div>
|
|
18
|
-
<Styles/>
|
|
19
|
-
<Title css={{"div:nth-child(even)":{color:"red"}}}>
|
|
20
|
-
<div>foo</div>
|
|
21
|
-
<div>bar</div>
|
|
22
|
-
<div>baz</div>
|
|
23
|
-
</Title>
|
|
24
|
-
</div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
import { Styles } from 'react-outline'
|
|
4
|
-
|
|
5
|
-
let styles = {
|
|
6
|
-
base : {
|
|
7
|
-
title:{
|
|
8
|
-
base:{ background: "lightblue", color:"black" },
|
|
9
|
-
":hover":{ background: "darkblue" , color:"white" }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
styles = outline(styles);
|
|
14
|
-
|
|
15
|
-
const Title = styles.title`div`
|
|
16
|
-
|
|
17
|
-
export default <div>
|
|
18
|
-
<Styles/>
|
|
19
|
-
<Title>basic</Title>
|
|
20
|
-
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
import { Styles } from 'react-outline'
|
|
4
|
-
|
|
5
|
-
let styles = {
|
|
6
|
-
base : {
|
|
7
|
-
title:{
|
|
8
|
-
base:{ background: "lightgreen", color:"black" },
|
|
9
|
-
"@media (max-width: 600px)": {
|
|
10
|
-
background: "darkgreen", color:"white"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
styles = outline(styles);
|
|
16
|
-
|
|
17
|
-
const Title = styles.title`div`
|
|
18
|
-
|
|
19
|
-
export default <div>
|
|
20
|
-
<Styles/>
|
|
21
|
-
<Title>basic</Title>
|
|
22
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
title:{
|
|
7
|
-
display: "flex",
|
|
8
|
-
transition: "all .5s",
|
|
9
|
-
userSelect: "none",
|
|
10
|
-
fontSize:"40px",
|
|
11
|
-
background: "linear-gradient(to bottom, lightblue, darkblue)"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
styles = outline(styles);
|
|
16
|
-
|
|
17
|
-
const Title = <div style={styles.title()}>basic</div>
|
|
18
|
-
|
|
19
|
-
export default Title
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
title:{
|
|
7
|
-
base:{fontSize: "25px" },
|
|
8
|
-
error:{color:"#f00" }
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
styles = outline(styles);
|
|
13
|
-
|
|
14
|
-
const Title = <div style={styles.title({error:true})}>basic</div>
|
|
15
|
-
|
|
16
|
-
export default Title
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline, { withOptions } from 'react-outline'
|
|
3
|
-
|
|
4
|
-
// example using a custom style generater with custom colors
|
|
5
|
-
const custom_outline = withOptions({colors:{CrazyRed:"#f00"}})
|
|
6
|
-
|
|
7
|
-
// inline the style schema
|
|
8
|
-
const styles = custom_outline({
|
|
9
|
-
title:{fontSize: "25px" }
|
|
10
|
-
},{
|
|
11
|
-
title:(x)=>x
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const Title = styles.title`div`
|
|
15
|
-
|
|
16
|
-
export default <Title style={{color:"CrazyRed"}}>basic</Title>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
title:{
|
|
7
|
-
base:{fontSize: "25px" },
|
|
8
|
-
error:{color:"#f00" }
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
styles = outline(styles);
|
|
13
|
-
|
|
14
|
-
const Title = styles.title`div`
|
|
15
|
-
|
|
16
|
-
export default <Title error>basic</Title>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
title:{
|
|
7
|
-
base:{fontSize: "25px" },
|
|
8
|
-
error:{color:"#f00" }
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
styles = outline(styles);
|
|
13
|
-
|
|
14
|
-
const Title = styles.title`div`
|
|
15
|
-
|
|
16
|
-
export default <Title style={{error:true}}>basic</Title>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { findDOMNode } from 'react-dom'
|
|
3
|
-
import outline from 'react-outline'
|
|
4
|
-
import { Styles } from 'react-outline'
|
|
5
|
-
|
|
6
|
-
let styles = {
|
|
7
|
-
textarea : {
|
|
8
|
-
base:{
|
|
9
|
-
border: "2px solid transparent",
|
|
10
|
-
borderBottom: "2px solid lightgray",
|
|
11
|
-
},
|
|
12
|
-
":focus":{
|
|
13
|
-
outline: "none",
|
|
14
|
-
borderBottom: "2px solid red",
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
styles = outline(styles);
|
|
19
|
-
|
|
20
|
-
const Textarea = styles.textarea``
|
|
21
|
-
|
|
22
|
-
class Panel extends React.Component {
|
|
23
|
-
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super(props);
|
|
26
|
-
this.listenScrollEvent = this.listenScrollEvent.bind(this)
|
|
27
|
-
this.state = {scrollTop : 0};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
componentDidMount() {
|
|
31
|
-
this.domElem.addEventListener('scroll', this.listenScrollEvent);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
componentWillUnmount() {
|
|
35
|
-
this.domElem.removeEventListener('scroll', this.listenScrollEvent);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
listenScrollEvent() {
|
|
39
|
-
this.setState({scrollTop:this.domElem.scrollTop})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
render() {
|
|
43
|
-
return <div>
|
|
44
|
-
<Styles/>
|
|
45
|
-
Scroll me - { this.state.scrollTop }<br/>
|
|
46
|
-
<Textarea style={{width:450}} ref={(reatElem)=> this.domElem = findDOMNode(reatElem) } defaultValue={"1,2,3,4,5".replace(/,/g,"\n")} />
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default <Panel/>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { findDOMNode } from 'react-dom'
|
|
3
|
-
import outline from 'react-outline'
|
|
4
|
-
import { Styles } from 'react-outline'
|
|
5
|
-
|
|
6
|
-
let styles = {
|
|
7
|
-
textarea : {
|
|
8
|
-
base:{
|
|
9
|
-
border: "2px solid transparent",
|
|
10
|
-
borderBottom: "2px solid lightgray",
|
|
11
|
-
},
|
|
12
|
-
":focus":{
|
|
13
|
-
outline: "none",
|
|
14
|
-
borderBottom: "2px solid red",
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
styles = outline(styles);
|
|
19
|
-
|
|
20
|
-
const Textarea = styles.textarea``
|
|
21
|
-
|
|
22
|
-
class Panel extends React.Component {
|
|
23
|
-
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super(props);
|
|
26
|
-
this.listenScrollEvent = this.listenScrollEvent.bind(this)
|
|
27
|
-
this.state = {scrollTop : 0};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
listenScrollEvent(domElem,event) {
|
|
31
|
-
this.setState({scrollTop:domElem.scrollTop})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
return <div>
|
|
36
|
-
<Styles/>
|
|
37
|
-
Scroll me - { this.state.scrollTop }<br/>
|
|
38
|
-
<Textarea onDomEvent={{'scroll': this.listenScrollEvent}} style={{width:450}} defaultValue={"1,2,3,4,5".replace(/,/g,"\n")} />
|
|
39
|
-
</div>
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default <Panel/>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
content:{
|
|
7
|
-
backgroundColor:"gray"
|
|
8
|
-
},
|
|
9
|
-
cell:{
|
|
10
|
-
fontSize:10
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
styles.content = (numberOfCells) => ({ height : `${numberOfCells*50}px` })
|
|
16
|
-
|
|
17
|
-
styles = outline(styles);
|
|
18
|
-
|
|
19
|
-
const data = [{name:"foo"},
|
|
20
|
-
{name:"bar"},
|
|
21
|
-
{name:"cat"}]
|
|
22
|
-
|
|
23
|
-
const LogicStyled = <div style={styles.content(data.length)}> {
|
|
24
|
-
|
|
25
|
-
data.map( (cellData,i) => (
|
|
26
|
-
<span key={i} styles={styles.cell()}>{
|
|
27
|
-
cellData.name
|
|
28
|
-
}</span>) )
|
|
29
|
-
|
|
30
|
-
} </div>
|
|
31
|
-
|
|
32
|
-
export default LogicStyled
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
// no "content" in style object
|
|
5
|
-
|
|
6
|
-
let styles = {
|
|
7
|
-
base : {
|
|
8
|
-
cell:{
|
|
9
|
-
fontSize:10
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
styles.content = (numberOfCells) => ({ backgroundColor : "green" })
|
|
15
|
-
|
|
16
|
-
styles = outline(styles);
|
|
17
|
-
|
|
18
|
-
const data = [{name:"foo"},
|
|
19
|
-
{name:"bar"},
|
|
20
|
-
{name:"cat"}]
|
|
21
|
-
|
|
22
|
-
const LogicStyled = <div style={styles.content(data.length)}> {
|
|
23
|
-
|
|
24
|
-
data.map( (cellData,i) => (
|
|
25
|
-
<span key={i} styles={styles.cell()}>{
|
|
26
|
-
cellData.name
|
|
27
|
-
}</span>) )
|
|
28
|
-
|
|
29
|
-
} </div>
|
|
30
|
-
|
|
31
|
-
export default LogicStyled
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
content:{
|
|
7
|
-
backgroundColor:"lightgray"
|
|
8
|
-
},
|
|
9
|
-
cell:{
|
|
10
|
-
fontSize:10
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
styles.cell = (style,important) => {
|
|
16
|
-
return ({ fontSize : style.fontSize + ((important)?5:-5) })
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
styles = outline(styles);
|
|
20
|
-
|
|
21
|
-
const data = [{name:"foo",important:true},
|
|
22
|
-
{name:"bar",important:false},
|
|
23
|
-
{name:"baz",important:true},
|
|
24
|
-
{name:"qux",important:false},
|
|
25
|
-
{name:"quux"}]
|
|
26
|
-
|
|
27
|
-
const LogicStyled = <div style={styles.content(data.length)}> {
|
|
28
|
-
|
|
29
|
-
data.map( (cellData,i) => (
|
|
30
|
-
<span key={i} style={styles.cell(cellData.important)}>{
|
|
31
|
-
cellData.name
|
|
32
|
-
}</span>) )
|
|
33
|
-
|
|
34
|
-
} </div>
|
|
35
|
-
|
|
36
|
-
export default LogicStyled
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
|
|
4
|
-
let styles = {
|
|
5
|
-
base : {
|
|
6
|
-
content:{},
|
|
7
|
-
cell:{
|
|
8
|
-
fontSize:10
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
styles.content = (numberOfCells) => ({
|
|
14
|
-
backgroundColor : "red",
|
|
15
|
-
height : `${numberOfCells*100}px`
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
styles.cell = (style,important) => ({ fontSize : style.fontSize + (important)?5:-5 })
|
|
19
|
-
|
|
20
|
-
styles = outline(styles);
|
|
21
|
-
|
|
22
|
-
const data = [{name:"foo",important:true},
|
|
23
|
-
{name:"bar",important:false},
|
|
24
|
-
{name:"cat"}]
|
|
25
|
-
|
|
26
|
-
const Group = styles.content`div`
|
|
27
|
-
const Cell = styles.cell`span`
|
|
28
|
-
|
|
29
|
-
const LogicStyled = <Group style={data.length}> {
|
|
30
|
-
|
|
31
|
-
data.map( (cellData,i) => (
|
|
32
|
-
<Cell key={i} styles={cellData.important}>{
|
|
33
|
-
cellData.name
|
|
34
|
-
}</Cell>) )
|
|
35
|
-
|
|
36
|
-
} </Group>
|
|
37
|
-
|
|
38
|
-
export default LogicStyled
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import outline from 'react-outline'
|
|
3
|
-
import { Styles, setOptions} from 'react-outline'
|
|
4
|
-
|
|
5
|
-
const css = {
|
|
6
|
-
article:{
|
|
7
|
-
base:{
|
|
8
|
-
background:"linear-gradient(to bottom, rgb(26,154,218) 0%,rgb(13,131,190) 100%)",
|
|
9
|
-
padding: "10px"
|
|
10
|
-
},
|
|
11
|
-
":hover":{
|
|
12
|
-
background:"linear-gradient(to bottom, rgb(24, 142, 202) 0%,rgb(12, 118, 171) 100%)"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const styles = outline([css]);
|
|
18
|
-
|
|
19
|
-
const Panel = styles.article``
|
|
20
|
-
|
|
21
|
-
export default class Welcome extends React.Component {
|
|
22
|
-
showApp(e) {
|
|
23
|
-
e.preventDefault();
|
|
24
|
-
if(this.props.showApp) this.props.showApp();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
render() {
|
|
28
|
-
return (<div>
|
|
29
|
-
<Styles>{`
|
|
30
|
-
|
|
31
|
-
*{
|
|
32
|
-
font-family: arial,sans-serif;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
`}</Styles>
|
|
36
|
-
<a href="https://www.npmjs.com/package/react-outline">
|
|
37
|
-
<img alt="react-outline" title="react-outline logo" src="https://s3-eu-west-1.amazonaws.com/files.codemeasandwich.com/react-outline-logo2.png"/></a>
|
|
38
|
-
<h1>React-outline is a utility of managing your inline style</h1>
|
|
39
|
-
<h2>
|
|
40
|
-
react-outline was designed to more easly manage inline styles and better support server side rendering with complete styling
|
|
41
|
-
</h2>
|
|
42
|
-
<p>Feathers:</p>
|
|
43
|
-
<ul>
|
|
44
|
-
<li>Cleaner JSX markup (without the styles)</li>
|
|
45
|
-
<li>Easy creation of standered and custom element combining styles into the element
|
|
46
|
-
<ul>
|
|
47
|
-
<li>Easer debugging of element with injected name attributes</li>
|
|
48
|
-
</ul>
|
|
49
|
-
</li>
|
|
50
|
-
<li>Support a UI Color Palette</li>
|
|
51
|
-
<li>Dynamically add vendor prefixes</li>
|
|
52
|
-
<li>Cache calculated style</li>
|
|
53
|
-
</ul>
|
|
54
|
-
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/*
|
|
61
|
-
<p> ... </p>
|
|
62
|
-
<p> ... </p>
|
|
63
|
-
<p> ... </p>
|
|
64
|
-
<p> ... </p>
|
|
65
|
-
|
|
66
|
-
<p>
|
|
67
|
-
Weve added some basic stories inside the <code >src/stories</code> directory.
|
|
68
|
-
<br/>
|
|
69
|
-
A story is a single state of one or more UI components. You can have as many stories as you want.
|
|
70
|
-
<br/>
|
|
71
|
-
(Basically a story is like a visual test case.)
|
|
72
|
-
</p>
|
|
73
|
-
<p>
|
|
74
|
-
See these sample <a href='#' onClick={this.showApp.bind(this)}>stories</a> for a component called <code >Button</code>.
|
|
75
|
-
</p>
|
|
76
|
-
<p>
|
|
77
|
-
Just like that, you can add your own components as stories.
|
|
78
|
-
<br />
|
|
79
|
-
You can also edit those components and see changes right away.
|
|
80
|
-
<br />
|
|
81
|
-
(Try editing the <code >Button</code> component
|
|
82
|
-
located at <code >src/stories/Button.js</code>.)
|
|
83
|
-
</p>
|
|
84
|
-
<p>
|
|
85
|
-
This is just one thing you can do with Storybook.
|
|
86
|
-
<br/>
|
|
87
|
-
Have a look at the <a href="https://github.com/kadirahq/react-storybook" target="_blank">React Storybook</a> repo for more information.
|
|
88
|
-
</p>
|
|
89
|
-
|
|
90
|
-
*/
|