1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-24 15:04:27 +07:00

Merge branch 'master' into juanpicado-patch-1

This commit is contained in:
Juan Picado @jotadeveloper 2019-08-12 07:46:00 +02:00 committed by GitHub
commit cdfbde1df1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1257 additions and 1320 deletions

28
.github/workflows/nodejs.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Node CI
on: [push]
jobs:
ci:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: [8, 10, 12]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
version: ${{ matrix.node_version }}
- name: Use Yarn 1.17.2
run: |
npm install -g yarn@1.17.2
- name: yarn build
run: |
yarn install
yarn lint
yarn build

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
stable

View File

@ -19,8 +19,8 @@
"@types/enzyme": "3.10.3",
"@types/lodash": "4.14.136",
"@types/material-ui": "0.21.6",
"@types/node": "12.6.9",
"@types/react": "16.8.24",
"@types/node": "12.7.1",
"@types/react": "16.9.1",
"@types/react-dom": "16.8.5",
"@types/react-router-dom": "4.3.4",
"@types/validator": "10.11.2",
@ -30,75 +30,77 @@
"autosuggest-highlight": "3.1.1",
"babel-loader": "8.0.6",
"bundlesize": "0.18.0",
"codeceptjs": "2.1.0",
"codeceptjs": "2.2.1",
"codecov": "3.5.0",
"concurrently": "4.1.1",
"cross-env": "5.2.0",
"css-loader": "0.28.10",
"css-loader": "3.2.0",
"date-fns": "1.30.1",
"emotion": "9.2.12",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"enzyme-to-json": "3.4.0",
"eslint": "5.16.0",
"eslint-plugin-codeceptjs": "1.0.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-codeceptjs": "1.1.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react": "7.14.3",
"eslint-plugin-verdaccio": "2.0.0",
"file-loader": "2.0.0",
"file-loader": "4.2.0",
"friendly-errors-webpack-plugin": "1.7.0",
"get-stdin": "6.0.0",
"github-markdown-css": "2.10.0",
"github-markdown-css": "3.0.1",
"html-webpack-plugin": "3.2.0",
"husky": "3.0.2",
"husky": "3.0.3",
"identity-obj-proxy": "3.0.0",
"in-publish": "2.0.0",
"jest": "24.8.0",
"jest-emotion": "10.0.11",
"jest-emotion": "10.0.14",
"jest-environment-jsdom": "24.8.0",
"jest-environment-jsdom-global": "1.2.0",
"jest-environment-node": "24.8.0",
"js-base64": "2.5.1",
"js-yaml": "3.13.1",
"localstorage-memory": "1.0.3",
"mini-css-extract-plugin": "0.7.0",
"node-mocks-http": "1.7.3",
"mini-css-extract-plugin": "0.8.0",
"node-mocks-http": "1.7.6",
"normalize.css": "8.0.1",
"optimize-css-assets-webpack-plugin": "5.0.1",
"optimize-css-assets-webpack-plugin": "5.0.3",
"ora": "3.4.0",
"prettier": "1.18.2",
"prop-types": "15.7.2",
"puppeteer": "1.17.0",
"react": "16.8.3",
"react-autosuggest": "9.4.2",
"react-dom": "16.8.3",
"react": "16.9.0",
"react-autosuggest": "9.4.3",
"react-dom": "16.9.0",
"react-emotion": "9.2.12",
"react-hot-loader": "4.7.1",
"react-router": "4.3.1",
"react-router-dom": "4.3.1",
"resolve-url-loader": "3.0.1",
"react-hot-loader": "4.12.10",
"react-router": "5.0.1",
"react-router-dom": "5.0.1",
"resolve-url-loader": "3.1.0",
"rimraf": "2.6.3",
"source-map-loader": "0.2.4",
"standard-version": "4.4.0",
"style-loader": "0.23.1",
"standard-version": "7.0.0",
"style-loader": "1.0.0",
"stylelint": "10.1.0",
"stylelint-config-recommended": "2.2.0",
"stylelint-config-styled-components": "0.1.1",
"stylelint-processor-styled-components": "1.8.0",
"stylelint-webpack-plugin": "0.10.5",
"supertest": "4.0.2",
"typeface-roboto": "0.0.54",
"typeface-roboto": "0.0.75",
"typescript": "3.5.3",
"url-loader": "1.1.2",
"validator": "10.11.0",
"verdaccio": "4.2.0",
"uglifyjs-webpack-plugin": "2.2.0",
"url-loader": "2.1.0",
"validator": "11.1.0",
"verdaccio": "4.2.1",
"verdaccio-auth-memory": "1.1.5",
"verdaccio-memory": "2.0.0",
"webpack": "4.20.2",
"webpack-bundle-analyzer": "3.3.2",
"webpack": "4.39.1",
"webpack-bundle-analyzer": "3.4.1",
"webpack-bundle-size-analyzer": "3.0.0",
"webpack-cli": "3.3.6",
"webpack-dev-server": "3.7.2",
"webpack-dev-server": "3.8.0",
"webpack-merge": "4.2.1",
"whatwg-fetch": "3.0.0",
"xss": "1.0.6"

