Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 4233d9b

Browse files
committed
1 parent 0c4c197 commit 4233d9b

File tree

6 files changed

+131
-68
lines changed

6 files changed

+131
-68
lines changed

legacy-stuff/magic/callout.jade

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,31 @@
2626
if block.data && block.data.body
2727
div.callout-body
2828
!= marked(block.data.body)
29+
30+
(!block.data.title) && (
31+
<span className="noTitleIcon">
32+
{
33+
(block.data.type ==='info') && (
34+
<i className="fa fa-info-circle" title="Info"/>
35+
)
36+
}
37+
38+
{
39+
(block.data.type ==='warning') && (
40+
<i className="fa fa-exclamation-circle" title="Warning"/>
41+
)
42+
}
43+
44+
{
45+
(block.data.type ==='danger') && (
46+
<i className="fa fa-exclamation-triangle" title="Danger"/>
47+
)
48+
}
49+
50+
{
51+
(block.data.type ==='success') && (
52+
<i className="fa fa-check-square" title="Success"/>
53+
)
54+
}
55+
</span>
56+
)

packages/api-explorer-ui/lib/create-docs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ module.exports = (oas, apiSetting) => {
8686
[block:parameters]
8787
{
8888
"data": {
89-
"h-0": "Table"
89+
"0-0": "arbitrary",
90+
"0-1": "info",
91+
"0-2": "test",
92+
"h-0": "test",
93+
"h-1": "1",
94+
"h-2": "2"
9095
},
9196
"cols": 3,
9297
"rows": 1

packages/api-explorer-ui/src/block-types/callout.jsx

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,77 @@ const CallOut = ({block}) => {
77
return (
88
<div className={`magic-block-callout type-${block.data.type} ${c} `}>
99
{
10+
1011
(block.data.title) && (
11-
<h3>
12-
{
13-
(block.data.type === 'info') && (
14-
<i className="fa fa-info-circle" title="Info"/>
15-
)
16-
}
12+
<div>
13+
<h3>
14+
{
15+
(block.data.type === 'info') && (
16+
<i className="fa fa-info-circle" title="Info"/>
17+
)
18+
}
1719

18-
{
19-
(block.data.type ==='warning') && (
20-
<i className="fa fa-exclamation-circle" title="Warning"/>
21-
)
22-
}
20+
{
21+
(block.data.type ==='warning') && (
22+
<i className="fa fa-exclamation-circle" title="Warning"/>
23+
)
24+
}
2325

24-
{
25-
(block.data.type ==='danger') && (
26-
<i className="fa fa-exclamation-triangle" title="Danger"/>
27-
)
28-
}
26+
{
27+
(block.data.type ==='danger') && (
28+
<i className="fa fa-exclamation-triangle" title="Danger"/>
29+
)
30+
}
2931

30-
{
31-
(block.data.type ==='success') && (
32-
<i className="fa fa-check-square" title="Success"/>
33-
)
34-
}
35-
{block.data.title}
36-
</h3>
32+
{
33+
(block.data.type ==='success') && (
34+
<i className="fa fa-check-square" title="Success"/>
35+
)
36+
}
37+
{block.data.title}
38+
</h3>
3739

38-
(!block.data.title) && (
39-
<span className="noTitleIcon">
40+
{(!block.data.title) && (
41+
<span className="noTitleIcon">
4042
{
4143
(block.data.type ==='info') && (
4244
<i className="fa fa-info-circle" title="Info"/>
4345
)
4446
}
4547

46-
{
47-
(block.data.type ==='warning') && (
48-
<i className="fa fa-exclamation-circle" title="Warning"/>
49-
)
50-
}
48+
{
49+
(block.data.type ==='warning') && (
50+
<i className="fa fa-exclamation-circle" title="Warning"/>
51+
)
52+
}
5153

52-
{
53-
(block.data.type ==='danger') && (
54-
<i className="fa fa-exclamation-triangle" title="Danger"/>
55-
)
56-
}
54+
{
55+
(block.data.type ==='danger') && (
56+
<i className="fa fa-exclamation-triangle" title="Danger"/>
57+
)
58+
}
5759

58-
{
59-
(block.data.type ==='success') && (
60-
<i className="fa fa-check-square" title="Success"/>
61-
)
62-
}
60+
{
61+
(block.data.type ==='success') && (
62+
<i className="fa fa-check-square" title="Success"/>
63+
)
64+
}
6365
</span>
64-
)
65-
(block.data && block.data.body) && (
66-
<div className="callout-body"> {block.data.body}</div>
67-
)
68-
)}
66+
)}
67+
{(block.data && block.data.body) && (
68+
<div className="callout-body"> {block.data.body}</div>
69+
)}
70+
</div>
71+
)}
6972
</div>
7073
);
74+
75+
}
76+
77+
const CallOutBlock = ({block}) => {
78+
return (
79+
<CallOut block={block}/>
80+
);
7181
};
7282

