mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
resolved conflicts
This commit is contained in:
commit
3b3d53d19f
10 files changed
+101
-19
No files matched your search
@@ -71,7 +71,27 @@ type Props = {
|
||||
splitMode: ?string,
|
||||
showFetchButton: boolean,
|
||||
fetchButtonText: ?string,
|
||||
getTransformedValue: Function
|
||||
getTransformedValue: Function,
|
||||
extensions: ?(string[])
|
||||
}
|
||||
|
||||
function UploadIcon () {
|
||||
return (
|
||||
<svg
|
||||
fill='#ffffff'
|
||||
height={24}
|
||||
width={24}
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<style>{`
|
||||
svg {
|
||||
vertical-align: sub;
|
||||
}
|
||||
`}</style>
|
||||
<path d='M0 0h24v24H0z' fill='none' />
|
||||
<path d='M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z' />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export default class ConversionPanel extends PureComponent {
|
||||
@@ -97,7 +117,8 @@ export default class ConversionPanel extends PureComponent {
|
||||
prettifyRightPanel: true,
|
||||
splitLeft: false,
|
||||
showFetchButton: true,
|
||||
fetchButtonText: 'Fetch JSON from URL'
|
||||
fetchButtonText: 'Fetch JSON from URL',
|
||||
extensions: ['.json']
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
@@ -224,6 +245,15 @@ export default class ConversionPanel extends PureComponent {
|
||||
})
|
||||
}
|
||||
|
||||
loadFile = e => {
|
||||
const file = e.target.files[0]
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(file, 'utf-8')
|
||||
reader.onload = () => {
|
||||
this.onChange(reader.result)
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const {
|
||||
leftMode,
|
||||
@@ -237,7 +267,8 @@ export default class ConversionPanel extends PureComponent {
|
||||
splitTitle,
|
||||
splitMode,
|
||||
showFetchButton,
|
||||
fetchButtonText
|
||||
fetchButtonText,
|
||||
extensions
|
||||
} = this.props
|
||||
const { infoType, resultValue, value, info, splitValue } = this.state
|
||||
|
||||
@@ -303,6 +334,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
width: calc(100vw - 250px);
|
||||
}
|
||||
|
||||
.section {
|
||||
@@ -310,6 +342,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.right {
|
||||
@@ -332,8 +365,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
line-height: 16px;
|
||||
height: 32px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.btn.disabled {
|
||||
@@ -372,6 +404,43 @@ export default class ConversionPanel extends PureComponent {
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#upload {
|
||||
width: 0.1px;
|
||||
height: 0.1px;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.upload-wrapper {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
right: 20px;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
margin: 0px;
|
||||
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
|
||||
background-color: #5a5a5a;
|
||||
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||
padding-left: 12px;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.upload-wrapper:hover {
|
||||
background-color: #444;
|
||||
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
#upload svg {
|
||||
vertical-align: sub;
|
||||
}
|
||||
`}</style>
|
||||
|
||||
<style global jsx>{`
|
||||
@@ -443,12 +512,14 @@ export default class ConversionPanel extends PureComponent {
|
||||
<div className='panel'>
|
||||
<div className='header'>
|
||||
<h4 className='title'>{leftTitle}</h4>
|
||||
|
||||
{leftMode === 'json' &&
|
||||
showFetchButton && (
|
||||
<button className='btn' onClick={this.fetchJSON}>
|
||||
{fetchButtonText}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{prettierParsers[leftMode] && (
|
||||
<button
|
||||
className={this.getPrettifyClass()}
|
||||
@@ -468,6 +539,19 @@ export default class ConversionPanel extends PureComponent {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{extensions &&
|
||||
extensions.length > 0 && (
|
||||
<label htmlFor='upload' className='btn upload-wrapper'>
|
||||
<input
|
||||
id='upload'
|
||||
accept={extensions.join(',')}
|
||||
onChange={this.loadFile}
|
||||
type='file'
|
||||
/>
|
||||
<UploadIcon />
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
{splitLeft &&
|
||||
isBrowser && (
|
||||
|
||||
@@ -153,11 +153,11 @@ export default class Layout extends PureComponent {
|
||||
<style jsx>{`
|
||||
.sidebar {
|
||||
height: 100vh;
|
||||
width: 250px;
|
||||
background-color: #424242;
|
||||
font-size: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
@@ -186,7 +186,7 @@ export default class Layout extends PureComponent {
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 10px 5px;
|
||||
padding: 20px 5px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: 'Lato', sans-serif;
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
"is-svg": "^2.1.0",
|
||||
"json-schema-to-typescript": "^4.6.0",
|
||||
"lodash": "^4.17.4",
|
||||
"min-document": "^2.19.0",
|
||||
"next": "^3.2.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"promise-worker": "^1.1.1",
|
||||
@@ -62,7 +61,6 @@
|
||||
"transform-graphql-type-annotations": "^0.1.1",
|
||||
"transform-json-types": "^0.2.6",
|
||||
"transform-svg-to-native": "^0.1.3",
|
||||
"undom": "^0.3.3",
|
||||
"unfetch": "^3.0.0",
|
||||
"xml-js": "^1.4.1"
|
||||
},
|
||||
@@ -70,11 +68,9 @@
|
||||
"all-contributors-cli": "^4.4.0",
|
||||
"babili-webpack-plugin": "^0.1.2",
|
||||
"css-loader": "^0.28.7",
|
||||
"deep-diff": "^0.3.8",
|
||||
"glob": "^7.1.2",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^4.1.3",
|
||||
"prettier": "^1.6.1",
|
||||
"prettier-standard": "^6.0.0",
|
||||
"style-loader": "^0.18.2",
|
||||
"sw-precache-webpack-plugin": "^0.11.4",
|
||||
|
||||
@@ -49,6 +49,7 @@ export default class extends PureComponent {
|
||||
onCheckboxChange={(checked, cb) =>
|
||||
this.setState({ isRn: checked }, cb)}
|
||||
checkboxText='React Native'
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class extends PureComponent {
|
||||
splitTitle={'Query'}
|
||||
splitValue={dummyQuery}
|
||||
prettifyRightPanel={false}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
@@ -31,6 +31,7 @@ export default class Json2Ts extends PureComponent {
|
||||
splitTitle={'Query'}
|
||||
splitValue={dummyQuery}
|
||||
prettifyRightPanel={false}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
@@ -45,6 +45,7 @@ export default class Css2Js extends PureComponent {
|
||||
name={'html_to_jsx'}
|
||||
defaultText={defaultText}
|
||||
checkboxText='react-native-svg'
|
||||
extensions={['.svg', '.html']}
|
||||
initialCheckboxValue={this.state.native}
|
||||
onCheckboxChange={(checked: boolean, cb: Function) =>
|
||||
this.setState({ native: checked }, cb)}
|
||||
|
||||
@@ -23,6 +23,7 @@ export default class extends PureComponent {
|
||||
getTransformedValue={this.getTransformedValue}
|
||||
name={'js_to_json'}
|
||||
defaultText={defaultText}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
@@ -42,6 +42,7 @@ export default class extends PureComponent {
|
||||
this.setState({ isCompactMode: checked }, cb)}
|
||||
checkboxText='Compact Mode'
|
||||
initialCheckboxValue={this.state.isCompactMode}
|
||||
extensions={null}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
@@ -2031,10 +2031,6 @@ decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
||||
deep-diff@^0.3.8:
|
||||
version "0.3.8"
|
||||
resolved "https://registry.yarnpkg.com/deep-diff/-/deep-diff-0.3.8.tgz#c01de63efb0eec9798801d40c7e0dae25b582c84"
|
||||
|
||||
deep-extend@~0.4.0:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"
|
||||
@@ -5086,6 +5082,10 @@ prettier@^1.4.4, prettier@^1.6.0, prettier@^1.6.1:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.6.1.tgz#850f411a3116226193e32ea5acfc21c0f9a76d7d"
|
||||
|
||||
prettier@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.0.tgz#47481588f41f7c90f63938feb202ac82554e7150"
|
||||
|
||||
pretty-bytes@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||
@@ -6356,10 +6356,6 @@ ultron@~1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.0.tgz#b07a2e6a541a815fc6a34ccd4533baec307ca864"
|
||||
|
||||
undom@^0.3.3:
|
||||
version "0.3.3"
|
||||
resolved "https://registry.yarnpkg.com/undom/-/undom-0.3.3.tgz#58d1a2b0ce065975f7fc369c180a0131b625c1c3"
|
||||
|
||||
unfetch@3.0.0, unfetch@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-3.0.0.tgz#8d1e0513a4ecd0e5ff2d41a6ba77771aae8b6482"
|
||||
|
||||
Reference in new issue
Block a user