1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

style fixes

This commit is contained in:
Jernej Pregelj 2019-03-07 15:30:52 +01:00
parent 37d2f19c1b
commit 165e4acd9d
3 changed files with 17 additions and 14 deletions

View File

@ -12,6 +12,7 @@
"format": "npm run format:js && npm run format:css",
"lint:css": "stylelint './src/**/*.{css,scss}'",
"lint:js": "eslint --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .",
"lint:fix": "eslint --fix --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .",
"lint": "npm run lint:js && npm run lint:css"
},
"dependencies": {

View File

@ -7,8 +7,11 @@ const Item = ({ item, removeItem }: { item: any; removeItem: any }) => (
<a href={item.url}>{item.url}</a>
<div className={styles.details}>
<span>url: {item.found ? 'confirmed' : 'unconfirmed'}</span>
<span>size: { item.found && item.size ? filesize(item.size) : 'unknown'}</span>
<span>type: { item.found && item.type ? item.type : 'unknown'}</span>
<span>
size:
{item.found && item.size ? filesize(item.size) : 'unknown'}
</span>
<span>type: {item.found && item.type ? item.type : 'unknown'}</span>
</div>
<button
type="button"

View File

@ -6,11 +6,7 @@ import ItemForm from './ItemForm'
import Item from './Item'
import styles from './index.module.scss'
import {
serviceHost,
servicePort,
serviceScheme
} from '../../../config'
import { serviceHost, servicePort, serviceScheme } from '../../../config'
interface FilesProps {
files: any[]
@ -26,7 +22,7 @@ interface FilesStates {
export default class Files extends PureComponent<FilesProps, FilesStates> {
public state: FilesStates = {
isFormShown: false,
isFormShown: false
}
public toggleForm = (e: Event) => {
@ -39,13 +35,16 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
let res: any
let file: any = { url: value, found: false }
try {
const response = await fetch(`${serviceScheme}://${serviceHost}:${servicePort}/api/v1/urlcheck`, {
method: 'POST',
body: JSON.stringify({url: value}),
headers:{
'Content-Type': 'application/json'
const response = await fetch(
`${serviceScheme}://${serviceHost}:${servicePort}/api/v1/urlcheck`,
{
method: 'POST',
body: JSON.stringify({ url: value }),
headers: {
'Content-Type': 'application/json'
}
}
})
)
res = await response.json()
file.size = res.result.contentLength
file.type = res.result.contentType