73-
module.exports = CallOut;
83+
module.exports = CallOutBlock;

packages/api-explorer-ui/src/block-types/content.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const Loop = ({ content }) => {
2424
case 'code' :
2525
return
2626
<BlockCode dark={column === 'right'} />
27-
// case 'callout':
28-
// return <Callout block={block} />;
29-
// case 'parameters' :
30-
// return <Parameters block={block}/>;
27+
case 'callout':
28+
return <Callout block={block} />;
29+
case 'parameters' :
30+
return <Parameters block={block}/>;
3131
case 'image' :
3232
return <ImageBlock block={block} />;
3333

@@ -46,7 +46,7 @@ const Opts = (props) => {
4646
const isThreeColumn = props['is-three-column'];
4747

4848
const content = parseBlocks(body);
49-
console.log(content);
49+
// console.log(content);
5050

5151

5252
if (isThreeColumn) {

packages/api-explorer-ui/src/block-types/image.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ImagesBlock = ({block}) => {
2929
const myImages = block.data.images.map((image) => {
3030
return <ImageBlock image={image}/>;
3131
});
32-
32+
3333
return (
3434
<div> { myImages } </div>
3535
);

packages/api-explorer-ui/src/block-types/parameters.jsx

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,52 @@ const React = require('react');
44
const Parameters = ({block}) => {
55
const columns= block.data.cols;
66
const rows= block.data.rows;
7+
8+
const Th = () => {
9+
const th = [];
10+
for (let c= 0; c < columns; c++) {
11+
th.push(<div className="th">
12+
{block.data.data['h-' + c]}
13+
</div>);
14+
}
15+
return th;
16+
};
17+
18+
const Tr = () => {
19+
const tr = [];
20+
const td = [];
21+
for (let r = 0; r < rows; r++) {
22+
tr.push (
23+
<div className="tr">
24+
{() => {
25+
for (let c = 0; c < columns; c++) {
26+
27+
td.push(
28+
<div className="td" >
29+
{block.data.data[r + '-' + c] || ''}
30+
</div>
31+
);
32+
}
33+
}}
34+
</div>
35+
);
36+
}
37+
return tr;
38+
};
39+
740
return (
841
<div className="magic-block-parameters">
942
<div className="block-parameters-table">
1043
<div className="table">
1144
{
1245
(block.data.data['h-0'] || block.data.data['h-1']) && (
1346
<div className="tr">
14-
{columns.map((item, c) => (
15-
<div className="th">
16-
{block.data.data['h-' + c]}
17-
</div>
18-
))}
47+
{Th}
1948
</div>
2049
)
2150
}
51+
{Tr}
2252

23-
{
24-
rows.map((item, r) => (
25-
<div className="tr">
26-
{columns.map((ele, c) => (
27-
<div className="td" >
28-
{block.data.data[r + '-' + c] || ''}
29-
</div>
30-
))}
31-
</div>
32-
))}
3353
</div>
3454
</div>
3555
</div>

0 commit comments

Comments
 (0)