View File

@ -1,10 +1,11 @@
import styled from 'react-emotion';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -2,6 +2,7 @@ import styled from 'react-emotion';
import Card from '@material-ui/core/Card';
import Typography from '@material-ui/core/Typography';
import Chip from '@material-ui/core/Chip';
import { fontWeight } from '../../utils/styles/sizes';
export const CardWrap = styled(Card)({
'&&': {
@ -11,7 +12,7 @@ export const CardWrap = styled(Card)({
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -2,6 +2,7 @@ import styled from 'react-emotion';
import Typography from '@material-ui/core/Typography';
import { default as MuiFab } from '@material-ui/core/Fab';
import colors from '../../utils/styles/colors';
import { fontWeight } from '../../utils/styles/sizes';
export const Details = styled('span')({
display: 'flex',
@ -20,7 +21,7 @@ export const Content = styled('div')({
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
marginBottom: '10px',
textTransform: 'capitalize',
},

View File

@ -5,10 +5,11 @@ import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';
import colors from '../../utils/styles/colors';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -1,10 +1,11 @@
import styled from 'react-emotion';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -49,7 +49,7 @@ export const InnerMobileNavBar = styled('div')({
backgroundColor: colors.greyLight,
color: colors.white,
width: '100%',
padding: '0px 5px',
padding: '0 5px',
margin: '0 10px 0 0',
},
});

View File

@ -2,10 +2,11 @@ import Avatar from '@material-ui/core/Avatar';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';
import styled from 'react-emotion';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -1,8 +1,9 @@
import styled, { css } from 'react-emotion';
import colors from '../../utils/styles/colors';
export const Content = styled('div')({
'&&': {
backgroundColor: '#ffffff',
backgroundColor: colors.white,
flex: 1,
display: 'flex',
position: 'relative',

View File

@ -13,6 +13,7 @@ import { breakpoints } from '../../utils/styles/media';
import Ico from '../Icon';
import Label from '../Label';
import colors from '../../utils/styles/colors';
import { fontWeight } from '../../utils/styles/sizes';
export const OverviewItem = styled('span')`
&& {
@ -36,7 +37,7 @@ export const OverviewItem = styled('span')`
export const Icon = styled(Ico)({
'&&': {
margin: '2px 10px 0px 0',
margin: '2px 10px 0 0',
fill: colors.greyLight2,
},
});
@ -44,7 +45,7 @@ export const Icon = styled(Ico)({
export const Published = styled('span')({
'&&': {
color: colors.greyLight2,
margin: '0px 5px 0px 0px',
margin: '0 5px 0 0',
},
});
@ -52,7 +53,7 @@ export const Published = styled('span')({
export const Text = styled(Label)({
'&&': {
fontSize: '12px',
fontWeight: 500,
fontWeight: fontWeight.semiBold,
color: colors.greyLight2,
},
});

View File

@ -5,10 +5,11 @@ import Typography from '@material-ui/core/Typography';
import Github from '../../icons/GitHub';
import colors from '../../utils/styles/colors';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
},
});

View File

@ -1,10 +1,11 @@
import styled from 'react-emotion';
import Typography from '@material-ui/core/Typography';
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
},
});

View File

@ -1,10 +1,11 @@
import styled from 'react-emotion';
import Typography from '@material-ui/core/Typography';
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
import { fontWeight } from '../../utils/styles/sizes';
export const Heading = styled(Typography)({
'&&': {
fontWeight: 700,
fontWeight: fontWeight.bold,
},
});

View File

@ -11,6 +11,22 @@ describe('api', () => {
};
describe('handleResponseType', () => {
test('should handle missing Content-Type', async () => {
const response: Response = {
url: 'http://localhost:8080/-/packages',
ok: false,
// @ts-ignore
headers: {
get: () => null,
} as Headers,
} as Response;
const handled = await handleResponseType(response);
// Should this actually return [false, null] ?
expect(handled).toBeUndefined();
});
test('should test tgz scenario', async () => {
const blob = new Blob(['foo']);
const blobPromise = Promise.resolve<Blob>(blob);

View File

@ -8,20 +8,20 @@ import '../../types';
*/
export function handleResponseType(response: Response): Promise<[boolean, Blob | string]> | Promise<void> {
if (response.headers) {
const contentType = response.headers.get('Content-Type') as string;
if (contentType.includes('application/pdf')) {
const contentType = response.headers.get('Content-Type');
if (contentType && contentType.includes('application/pdf')) {
return Promise.all([response.ok, response.blob()]);
}
if (contentType.includes('application/json')) {
if (contentType && contentType.includes('application/json')) {
return Promise.all([response.ok, response.json()]);
}
// it includes all text types
if (contentType.includes('text/')) {
if (contentType && contentType.includes('text/')) {
return Promise.all([response.ok, response.text()]);
}
// unfortunatelly on download files there is no header available
if (response.url && response.url.endsWith('.tgz') !== null) {
if (response.url && response.url.endsWith('.tgz') === true) {
return Promise.all([response.ok, response.blob()]);
}
}

2421
yarn.lock

File diff suppressed because it is too large Load Diff