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

Commit

Permalink
Make changes to codes based off comments in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Sep 8, 2017
1 parent a064c57 commit 505d7c9
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
coverage
index.js
emojis.js
marked.ks
marked.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ coverage
.nyc_output
.yo-rc.json
.idea/*
lerna-debug.log
31 changes: 1 addition & 30 deletions legacy-stuff/magic/callout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,7 @@
i.fa.fa-exclamation-triangle(title="Danger")
if block.data.type == 'success'
i.fa.fa-check-square(title="Success")



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>
)
3 changes: 3 additions & 0 deletions legacy-stuff/magic/code.jade
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ mixin block-code(data, opts)
pre(ng-if="tab == #{i}")
code!= codemirror(code.code, code.language, opts.dark)




101 changes: 0 additions & 101 deletions lerna-debug.log

This file was deleted.

14 changes: 10 additions & 4 deletions packages/api-explorer-ui/lib/create-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ module.exports = (oas, apiSetting) => {
[block:code]
{
"codes": [
{
"code": "Code sample",
"language": "text"
}
{
"code": "whjdwhjwejhkwhjk",
"language": "text",
"status": 400,
"name": " "
},
{
"code": "var a = 1;",
"language": "javascript"
}
]
}
[/block]
Expand Down
3 changes: 1 addition & 2 deletions packages/api-explorer-ui/src/block-types/api-header.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import uslug from 'uslug';

const uslug = require('uslug');
const React = require('react');
const PropTypes = require('prop-types');

Expand Down
110 changes: 38 additions & 72 deletions packages/api-explorer-ui/src/block-types/callout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,49 @@ const React = require('react');
const PropTypes = require('prop-types');
// import Marked from '../lib/marked';

const CallOut = ({ block }) => {
const c = block.data.title ? '' : 'no-title';
function Icon({ type }) {
switch (type) {
case 'info':
return <i className="fa fa-info-circle" title="Info" />;
case 'warning':
return <i className="fa fa-exclamation-circle" title="Warning" />;
case 'danger':
return <i className="fa fa-exclamation-triangle" title="Danger" />;
case 'success' :
return <i className="fa fa-check-square" title="Success" />;
default:
return null;
}
}

const CallOut = ({ block }) => {
return (
<div className={`magic-block-callout type-${block.data.type} ${c} `}>
<div className={`magic-block-callout type-${block.data.type} ${block.data.title ? '' : 'no-title'} `}>
{

(block.data.title) && (
<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 === '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.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" />
)
}
<h3>
<Icon type={block.data.type} />
{block.data.title}
</h3>
)
}

{
(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>
)}
</div>
)}
{
(!block.data.title) && (
<span className="noTitleIcon">
<Icon type={block.data.type} />
</span>
)
}
{
(block.data && block.data.body) && (
<div className="callout-body"> {block.data.body}</div>
)
}
</div>
);
};

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

CallOut.propTypes = {
block: PropTypes.shape({
Expand All @@ -90,9 +56,9 @@ CallOut.propTypes = {
}).isRequired,
};

CallOutBlock.propTypes = {
block: PropTypes.shape({
}).isRequired,
Icon.propTypes = {
type: PropTypes.string.isRequired,
};

module.exports = CallOutBlock;

module.exports = CallOut;
13 changes: 9 additions & 4 deletions packages/api-explorer-ui/src/block-types/code.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ const BlockCode = ({ data, opts = {} }) => {

BlockCode.propTypes = {
data: PropTypes.shape({
codes: PropTypes.array.isRequired,
}).isRequired,
codes: PropTypes.array,
}),
opts: PropTypes.shape({
label: PropTypes.string.isRequired,
}).isRequired,
label: PropTypes.string,
}),
};

BlockCode.defaultProps = {
data: null,
opts: {},
};

module.exports = BlockCode;
2 changes: 1 addition & 1 deletion packages/api-explorer-ui/src/block-types/content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Loop = ({ content, column }) => {
case 'image' :
return <ImageBlock block={block} />;
default :
return <div />;
return null;
}
});
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer-ui/src/block-types/embed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Embed = ({ block }) => {
// eslint-disable-next-line react/no-danger
return <span dangerouslySetInnerHTML={{ __html: block.data.html }} />;
} else if (block.data.iframe) {
return (<iframe className="media-iframe" title={block.data.title} src={block.data.url} width={block.data.width || '100%'} height={block.data.height || '300px'} />);
return <iframe className="media-iframe" title={block.data.title} src={block.data.url} width={block.data.width || '100%'} height={block.data.height || '300px'} />;
}
return (
<strong>
Expand Down
6 changes: 3 additions & 3 deletions packages/api-explorer-ui/src/block-types/html.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const React = require('react');
const PropTypes = require('prop-types');

const HTML = ({ block }) => {
const Html = ({ block }) => {
// eslint-disable-next-line react/no-danger
return <div className="magic-block-html" dangerouslySetInnerHTML={{ __html: block.data.html }} />;
};

HTML.propTypes = {
Html.propTypes = {
block: PropTypes.shape({
data: PropTypes.shape({
html: PropTypes.string.isRequired,
}),
}).isRequired,
};
module.exports = HTML;
module.exports = Html;
Loading

0 comments on commit 505d7c9

Please sign in to comment.