Skip to content

Commit a1aa7b6

Browse files
authored
Merge pull request #8 from huruji/master
fix 多个 demo title 的bug
2 parents 2cc7d0c + 0d537b0 commit a1aa7b6

File tree

2 files changed

+55
-15
lines changed

2 files changed

+55
-15
lines changed

docs/markdown/button.md

+54-13
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,67 @@ ReactDOM.render( <Demo/> , mountNode);
2525
- 按钮状态
2626

2727
默认正常,可设置激活、禁用状态
28-
<!-- ```jsx
29-
<Button active>Active Button</Button>
30-
<Button disabled>Disabled Button</Button>
31-
``` -->
28+
29+
::: demo 按钮状态
30+
```jsx
31+
import { Button } from 'cube-react';
32+
33+
class Demo2 extends React.Component {
34+
render() {
35+
return (
36+
<div>
37+
<Button active>Active Button</Button>
38+
<Button disabled>Disabled Button</Button>
39+
</div>
40+
)
41+
}
42+
}
43+
ReactDOM.render( <Demo2/> , mountNode);
44+
```
45+
:::
46+
3247
- 图标
3348

3449
可设置 icon 的 class
35-
<!-- ```jsx
36-
<Button icon="cubeic-right">Button With Icon</Button>
37-
``` -->
50+
51+
::: demo 图标
52+
```jsx
53+
import { Button } from 'cube-react';
54+
55+
class Demo2 extends React.Component {
56+
render() {
57+
return (
58+
<Button icon="cubeic-right">Button With Icon</Button>
59+
)
60+
}
61+
}
62+
ReactDOM.render( <Demo2/> , mountNode);
63+
```
64+
:::
3865

3966
- 样子
4067

4168
可以通过设置 `light``inline``outline``primary` 属性来改变按钮样子
42-
<!-- ```jsx
43-
<Button light>Light Button</Button>
44-
<Button inline>Inline Button</Button>
45-
<Button outline>Outline Button</Button>
46-
<Button primary>Primary Button</Button>
47-
``` -->
69+
70+
::: demo 样子
71+
```jsx
72+
import { Button } from 'cube-react';
73+
74+
class Demo2 extends React.Component {
75+
render() {
76+
return (
77+
<div>
78+
<Button light>Light Button</Button>
79+
<Button inline>Inline Button</Button>
80+
<Button outline>Outline Button</Button>
81+
<Button primary>Primary Button</Button>
82+
</div>
83+
)
84+
}
85+
}
86+
ReactDOM.render( <Demo2/> , mountNode);
87+
```
88+
:::
4889

4990
### Props 配置
5091

scripts/loaders/example/core.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export default class ExamplePages extends React.Component {
3333
module.exports = function core(source) {
3434
const nodes = extractor(source);
3535
const funcCompoents = nodes.filter(node => node.type === 'code').map(node => generator(node.content)).join(',')
36-
const titles = nodes.map(node => node.type === 'title' ? node.content : '')
37-
36+
const titles = nodes.filter(node => node.type === 'title').map((node) => node.content)
3837
const result = template(funcCompoents, JSON.stringify(titles))
3938
return result;
4039
}

0 commit comments

Comments
 (0)