added meta tags

This commit is contained in:
Ritesh Kumar committed 2017-09-01 04:48:23 +05:30
1 parent 62eacf95e8
commit 00aa47a0fa
10 files changed
+78 -194

No files matched your search

+32 -31
View File
@@ -13,11 +13,11 @@ if (isBrowser) {
require("codemirror-graphql/mode");
require("codemirror/mode/javascript/javascript");
require("codemirror/mode/xml/xml");
require("codemirror/mode/jsx/jsx")
require("codemirror/mode/css/css")
require("codemirror/mode/rust/rust")
require("codemirror/mode/sql/sql")
require("codemirror/mode/clike/clike")
require("codemirror/mode/jsx/jsx");
require("codemirror/mode/css/css");
require("codemirror/mode/rust/rust");
require("codemirror/mode/sql/sql");
require("codemirror/mode/clike/clike");
}
const prettifyMap = {
@@ -29,23 +29,23 @@ const prettifyMap = {
const modeMapping = {
javascript: {
name: 'javascript'
name: "javascript"
},
json: {
name: 'javascript',
name: "javascript",
json: true
},
typescript: {
name: 'javascript',
name: "javascript",
typescript: true
},
html: {
name: 'xml',
name: "xml",
htmlMode: true
},
mysql: 'text/x-mysql',
scala: 'text/x-scala'
}
mysql: "text/x-mysql",
scala: "text/x-scala"
};
type Props = {
leftMode: ?string,
@@ -262,7 +262,7 @@ export default class ConversionPanel extends PureComponent {
}
.btn:hover {
background-color: #2380ca;
background-color: #0490ff;
}
.header {
@@ -281,6 +281,7 @@ export default class ConversionPanel extends PureComponent {
.title {
padding-left: 4px;
color: #666;
font-weight: normal;
}
`}</style>
@@ -295,7 +296,8 @@ export default class ConversionPanel extends PureComponent {
overflow: hidden;
}
.react-codemirror2, .CodeMirror {
.react-codemirror2,
.CodeMirror {
display: flex;
flex: 1;
width: 100%;
@@ -303,7 +305,7 @@ export default class ConversionPanel extends PureComponent {
}
.CodeMirror {
height: calc(100%)
height: calc(100%);
}
.right .CodeMirror-scroll {
@@ -351,15 +353,14 @@ export default class ConversionPanel extends PureComponent {
<div className={leftClass}>
<div style={{ display: "contents" }}>
<div className="header">
<div className="title">{leftTitle}</div>
<h4 className="title">{leftTitle}</h4>
<button className="btn" onClick={this.prettifyCode}>
Prettify
</button>
</div>
{isBrowser && (
<CodeMirror
onValueChange={(editor, metadata, value) =>
this.onChange(value)}
onChange={(editor, metadata, value) => this.onChange(value)}
value={value}
options={{
mode: modeMapping[leftMode] || leftMode,
@@ -372,10 +373,10 @@ export default class ConversionPanel extends PureComponent {
isBrowser && (
<div style={{ display: "contents" }}>
<div className="header">
<div className="title">{splitTitle}</div>
<h4 className="title">{splitTitle}</h4>
</div>
<CodeMirror
onValueChange={(editor, metadata, value) =>
onChange={(editor, metadata, value) =>
this.onChange(this.state.value, value)}
value={splitValue}
options={{
@@ -388,7 +389,7 @@ export default class ConversionPanel extends PureComponent {
</div>
<div className="section right">
<div className="header">
<div className="title">{rightTitle}</div>
<h4 className="title">{rightTitle}</h4>
{onCheckboxChange && (
<label htmlFor="#text">
<input
@@ -406,20 +407,20 @@ export default class ConversionPanel extends PureComponent {
</div>
{isBrowser && (
<CodeMirror
value={
prettifyRightPanel ? (
value={
prettifyRightPanel ? (
window.js_beautify(resultValue, { e4x: true })
) : (
resultValue
)
}
options={{
readOnly: true,
mode: modeMapping[rightMode] || rightMode,
...codeMirrorOptions,
lineNumbers: false
}}
/>
}
options={{
readOnly: true,
mode: modeMapping[rightMode] || rightMode,
...codeMirrorOptions,
lineNumbers: false
}}
/>
)}
</div>
</div>
+14 -145
View File
@@ -9,6 +9,7 @@ import FuzzyPicker, { FuzzyWrapper } from "react-fuzzy-picker";
import Collapse, { Panel } from "rc-collapse";
import flatten from "lodash/flatten";
import findIndex from "lodash/findIndex";
import { categorizedRoutes, routes, activeRouteData } from "../utils/routes";
NProgress.configure({ showSpinner: false });
@@ -20,137 +21,6 @@ Router.onRouteChangeStart = url => {
Router.onRouteChangeComplete = () => NProgress.done();
Router.onRouteChangeError = () => NProgress.done();
const x = [
{
category: "React",
iconName: "icon-reactjs",
content: [
{
label: "JSON to React PropTypes",
path: "/"
},
{
label: "HTML to JSX",
path: "/html-to-jsx"
},
{
label: "CSS to JS Objects",
path: "/css-to-js"
}
]
},
{
category: "JavaScript",
iconName: "icon-javascript",
content: [
{
label: "JSON to Flow Types",
path: "/json-to-flow-types"
},
{
label: "JSON to Typescript Interface",
path: "/json-to-ts-interface"
},
{
label: "JSON to MobX-State-Tree Model",
path: "/json-to-mobx-state-tree"
}
]
},
{
category: "Rust",
iconName: "icon-rust",
content: [
{
label: "JSON to Rust Serde",
path: "/json-to-rust-serde"
}
]
},
{
category: "Databases",
iconName: "icon-database",
content: [
{
label: "JSON to Mongoose Schema",
path: "/json-to-mongoose"
},
{
label: "JSON to Big Query Schema",
path: "/json-to-big-query"
},
{
label: "JSON to MySQL",
path: "/json-to-mysql"
}
]
},
{
category: "Scala",
iconName: "icon-scala",
content: [
{
label: "JSON to Scala Case Class",
path: "/json-to-scala-case-class"
}
]
},
{
category: "GraphQL",
icon: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400">
<path
fill="#ffffff"
d="M57.468 302.66l-14.376-8.3 160.15-277.38 14.376 8.3z"
/>
<path fill="#ffffff" d="M39.8 272.2h320.3v16.6H39.8z" />
<path
fill="#ffffff"
d="M206.348 374.026l-160.21-92.5 8.3-14.376 160.21 92.5zM345.522 132.947l-160.21-92.5 8.3-14.376 160.21 92.5z"
/>
<path
fill="#ffffff"
d="M54.482 132.883l-8.3-14.375 160.21-92.5 8.3 14.376z"
/>
<path
fill="#ffffff"
d="M342.568 302.663l-160.15-277.38 14.376-8.3 160.15 277.38zM52.5 107.5h16.6v185H52.5zM330.9 107.5h16.6v185h-16.6z"
/>
<path
fill="#ffffff"
d="M203.522 367l-7.25-12.558 139.34-80.45 7.25 12.557z"
/>
<path
fill="#ffffff"
d="M369.5 297.9c-9.6 16.7-31 22.4-47.7 12.8-16.7-9.6-22.4-31-12.8-47.7 9.6-16.7 31-22.4 47.7-12.8 16.8 9.7 22.5 31 12.8 47.7M90.9 137c-9.6 16.7-31 22.4-47.7 12.8-16.7-9.6-22.4-31-12.8-47.7 9.6-16.7 31-22.4 47.7-12.8 16.7 9.7 22.4 31 12.8 47.7M30.5 297.9c-9.6-16.7-3.9-38 12.8-47.7 16.7-9.6 38-3.9 47.7 12.8 9.6 16.7 3.9 38-12.8 47.7-16.8 9.6-38.1 3.9-47.7-12.8M309.1 137c-9.6-16.7-3.9-38 12.8-47.7 16.7-9.6 38-3.9 47.7 12.8 9.6 16.7 3.9 38-12.8 47.7-16.7 9.6-38.1 3.9-47.7-12.8M200 395.8c-19.3 0-34.9-15.6-34.9-34.9 0-19.3 15.6-34.9 34.9-34.9 19.3 0 34.9 15.6 34.9 34.9 0 19.2-15.6 34.9-34.9 34.9M200 74c-19.3 0-34.9-15.6-34.9-34.9 0-19.3 15.6-34.9 34.9-34.9 19.3 0 34.9 15.6 34.9 34.9 0 19.3-15.6 34.9-34.9 34.9"
/>
</svg>
),
content: [
{
label: "GraphQL to TypeScript",
path: "/graphql-to-typescript"
},
{
label: "GraphQL to Flow",
path: "/graphql-to-flow"
}
]
},
{
category: "XML",
iconName: "icon-html",
content: [
{
label: "XML to JSON",
path: "/xml-to-json"
}
]
}
];
const routes = flatten(x.map(a => a.content));
function Logo() {
return (
<svg
@@ -216,10 +86,6 @@ export default class Layout extends PureComponent {
}
componentWillMount() {
this.setKey(this.props.pathname)
}
componentDidMount() {
this.setKey(this.props.pathname);
}
@@ -230,7 +96,7 @@ export default class Layout extends PureComponent {
setKey = pathname => {
this.setState({
activeKey: `${findIndex(
x,
categorizedRoutes,
o => o.content.filter(a => a.path === pathname).length
) + 1}`
});
@@ -243,21 +109,25 @@ export default class Layout extends PureComponent {
};
render() {
const { label, desc } = activeRouteData(this.props.pathname);
return (
<div className="main-wrapper">
<Head>
<title>Transform | All important transforms at one place.</title>
<meta
rel="description"
content="An online utility to convert a JSON object to prop-types, Typescript Interface, Rust serde or flow types. It also converts your CSS into JS and HTML into JSX."
/>
<title>{label}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/static/favicon.png" />
<meta
name="google-site-verification"
content="bjJSOEahdert-7mwVScrwTTUVR3nSe0bEj5YjevUNn0"
/>
<link rel="icon" type="image/png" href="/static/favicon.png" />
<meta name="description" content={desc} />
<link rel="stylesheet" type="text/css" href="/static/nprogress.css" />
<link rel="stylesheet" type="text/css" href="/static/codemirror.css" />
<link
rel="stylesheet"
type="text/css"
href="/static/codemirror.css"
/>
<link
rel="stylesheet"
type="text/css"
@@ -352,7 +222,6 @@ export default class Layout extends PureComponent {
`}</style>
<style jsx global>{`
.Collapsible__trigger {
color: whitesmoke;
font-family: "Lato", sans-serif;
@@ -420,7 +289,7 @@ export default class Layout extends PureComponent {
activeKey={this.state.activeKey}
defaultActiveKey={this.state.activeKey}
>
{x.map((route, i) => {
{categorizedRoutes.map((route, i) => {
return (
<Panel
key={i + 1}
+2 -2
View File
@@ -31,12 +31,12 @@
"is-in-browser": "^1.1.3",
"json2dts": "^0.0.2",
"lodash": "^4.17.4",
"next": "^3.1.0",
"next": "^3.2.1",
"nprogress": "^0.2.0",
"prop-types": "^15.5.10",
"rc-collapse": "^1.7.6",
"react": "^15.6.1",
"react-codemirror2": "^0.0.14",
"react-codemirror2": "^1.0.0",
"react-dom": "^15.6.1",
"react-fuzzy-picker": "^0.5.1",
"react-github-corner": "^1.0.0",
-1
View File
@@ -58,7 +58,6 @@ export default class Css2Js extends PureComponent {
return (
<Layout pathname={this.props.url.pathname}>
<ConversionPanel
url={this.props.url}
leftTitle="CSS"
rightTitle="JavaScript"
leftMode="css"
+1 -1
View File
@@ -23,7 +23,7 @@ export default class Json2Ts extends PureComponent {
url={this.props.url}
prettifyRightPanel={false}
splitLeft={true}
splitMode={'graphql'}
splitMode={"graphql"}
splitTitle={"Query"}
splitValue={dummyQuery}
/>
+1 -1
View File
@@ -23,7 +23,7 @@ export default class Json2Ts extends PureComponent {
url={this.props.url}
prettifyRightPanel={false}
splitLeft={true}
splitMode={'graphql'}
splitMode={"graphql"}
splitTitle={"Query"}
splitValue={dummyQuery}
/>
+1 -1
View File
@@ -33,7 +33,7 @@ export default class Main extends PureComponent {
getTransformedValue={this.getTransformedValue}
name={"prop_types"}
defaultText={defaultText}
onCheckboxChange={(checked, cb) =>
onCheckboxChange={(checked, cb) =>
this.setState({ isImmutable: checked }, cb)}
checkboxText="Immutable Proptypes"
/>
@@ -69,9 +69,11 @@ export default function({ types: t }) {
},
VariableDeclaration(path) {
path.insertBefore(t.identifier(`import ImmutablePropTypes from 'react-immutable-proptypes'
path.insertBefore(
t.identifier(`import ImmutablePropTypes from 'react-immutable-proptypes'
import PropTypes from 'prop-types
`))
`)
);
},
Program(path) {
+6 -4
View File
@@ -77,12 +77,14 @@ export default function({ types: t }) {
},
VariableDeclaration(path) {
path.insertBefore(t.identifier(
`import PropTypes from 'prop-types'
`))
path.insertBefore(
t.identifier(
`import PropTypes from 'prop-types'
`
)
);
},
ObjectExpression(path) {
if (
t.isVariableDeclarator(path.parent) ||
+17 -6
View File
@@ -2465,6 +2465,12 @@ graphql@^0.10.1, graphql@^0.10.5:
dependencies:
iterall "^1.1.0"
graphql@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.2.tgz#13edb9f982f3571dd68ec4e9f3d6aca7e1ba57ef"
dependencies:
iterall "^1.1.0"
gzip-size@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520"
@@ -2547,6 +2553,10 @@ hoek@2.x.x:
version "2.16.3"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
hoist-non-react-statics@^2.2.2:
version "2.3.1"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"
home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
@@ -3271,9 +3281,9 @@ negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
next@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/next/-/next-3.1.0.tgz#8dfff9b89cfb95ba29cf43107dd0b7ff3a4f5d01"
next@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/next/-/next-3.2.1.tgz#6d694823ac6e74e9be4553117144a6402220490f"
dependencies:
ansi-html "0.0.7"
babel-core "6.25.0"
@@ -3300,6 +3310,7 @@ next@^3.1.0:
friendly-errors-webpack-plugin "1.5.0"
glob "7.1.1"
glob-promise "3.1.0"
hoist-non-react-statics "^2.2.2"
htmlescape "1.1.1"
http-status "1.0.1"
json-loader "0.5.4"
@@ -4118,9 +4129,9 @@ rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
react-codemirror2@^0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/react-codemirror2/-/react-codemirror2-0.0.14.tgz#5e232f3af8d00549a624a0721279f574edc84a57"
react-codemirror2@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/react-codemirror2/-/react-codemirror2-1.0.0.tgz#b529a6c5c91219f92c751f43a17721cdaf36b05f"
dependencies:
codemirror "5.29.0"