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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Sep 8, 2017
1 parent 0c4c197 commit 4233d9b
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 68 deletions.
28 changes: 28 additions & 0 deletions legacy-stuff/magic/callout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,31 @@
if block.data && block.data.body
div.callout-body
!= marked(block.data.body)

(!block.data.title) && (
<span className="noTitleIcon">
{
(block.data.type ==='info') && (
<i className="fa fa-info-circle" title="Info"/>
)
}

{
(block.data.type ==='warning') && (
<i className="fa fa-exclamation-circle" title="Warning"/>
)
}

{
(block.data.type ==='danger') && (
<i className="fa fa-exclamation-triangle" title="Danger"/>
)
}

{
(block.data.type ==='success') && (
<i className="fa fa-check-square" title="Success"/>
)
}
</span>
)
7 changes: 6 additions & 1 deletion packages/api-explorer-ui/lib/create-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ module.exports = (oas, apiSetting) => {
[block:parameters]
{
"data": {
"h-0": "Table"
"0-0": "arbitrary",
"0-1": "info",
"0-2": "test",
"h-0": "test",
"h-1": "1",
"h-2": "2"
},
"cols": 3,
"rows": 1
Expand Down
102 changes: 56 additions & 46 deletions packages/api-explorer-ui/src/block-types/callout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,67 +7,77 @@ const CallOut = ({block}) => {
return (
<div className={`magic-block-callout type-${block.data.type} ${c} `}>
{

(block.data.title) && (
<h3>
{
(block.data.type === 'info') && (
<i className="fa fa-info-circle" title="Info"/>
)
}
<div>
<h3>
{
(block.data.type === 'info') && (
<i className="fa fa-info-circle" title="Info"/>
)
}

{
(block.data.type ==='warning') && (
<i className="fa fa-exclamation-circle" title="Warning"/>
)
}
{
(block.data.type ==='warning') && (
<i className="fa fa-exclamation-circle" title="Warning"/>
)
}

{
(block.data.type ==='danger') && (
<i className="fa fa-exclamation-triangle" title="Danger"/>
)
}
{
(block.data.type ==='danger') && (
<i className="fa fa-exclamation-triangle" title="Danger"/>
)
}

{
(block.data.type ==='success') && (
<i className="fa fa-check-square" title="Success"/>
)
}
{block.data.title}
</h3>
{
(block.data.type ==='success') && (
<i className="fa fa-check-square" title="Success"/>
)
}
{block.data.title}
</h3>

(!block.data.title) && (
<span className="noTitleIcon">
{(!block.data.title) && (
<span className="noTitleIcon">
{
(block.data.type ==='info') && (
<i className="fa fa-info-circle" title="Info"/>
)
}

{
(block.data.type ==='warning') && (
<i className="fa fa-exclamation-circle" title="Warning"/>
)
}
{
(block.data.type ==='warning') && (
<i className="fa fa-exclamation-circle" title="Warning"/>
)
}

{
(block.data.type ==='danger') && (
<i className="fa fa-exclamation-triangle" title="Danger"/>
)
}
{
(block.data.type ==='danger') && (
<i className="fa fa-exclamation-triangle" title="Danger"/>
)
}

{
(block.data.type ==='success') && (
<i className="fa fa-check-square" title="Success"/>
)
}
{
(block.data.type ==='success') && (
<i className="fa fa-check-square" title="Success"/>
)
}
</span>
)
(block.data && block.data.body) && (
<div className="callout-body"> {block.data.body}</div>
)
)}
)}
{(block.data && block.data.body) && (
<div className="callout-body"> {block.data.body}</div>
)}
</div>
)}
</div>
);

}

const CallOutBlock = ({block}) => {
return (
<CallOut block={block}/>
);
};

module.exports = CallOut;
module.exports = CallOutBlock;
10 changes: 5 additions & 5 deletions packages/api-explorer-ui/src/block-types/content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const Loop = ({ content }) => {
case 'code' :
return
<BlockCode dark={column === 'right'} />
// case 'callout':
// return <Callout block={block} />;
// case 'parameters' :
// return <Parameters block={block}/>;
case 'callout':
return <Callout block={block} />;
case 'parameters' :
return <Parameters block={block}/>;
case 'image' :
return <ImageBlock block={block} />;

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

const content = parseBlocks(body);
console.log(content);
// console.log(content);


if (isThreeColumn) {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer-ui/src/block-types/image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ImagesBlock = ({block}) => {
const myImages = block.data.images.map((image) => {
return <ImageBlock image={image}/>;
});

return (
<div> { myImages } </div>
);
Expand Down
50 changes: 35 additions & 15 deletions packages/api-explorer-ui/src/block-types/parameters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,52 @@ const React = require('react');
const Parameters = ({block}) => {
const columns= block.data.cols;
const rows= block.data.rows;

const Th = () => {
const th = [];
for (let c= 0; c < columns; c++) {
th.push(<div className="th">
{block.data.data['h-' + c]}
</div>);
}
return th;
};

const Tr = () => {
const tr = [];
const td = [];
for (let r = 0; r < rows; r++) {
tr.push (
<div className="tr">
{() => {
for (let c = 0; c < columns; c++) {

td.push(
<div className="td" >
{block.data.data[r + '-' + c] || ''}
</div>
);
}
}}
</div>
);
}
return tr;
};

return (
<div className="magic-block-parameters">
<div className="block-parameters-table">
<div className="table">
{
(block.data.data['h-0'] || block.data.data['h-1']) && (
<div className="tr">
{columns.map((item, c) => (
<div className="th">
{block.data.data['h-' + c]}
</div>
))}
{Th}
</div>
)
}
{Tr}

{
rows.map((item, r) => (
<div className="tr">
{columns.map((ele, c) => (
<div className="td" >
{block.data.data[r + '-' + c] || ''}
</div>
))}
</div>
))}
</div>
</div>
</div>
Expand Down

0 comments on commit 4233d9b

Please sign in to comment.