mirror of
https://github.com/SomboChea/ui
synced 2026-01-19 17:46:12 +07:00
Compare commits
4 Commits
juanpicado
...
refactor/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9076d0a2 | ||
|
|
ea19a2bb47 | ||
|
|
d9f463688d | ||
|
|
571d9c3fa7 |
3
.babelrc
3
.babelrc
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"presets": [["@verdaccio"]],
|
"presets": [["@verdaccio"]]
|
||||||
"plugins": ["emotion"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Contributing Guidelines
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
41
package.json
41
package.json
@@ -15,8 +15,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "8.2.0",
|
"@commitlint/cli": "8.2.0",
|
||||||
"@commitlint/config-conventional": "8.2.0",
|
"@commitlint/config-conventional": "8.2.0",
|
||||||
"@emotion/core": "10.0.22",
|
|
||||||
"@emotion/styled": "10.0.23",
|
|
||||||
"@material-ui/core": "4.6.1",
|
"@material-ui/core": "4.6.1",
|
||||||
"@material-ui/icons": "4.5.1",
|
"@material-ui/icons": "4.5.1",
|
||||||
"@octokit/rest": "16.35.0",
|
"@octokit/rest": "16.35.0",
|
||||||
@@ -25,16 +23,16 @@
|
|||||||
"@types/enzyme": "3.10.3",
|
"@types/enzyme": "3.10.3",
|
||||||
"@types/jest": "24.0.23",
|
"@types/jest": "24.0.23",
|
||||||
"@types/js-base64": "2.3.1",
|
"@types/js-base64": "2.3.1",
|
||||||
"@types/lodash": "4.14.149",
|
"@types/lodash": "4.14.147",
|
||||||
"@types/node": "12.12.11",
|
"@types/node": "12.12.7",
|
||||||
"@types/react": "16.9.11",
|
"@types/react": "16.9.11",
|
||||||
"@types/react-autosuggest": "9.3.13",
|
"@types/react-autosuggest": "9.3.13",
|
||||||
"@types/react-dom": "16.9.4",
|
"@types/react-dom": "16.9.4",
|
||||||
"@types/react-router-dom": "5.1.2",
|
"@types/react-router-dom": "5.1.2",
|
||||||
"@types/request": "2.48.3",
|
"@types/request": "2.48.3",
|
||||||
"@types/validator": "12.0.0",
|
"@types/validator": "10.11.3",
|
||||||
"@types/webpack-env": "1.14.1",
|
"@types/webpack-env": "1.14.1",
|
||||||
"@typescript-eslint/parser": "2.8.0",
|
"@typescript-eslint/parser": "2.7.0",
|
||||||
"@verdaccio/babel-preset": "8.2.0",
|
"@verdaccio/babel-preset": "8.2.0",
|
||||||
"@verdaccio/commons-api": "8.3.0",
|
"@verdaccio/commons-api": "8.3.0",
|
||||||
"@verdaccio/eslint-config": "8.2.0",
|
"@verdaccio/eslint-config": "8.2.0",
|
||||||
@@ -47,27 +45,26 @@
|
|||||||
"concurrently": "5.0.0",
|
"concurrently": "5.0.0",
|
||||||
"cross-env": "6.0.3",
|
"cross-env": "6.0.3",
|
||||||
"css-loader": "3.2.0",
|
"css-loader": "3.2.0",
|
||||||
"date-fns": "2.8.1",
|
"date-fns": "2.7.0",
|
||||||
"detect-secrets": "1.0.5",
|
"detect-secrets": "1.0.5",
|
||||||
"emotion": "10.0.23",
|
"emotion": "10.0.23",
|
||||||
"emotion-theming": "10.0.19",
|
|
||||||
"enzyme": "3.10.0",
|
"enzyme": "3.10.0",
|
||||||
"enzyme-adapter-react-16": "1.15.1",
|
"enzyme-adapter-react-16": "1.15.1",
|
||||||
"enzyme-to-json": "3.4.3",
|
"enzyme-to-json": "3.4.3",
|
||||||
"eslint": "6.6.0",
|
"eslint": "6.6.0",
|
||||||
"eslint-plugin-codeceptjs": "1.2.0",
|
"eslint-plugin-codeceptjs": "1.1.0",
|
||||||
"eslint-plugin-import": "2.18.2",
|
"eslint-plugin-import": "2.18.2",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
"eslint-plugin-prettier": "3.1.1",
|
"eslint-plugin-prettier": "3.1.1",
|
||||||
"eslint-plugin-react": "7.16.0",
|
"eslint-plugin-react": "7.16.0",
|
||||||
"eslint-plugin-react-hooks": "2.3.0",
|
"eslint-plugin-react-hooks": "2.3.0",
|
||||||
"eslint-plugin-verdaccio": "8.2.0",
|
"eslint-plugin-verdaccio": "8.2.0",
|
||||||
"file-loader": "4.3.0",
|
"file-loader": "4.2.0",
|
||||||
"friendly-errors-webpack-plugin": "1.7.0",
|
"friendly-errors-webpack-plugin": "1.7.0",
|
||||||
"get-stdin": "7.0.0",
|
"get-stdin": "7.0.0",
|
||||||
"github-markdown-css": "3.0.1",
|
"github-markdown-css": "3.0.1",
|
||||||
"html-webpack-plugin": "3.2.0",
|
"html-webpack-plugin": "3.2.0",
|
||||||
"husky": "3.1.0",
|
"husky": "3.0.9",
|
||||||
"identity-obj-proxy": "3.0.0",
|
"identity-obj-proxy": "3.0.0",
|
||||||
"in-publish": "2.0.0",
|
"in-publish": "2.0.0",
|
||||||
"jest": "24.9.0",
|
"jest": "24.9.0",
|
||||||
@@ -78,7 +75,7 @@
|
|||||||
"jest-fetch-mock": "2.1.2",
|
"jest-fetch-mock": "2.1.2",
|
||||||
"js-base64": "2.5.1",
|
"js-base64": "2.5.1",
|
||||||
"js-yaml": "3.13.1",
|
"js-yaml": "3.13.1",
|
||||||
"lint-staged": "8.2.1",
|
"lint-staged": "9.4.3",
|
||||||
"localstorage-memory": "1.0.3",
|
"localstorage-memory": "1.0.3",
|
||||||
"lockfile-lint": "2.2.0",
|
"lockfile-lint": "2.2.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
@@ -93,26 +90,26 @@
|
|||||||
"react": "16.12.0",
|
"react": "16.12.0",
|
||||||
"react-autosuggest": "9.4.3",
|
"react-autosuggest": "9.4.3",
|
||||||
"react-dom": "16.12.0",
|
"react-dom": "16.12.0",
|
||||||
"react-hot-loader": "4.12.18",
|
"react-hot-loader": "4.12.17",
|
||||||
"react-router-dom": "5.1.2",
|
"react-router-dom": "5.1.2",
|
||||||
"request": "2.88.0",
|
"request": "2.88.0",
|
||||||
"resolve-url-loader": "3.1.1",
|
"resolve-url-loader": "3.1.1",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"source-map-loader": "0.2.4",
|
"source-map-loader": "0.2.4",
|
||||||
"standard-version": "7.0.1",
|
"standard-version": "7.0.0",
|
||||||
"style-loader": "1.0.0",
|
"style-loader": "1.0.0",
|
||||||
"stylelint": "12.0.0",
|
"stylelint": "11.1.1",
|
||||||
"stylelint-config-recommended": "3.0.0",
|
"stylelint-config-recommended": "3.0.0",
|
||||||
"stylelint-config-styled-components": "0.1.1",
|
"stylelint-config-styled-components": "0.1.1",
|
||||||
"stylelint-processor-styled-components": "1.8.0",
|
"stylelint-processor-styled-components": "1.8.0",
|
||||||
"stylelint-webpack-plugin": "1.1.0",
|
"stylelint-webpack-plugin": "1.0.4",
|
||||||
"supertest": "4.0.2",
|
"supertest": "4.0.2",
|
||||||
"typeface-roboto": "0.0.75",
|
"typeface-roboto": "0.0.75",
|
||||||
"typescript": "3.7.2",
|
"typescript": "3.7.2",
|
||||||
"uglifyjs-webpack-plugin": "2.2.0",
|
"uglifyjs-webpack-plugin": "2.2.0",
|
||||||
"url-loader": "2.3.0",
|
"url-loader": "2.2.0",
|
||||||
"validator": "12.1.0",
|
"validator": "12.0.0",
|
||||||
"verdaccio": "4.3.5",
|
"verdaccio": "4.3.4",
|
||||||
"verdaccio-auth-memory": "8.3.0",
|
"verdaccio-auth-memory": "8.3.0",
|
||||||
"verdaccio-memory": "8.3.0",
|
"verdaccio-memory": "8.3.0",
|
||||||
"wait-on": "3.3.0",
|
"wait-on": "3.3.0",
|
||||||
@@ -217,5 +214,9 @@
|
|||||||
"url": "https://opencollective.com/verdaccio",
|
"url": "https://opencollective.com/verdaccio",
|
||||||
"logo": "https://opencollective.com/verdaccio/logo.txt"
|
"logo": "https://opencollective.com/verdaccio/logo.txt"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {
|
||||||
|
"@emotion/core": "10.0.22",
|
||||||
|
"@emotion/styled": "10.0.23",
|
||||||
|
"@material-ui/lab": "4.0.0-alpha.31"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ReactWrapper } from 'enzyme';
|
import { mount, ReactWrapper } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../utils/test-enzyme';
|
|
||||||
import storage from '../utils/storage';
|
import storage from '../utils/storage';
|
||||||
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
|
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Header from '../components/Header';
|
|||||||
import { Container, Content } from '../components/Layout';
|
import { Container, Content } from '../components/Layout';
|
||||||
import API from '../utils/api';
|
import API from '../utils/api';
|
||||||
import Footer from '../components/Footer';
|
import Footer from '../components/Footer';
|
||||||
|
import StyleBaseline from '../design-tokens/StyleBaseline';
|
||||||
|
|
||||||
import AppRoute from './AppRoute';
|
import AppRoute from './AppRoute';
|
||||||
import { AppProps, AppContextProvider } from './AppContext';
|
import { AppProps, AppContextProvider } from './AppContext';
|
||||||
@@ -43,10 +44,13 @@ export default class App extends Component<{}, AppProps> {
|
|||||||
const context = { isUserLoggedIn, packages, logoUrl, user, scope };
|
const context = { isUserLoggedIn, packages, logoUrl, user, scope };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container isLoading={isLoading}>
|
<>
|
||||||
{isLoading ? <Loading /> : <AppContextProvider value={context}>{this.renderContent()}</AppContextProvider>}
|
<StyleBaseline />
|
||||||
{this.renderLoginModal()}
|
<Container isLoading={isLoading}>
|
||||||
</Container>
|
{isLoading ? <Loading /> : <AppContextProvider value={context}>{this.renderContent()}</AppContextProvider>}
|
||||||
|
{this.renderLoginModal()}
|
||||||
|
</Container>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { css } from '@emotion/core';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import { theme } from '../design-tokens/theme';
|
import colors from '../utils/styles/colors';
|
||||||
|
|
||||||
export const alertError = css({
|
export const alertError = css({
|
||||||
backgroundColor: `${theme.palette.red} !important`,
|
backgroundColor: `${colors.red} !important`,
|
||||||
minWidth: 'inherit !important',
|
minWidth: 'inherit !important',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import api from '../../utils/api';
|
import api from '../../utils/api';
|
||||||
|
|
||||||
import { ActionBar } from './ActionBar';
|
import { ActionBar } from './ActionBar';
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
exports[`<ActionBar /> component should render the component in default state 1`] = `""`;
|
exports[`<ActionBar /> component should render the component in default state 1`] = `""`;
|
||||||
|
|
||||||
exports[`<ActionBar /> component when there is a button to download a tarball 1`] = `"<ul class=\\"MuiList-root MuiList-padding\\"><div class=\\"MuiButtonBase-root MuiListItem-root css-l3mdff-ActionListItem eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><button class=\\"MuiButtonBase-root MuiFab-root css-is03ew-Fab eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Download tarball\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<ActionBar /> component when there is a button to download a tarball 1`] = `"<ul class=\\"MuiList-root MuiList-padding\\"><div class=\\"MuiButtonBase-root MuiListItem-root css-1br2q5z eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><button class=\\"MuiButtonBase-root MuiFab-root css-z6z5me eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Download tarball\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<ActionBar /> component when there is a button to open an issue 1`] = `"<ul class=\\"MuiList-root MuiList-padding\\"><div class=\\"MuiButtonBase-root MuiListItem-root css-l3mdff-ActionListItem eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"https://verdaccio.tld/bugs\\" target=\\"_blank\\"><button class=\\"MuiButtonBase-root MuiFab-root css-is03ew-Fab eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></a><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<ActionBar /> component when there is a button to open an issue 1`] = `"<ul class=\\"MuiList-root MuiList-padding\\"><div class=\\"MuiButtonBase-root MuiListItem-root css-1br2q5z eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"https://verdaccio.tld/bugs\\" target=\\"_blank\\"><button class=\\"MuiButtonBase-root MuiFab-root css-z6z5me eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></a><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export const ActionListItem = styled(ListItem)({
|
export const ActionListItem = styled(ListItem)({
|
||||||
paddingTop: 0,
|
paddingTop: 0,
|
||||||
@@ -10,8 +10,8 @@ export const ActionListItem = styled(ListItem)({
|
|||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Fab = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
export const Fab = styled(FloatingActionButton)({
|
||||||
backgroundColor: props.theme && props.theme.palette.primary.main,
|
backgroundColor: colors.primary,
|
||||||
color: props.theme && props.theme.palette.white,
|
color: colors.white,
|
||||||
marginRight: '10px',
|
marginRight: '10px',
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import Authors from './Author';
|
import Authors from './Author';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Author /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1k45khb-AuthorListItem e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"mailto:verdaccio.user@verdaccio.org?subject=verdaccio@4.0.0\\" target=\\"_top\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div></a><div class=\\"MuiListItemText-root css-1cnlq5d-AuthorListItemText e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Author /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-zw46c6 e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"mailto:verdaccio.user@verdaccio.org?subject=verdaccio@4.0.0\\" target=\\"_top\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div></a><div class=\\"MuiListItemText-root css-fipixf e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Author /> component should render the component when there is no author email 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1k45khb-AuthorListItem e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div><div class=\\"MuiListItemText-root css-1cnlq5d-AuthorListItemText e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Author /> component should render the component when there is no author email 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-zw46c6 e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div><div class=\\"MuiListItemText-root css-fipixf e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { KeyboardEvent } from 'react';
|
import React, { KeyboardEvent } from 'react';
|
||||||
import styled from '@emotion/styled';
|
|
||||||
import Autosuggest, { SuggestionSelectedEventData, InputProps, ChangeEvent } from 'react-autosuggest';
|
import Autosuggest, { SuggestionSelectedEventData, InputProps, ChangeEvent } from 'react-autosuggest';
|
||||||
import match from 'autosuggest-highlight/match';
|
import match from 'autosuggest-highlight/match';
|
||||||
import parse from 'autosuggest-highlight/parse';
|
import parse from 'autosuggest-highlight/parse';
|
||||||
@@ -9,20 +8,13 @@ import MenuItem from '../../muiComponents/MenuItem';
|
|||||||
|
|
||||||
import { Wrapper, InputField, SuggestionContainer } from './styles';
|
import { Wrapper, InputField, SuggestionContainer } from './styles';
|
||||||
|
|
||||||
const StyledAnchor = styled('a')<{ fw: number }>(props => ({
|
|
||||||
fontWeight: props.fw,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const StyledMenuItem = styled(MenuItem)({
|
|
||||||
cursor: 'pointer',
|
|
||||||
});
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
suggestions: unknown[];
|
suggestions: unknown[];
|
||||||
suggestionsLoading?: boolean;
|
suggestionsLoading?: boolean;
|
||||||
suggestionsLoaded?: boolean;
|
suggestionsLoaded?: boolean;
|
||||||
suggestionsError?: boolean;
|
suggestionsError?: boolean;
|
||||||
apiLoading?: boolean;
|
apiLoading?: boolean;
|
||||||
|
color?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
startAdornment?: JSX.Element;
|
startAdornment?: JSX.Element;
|
||||||
@@ -61,18 +53,23 @@ const renderSuggestion = (suggestion, { query, isHighlighted }): JSX.Element =>
|
|||||||
const matches = match(suggestion.name, query);
|
const matches = match(suggestion.name, query);
|
||||||
const parts = parse(suggestion.name, matches);
|
const parts = parse(suggestion.name, matches);
|
||||||
return (
|
return (
|
||||||
<StyledMenuItem component="div" selected={isHighlighted}>
|
<MenuItem component="div" selected={isHighlighted}>
|
||||||
<div>
|
<div>
|
||||||
{parts.map((part, index) => {
|
{parts.map((part, index) => {
|
||||||
const fw = part.highlight ? fontWeight.semiBold : fontWeight.light;
|
const fw = part.highlight ? fontWeight.semiBold : fontWeight.light;
|
||||||
return (
|
return (
|
||||||
<StyledAnchor fw={fw} key={String(index)}>
|
<a
|
||||||
|
className={css`
|
||||||
|
font-weight: ${fw};
|
||||||
|
`}
|
||||||
|
href={suggestion.link}
|
||||||
|
key={String(index)}>
|
||||||
{part.text}
|
{part.text}
|
||||||
</StyledAnchor>
|
</a>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</StyledMenuItem>
|
</MenuItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,6 +96,7 @@ const AutoComplete = ({
|
|||||||
value = '',
|
value = '',
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
disableUnderline = false,
|
disableUnderline = false,
|
||||||
|
color,
|
||||||
onClick,
|
onClick,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
@@ -122,6 +120,7 @@ const AutoComplete = ({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
startAdornment,
|
startAdornment,
|
||||||
disableUnderline,
|
disableUnderline,
|
||||||
|
color,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
};
|
};
|
||||||
@@ -140,12 +139,7 @@ const AutoComplete = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Autosuggest
|
<Autosuggest {...autosuggestProps} inputProps={inputProps} onSuggestionSelected={onClick} renderSuggestionsContainer={renderSuggestionsContainer} />
|
||||||
{...autosuggestProps}
|
|
||||||
inputProps={inputProps}
|
|
||||||
onSuggestionSelected={onClick}
|
|
||||||
renderSuggestionsContainer={renderSuggestionsContainer}
|
|
||||||
/>
|
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,44 +1,61 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import TextField from '../../muiComponents/TextField';
|
import TextField from '../../muiComponents/TextField';
|
||||||
import Paper from '../../muiComponents/Paper';
|
import Paper from '../../muiComponents/Paper';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export interface InputFieldProps {
|
export interface InputFieldProps {
|
||||||
color: string;
|
color: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Wrapper = styled('div')({
|
export const Wrapper = styled('div')({
|
||||||
width: '100%',
|
'&&': {
|
||||||
height: '32px',
|
width: '100%',
|
||||||
position: 'relative',
|
height: '32px',
|
||||||
zIndex: 1,
|
position: 'relative',
|
||||||
|
zIndex: 1,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledTextField = styled(TextField)<{ theme?: Theme }>(props => ({
|
|
||||||
'& .MuiInputBase-root': {
|
|
||||||
':before': {
|
|
||||||
content: "''",
|
|
||||||
border: 'none',
|
|
||||||
},
|
|
||||||
':after': {
|
|
||||||
borderColor: props.theme && props.theme.palette.white,
|
|
||||||
},
|
|
||||||
':hover:before': {
|
|
||||||
content: 'none',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'& .MuiInputBase-input': {
|
|
||||||
color: props.theme && props.theme.palette.white,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
/* eslint-disable verdaccio/jsx-spread */
|
||||||
// @ts-ignore types of color are incompatible
|
export const InputField: React.FC<InputFieldProps> = ({ color, ...others }) => (
|
||||||
export const InputField: React.FC<InputFieldProps> = ({ ...others }) => <StyledTextField {...others} />;
|
<TextField
|
||||||
|
{...others}
|
||||||
|
classes={{
|
||||||
|
// @ts-ignore
|
||||||
|
input: css`
|
||||||
|
&& {
|
||||||
|
${color &&
|
||||||
|
css`
|
||||||
|
color: ${color};
|
||||||
|
`};
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
root: css`
|
||||||
|
&& {
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
${color &&
|
||||||
|
css`
|
||||||
|
border-color: ${color};
|
||||||
|
`};
|
||||||
|
}
|
||||||
|
&:hover:before {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
export const SuggestionContainer = styled(Paper)({
|
export const SuggestionContainer = styled(Paper)({
|
||||||
maxHeight: '500px',
|
'&&': {
|
||||||
overflowY: 'auto',
|
maxHeight: '500px',
|
||||||
|
overflowY: 'auto',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ReactWrapper } from 'enzyme';
|
import { mount, ReactWrapper } from 'enzyme';
|
||||||
|
|
||||||
import { copyToClipBoardUtility } from '../../utils/cli-utils';
|
import { copyToClipBoardUtility } from '../../utils/cli-utils';
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import CopyToClipBoard from './CopyToClipBoard';
|
import CopyToClipBoard from './CopyToClipBoard';
|
||||||
import { CopyIcon } from './styles';
|
import { CopyIcon } from './styles';
|
||||||
@@ -17,7 +16,7 @@ describe('<CopyToClipBoard /> component', () => {
|
|||||||
wrapper = mount(<CopyToClipBoard text={copyText} />);
|
wrapper = mount(<CopyToClipBoard text={copyText} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should load the component in default state', () => {
|
test('render the component', () => {
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<CopyToClipBoard /> component should load the component in default state 1`] = `"<div class=\\"css-1in239f-ClipBoardCopy eb8w2fo0\\"><span class=\\"css-7gar9h-ClipBoardCopyText eb8w2fo1\\">copy text</span><button class=\\"MuiButtonBase-root MuiIconButton-root css-1fs86cq-CopyIcon eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div>"`;
|
exports[`<CopyToClipBoard /> component render the component 1`] = `"<div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">copy text</span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div>"`;
|
||||||
|
|||||||
@@ -3,18 +3,22 @@ import styled from '@emotion/styled';
|
|||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
|
|
||||||
export const ClipBoardCopy = styled('div')({
|
export const ClipBoardCopy = styled('div')({
|
||||||
display: 'flex',
|
'&&': {
|
||||||
alignItems: 'center',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ClipBoardCopyText = styled('span')({
|
export const ClipBoardCopyText = styled('span')({
|
||||||
display: 'inline-block',
|
'&&': {
|
||||||
textOverflow: 'ellipsis',
|
display: 'inline-block',
|
||||||
overflow: 'hidden',
|
textOverflow: 'ellipsis',
|
||||||
whiteSpace: 'nowrap',
|
overflow: 'hidden',
|
||||||
height: '21px',
|
whiteSpace: 'nowrap',
|
||||||
fontSize: '1rem',
|
height: '21px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const CopyIcon = styled(IconButton)({});
|
export const CopyIcon = styled(IconButton)({});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
import { HashRouter } from 'react-router-dom';
|
import { HashRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import { DetailContextProvider } from '../../pages/Version';
|
import { DetailContextProvider } from '../../pages/Version';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Dependencies from './Dependencies';
|
import Dependencies from './Dependencies';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import DetailContainer from './DetailContainer';
|
import DetailContainer from './DetailContainer';
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`DetailContainer renders correctly 1`] = `
|
exports[`DetailContainer renders correctly 1`] = `
|
||||||
.emotion-0 {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="MuiBox-root MuiBox-root-2"
|
class="MuiBox-root MuiBox-root-2"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiTabs-root emotion-0 emotion-1"
|
class="MuiTabs-root css-1qm1lh emotion-0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiTabs-scroller MuiTabs-fixed"
|
class="MuiTabs-scroller MuiTabs-fixed"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContextProvider } from '../../pages/Version';
|
import { DetailContextProvider } from '../../pages/Version';
|
||||||
|
|
||||||
import Developers, { DevelopersType } from './Developers';
|
import Developers, { DevelopersType } from './Developers';
|
||||||
|
|||||||
@@ -1,57 +1,22 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`test Developers should render the component for contributors with items 1`] = `
|
exports[`test Developers should render the component for contributors with items 1`] = `
|
||||||
.emotion-0 {
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 {
|
|
||||||
margin: 10px 0 10px 0;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-flex-wrap: wrap;
|
|
||||||
-ms-flex-wrap: wrap;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 > * {
|
|
||||||
margin: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-8 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-flex-direction: column;
|
|
||||||
-ms-flex-direction: column;
|
|
||||||
flex-direction: column;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
<Developers
|
<Developers
|
||||||
type="contributors"
|
type="contributors"
|
||||||
>
|
>
|
||||||
<StyledText
|
<Styled(Component)
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Text)
|
<ForwardRef(Text)
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<WithStyles(ForwardRef(Typography))
|
<WithStyles(ForwardRef(Typography))
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Typography)
|
<ForwardRef(Typography)
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
"alignCenter": "MuiTypography-alignCenter",
|
"alignCenter": "MuiTypography-alignCenter",
|
||||||
@@ -89,23 +54,23 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<h6
|
<h6
|
||||||
className="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
className="MuiTypography-root css-48zeoi emotion-0 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
contributors
|
contributors
|
||||||
</h6>
|
</h6>
|
||||||
</ForwardRef(Typography)>
|
</ForwardRef(Typography)>
|
||||||
</WithStyles(ForwardRef(Typography))>
|
</WithStyles(ForwardRef(Typography))>
|
||||||
</ForwardRef(Text)>
|
</ForwardRef(Text)>
|
||||||
</StyledText>
|
</Styled(Component)>
|
||||||
<Content>
|
<Styled(div)>
|
||||||
<div
|
<div
|
||||||
className="emotion-12 emotion-13"
|
className="css-mkcn9c emotion-6"
|
||||||
>
|
>
|
||||||
<Details
|
<Styled(span)
|
||||||
key="dave.methvin@gmail.com"
|
key="dave.methvin@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="emotion-8 emotion-9"
|
className="css-dvxtzn emotion-4"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="dave.methvin@gmail.com"
|
email="dave.methvin@gmail.com"
|
||||||
@@ -199,12 +164,12 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Details>
|
</Styled(span)>
|
||||||
<Details
|
<Styled(span)
|
||||||
key="m.goleb@gmail.com"
|
key="m.goleb@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="emotion-8 emotion-9"
|
className="css-dvxtzn emotion-4"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="m.goleb@gmail.com"
|
email="m.goleb@gmail.com"
|
||||||
@@ -298,64 +263,29 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Details>
|
</Styled(span)>
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Styled(div)>
|
||||||
</Developers>
|
</Developers>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`test Developers should render the component for maintainers with items 1`] = `
|
exports[`test Developers should render the component for maintainers with items 1`] = `
|
||||||
.emotion-0 {
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 {
|
|
||||||
margin: 10px 0 10px 0;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-flex-wrap: wrap;
|
|
||||||
-ms-flex-wrap: wrap;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 > * {
|
|
||||||
margin: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-8 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-flex-direction: column;
|
|
||||||
-ms-flex-direction: column;
|
|
||||||
flex-direction: column;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
<Developers
|
<Developers
|
||||||
type="maintainers"
|
type="maintainers"
|
||||||
>
|
>
|
||||||
<StyledText
|
<Styled(Component)
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Text)
|
<ForwardRef(Text)
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<WithStyles(ForwardRef(Typography))
|
<WithStyles(ForwardRef(Typography))
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Typography)
|
<ForwardRef(Typography)
|
||||||
className="emotion-0 emotion-1"
|
className="css-48zeoi emotion-0"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
"alignCenter": "MuiTypography-alignCenter",
|
"alignCenter": "MuiTypography-alignCenter",
|
||||||
@@ -393,23 +323,23 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<h6
|
<h6
|
||||||
className="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
className="MuiTypography-root css-48zeoi emotion-0 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
maintainers
|
maintainers
|
||||||
</h6>
|
</h6>
|
||||||
</ForwardRef(Typography)>
|
</ForwardRef(Typography)>
|
||||||
</WithStyles(ForwardRef(Typography))>
|
</WithStyles(ForwardRef(Typography))>
|
||||||
</ForwardRef(Text)>
|
</ForwardRef(Text)>
|
||||||
</StyledText>
|
</Styled(Component)>
|
||||||
<Content>
|
<Styled(div)>
|
||||||
<div
|
<div
|
||||||
className="emotion-12 emotion-13"
|
className="css-mkcn9c emotion-6"
|
||||||
>
|
>
|
||||||
<Details
|
<Styled(span)
|
||||||
key="dave.methvin@gmail.com"
|
key="dave.methvin@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="emotion-8 emotion-9"
|
className="css-dvxtzn emotion-4"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="dave.methvin@gmail.com"
|
email="dave.methvin@gmail.com"
|
||||||
@@ -503,12 +433,12 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Details>
|
</Styled(span)>
|
||||||
<Details
|
<Styled(span)
|
||||||
key="m.goleb@gmail.com"
|
key="m.goleb@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="emotion-8 emotion-9"
|
className="css-dvxtzn emotion-4"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="m.goleb@gmail.com"
|
email="m.goleb@gmail.com"
|
||||||
@@ -602,9 +532,9 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Details>
|
</Styled(span)>
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Styled(div)>
|
||||||
</Developers>
|
</Developers>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export const Details = styled('span')({
|
export const Details = styled('span')({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -26,7 +26,7 @@ export const StyledText = styled(Text)({
|
|||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Fab = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
export const Fab = styled(FloatingActionButton)({
|
||||||
backgroundColor: props.theme && props.theme.palette.primary.main,
|
backgroundColor: colors.primary,
|
||||||
color: props.theme && props.theme.palette.white,
|
color: colors.white,
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import Dist from './Dist';
|
import Dist from './Dist';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Dist /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1mms18p-DistListItem estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Dist /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Dist /> component should render the component with license as object 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1mms18p-DistListItem estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Dist /> component should render the component with license as object 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Dist /> component should render the component with license as string 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1mms18p-DistListItem estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-e2le7v-DistChips estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Dist /> component should render the component with license as string 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { Theme } from '../../design-tokens/theme';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
@@ -18,11 +18,11 @@ export const DistListItem = styled(ListItem)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const DistChips = styled(Chip)({
|
export const DistChips = styled(Chip)({
|
||||||
marginRight: 5,
|
marginRight: '5px',
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const DownloadButton = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
export const DownloadButton = styled(FloatingActionButton)({
|
||||||
backgroundColor: props.theme && props.theme.palette.primary.main,
|
backgroundColor: colors.primary,
|
||||||
color: props.theme && props.theme.palette.white,
|
color: colors.white,
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import { PackageMetaInterface } from '../../../types/packageMeta';
|
import { PackageMetaInterface } from '../../../types/packageMeta';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Engines /> component should render the component in default state 1`] = `"<div class=\\"MuiGrid-root MuiGrid-container\\"><div class=\\"MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6\\"><ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText et66bt70 MuiTypography-subtitle1\\">node JS</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-18b06t0-EngineListItem et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>= 0.1.98</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div><div class=\\"MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6\\"><ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText et66bt70 MuiTypography-subtitle1\\">NPM version</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-18b06t0-EngineListItem et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>3</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div></div>"`;
|
exports[`<Engines /> component should render the component in default state 1`] = `"<div class=\\"MuiGrid-root MuiGrid-container\\"><div class=\\"MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6\\"><ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko et66bt70 MuiTypography-subtitle1\\">node JS</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-131yq1t et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>= 0.1.98</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div><div class=\\"MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6\\"><ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko et66bt70 MuiTypography-subtitle1\\">NPM version</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-131yq1t et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>3</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div></div>"`;
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount, ReactWrapper } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
|
|
||||||
describe('<Footer /> component', () => {
|
jest.mock('../../../package.json', () => ({
|
||||||
beforeAll(() => {
|
version: '4.0.0-alpha.3',
|
||||||
window.VERDACCIO_VERSION = 'v.1.0.0';
|
}));
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
describe('<Footer /> component', () => {
|
||||||
|
let wrapper: ReactWrapper;
|
||||||
|
beforeEach(() => {
|
||||||
|
window.VERDACCIO_VERSION = 'v.1.0.0';
|
||||||
|
wrapper = mount(<Footer />);
|
||||||
delete window.VERDACCIO_VERSION;
|
delete window.VERDACCIO_VERSION;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should load the initial state of Footer component', () => {
|
test('should load the initial state of Footer component', () => {
|
||||||
const { container } = render(<Footer />);
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,274 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Footer /> component should load the initial state of Footer component 1`] = `
|
exports[`<Footer /> component should load the initial state of Footer component 1`] = `"<div class=\\"css-i0nj2g ezbsl480\\"><div class=\\"css-hzfs9b ezbsl481\\"><div class=\\"css-d8nsp7 ezbsl482\\"> Made with<span class=\\"css-1so4oe0 ezbsl487\\">♥</span>on<span class=\\"css-1ie354y ezbsl484\\"><svg class=\\"ezbsl485 css-151fgib ek145dl0\\"><title>Earth</title><use xlink:href=\\"[object Object]#earth\\"></use></svg><span class=\\"css-8631ip ezbsl486\\"><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Spain</title><use xlink:href=\\"[object Object]#spain\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Nicaragua</title><use xlink:href=\\"[object Object]#nicaragua\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>India</title><use xlink:href=\\"[object Object]#india\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Brazil</title><use xlink:href=\\"[object Object]#brazil\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>China</title><use xlink:href=\\"[object Object]#china\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg></span></span></div><div class=\\"css-1wbzdyy ezbsl483\\">Powered by<span class=\\"ezbsl488 css-ommwhu ek145dl1\\" name=\\"verdaccio\\" title=\\"Verdaccio\\"><img alt=\\"Verdaccio\\" src=\\"[object Object]\\" class=\\"css-1ncdhax ek145dl2\\"></span>/ v.1.0.0</div></div></div>"`;
|
||||||
.emotion-38 {
|
|
||||||
background: #f9f9f9;
|
|
||||||
border-top: 1px solid #e3e3e3;
|
|
||||||
color: #999999;
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-36 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
-webkit-box-pack: end;
|
|
||||||
-webkit-justify-content: flex-end;
|
|
||||||
-ms-flex-pack: end;
|
|
||||||
justify-content: flex-end;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:768px) {
|
|
||||||
.emotion-36 {
|
|
||||||
min-width: 400px;
|
|
||||||
max-width: 800px;
|
|
||||||
margin: auto;
|
|
||||||
-webkit-box-pack: justify;
|
|
||||||
-webkit-justify-content: space-between;
|
|
||||||
-ms-flex-pack: justify;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:1024px) {
|
|
||||||
.emotion-36 {
|
|
||||||
max-width: 1240px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-27 {
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:768px) {
|
|
||||||
.emotion-27 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-0 {
|
|
||||||
color: #e25555;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-25 {
|
|
||||||
position: relative;
|
|
||||||
height: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-25:hover .emotion-24 {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-3 {
|
|
||||||
box-sizing: initial;
|
|
||||||
display: inline-block;
|
|
||||||
cursor: default;
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-23 {
|
|
||||||
position: absolute;
|
|
||||||
background: #d3dddd;
|
|
||||||
padding: 1px 4px;
|
|
||||||
border-radius: 3px;
|
|
||||||
height: 20px;
|
|
||||||
display: -webkit-inline-box;
|
|
||||||
display: -webkit-inline-flex;
|
|
||||||
display: -ms-inline-flexbox;
|
|
||||||
display: inline-flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
visibility: hidden;
|
|
||||||
top: -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-23:before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 29%;
|
|
||||||
left: -4px;
|
|
||||||
margin-left: -5px;
|
|
||||||
border: 5px solid;
|
|
||||||
border-color: #d3dddd transparent transparent transparent;
|
|
||||||
-webkit-transform: rotate(90deg);
|
|
||||||
-ms-transform: rotate(90deg);
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 {
|
|
||||||
box-sizing: initial;
|
|
||||||
display: inline-block;
|
|
||||||
cursor: default;
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-34 {
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
display: none;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:768px) {
|
|
||||||
.emotion-34 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-32 {
|
|
||||||
box-sizing: initial;
|
|
||||||
display: inline-block;
|
|
||||||
cursor: pointer;
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-29 {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="emotion-38 emotion-39"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="emotion-36 emotion-37"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="emotion-27 emotion-28"
|
|
||||||
>
|
|
||||||
Made with
|
|
||||||
<span
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
>
|
|
||||||
♥
|
|
||||||
</span>
|
|
||||||
on
|
|
||||||
<span
|
|
||||||
class="emotion-25 emotion-26"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="emotion-2 emotion-3 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Earth
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#earth"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<span
|
|
||||||
class="emotion-23 emotion-24"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Spain
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#spain"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Nicaragua
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#nicaragua"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
India
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#india"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Brazil
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#brazil"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
China
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#china"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<svg
|
|
||||||
class="emotion-5 emotion-6 emotion-4"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Austria
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#austria"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="emotion-34 emotion-35"
|
|
||||||
>
|
|
||||||
Powered by
|
|
||||||
<span
|
|
||||||
class="emotion-5 emotion-32 emotion-33"
|
|
||||||
title="Verdaccio"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="Verdaccio"
|
|
||||||
class="emotion-29 emotion-30"
|
|
||||||
src="[object Object]"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
/ v.1.0.0
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,88 +1,111 @@
|
|||||||
|
import { css } from '@emotion/core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { breakpoints } from '../../utils/styles/media';
|
import mq from '../../utils/styles/media';
|
||||||
import Icon from '../Icon/Icon';
|
import Icon from '../Icon/Icon';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const Wrapper = styled('div')<{ theme?: Theme }>(props => ({
|
export const Wrapper = styled('div')({
|
||||||
background: props.theme && props.theme.palette.snow,
|
'&&': {
|
||||||
borderTop: `1px solid ${props.theme && props.theme.palette.greyGainsboro}`,
|
background: colors.snow,
|
||||||
color: props.theme && props.theme.palette.nobel01,
|
borderTop: `1px solid ${colors.greyGainsboro}`,
|
||||||
fontSize: '14px',
|
color: colors.nobel01,
|
||||||
padding: '20px',
|
fontSize: '14px',
|
||||||
}));
|
padding: '20px',
|
||||||
|
|
||||||
export const Inner = styled('div')({
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
width: '100%',
|
|
||||||
[`@media (min-width: ${breakpoints.medium}px)`]: {
|
|
||||||
minWidth: 400,
|
|
||||||
maxWidth: 800,
|
|
||||||
margin: 'auto',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
[`@media (min-width: ${breakpoints.large}px)`]: {
|
|
||||||
maxWidth: 1240,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Left = styled('div')({
|
export const Inner = styled('div')`
|
||||||
alignItems: 'center',
|
&& {
|
||||||
display: 'none',
|
display: flex;
|
||||||
[`@media (min-width: ${breakpoints.medium}px)`]: {
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 100%;
|
||||||
|
${() => {
|
||||||
|
return mq.medium(css`
|
||||||
|
min-width: 400px;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: auto;
|
||||||
|
justify-content: space-between;
|
||||||
|
`);
|
||||||
|
}};
|
||||||
|
${() => {
|
||||||
|
return mq.large(css`
|
||||||
|
max-width: 1240px;
|
||||||
|
`);
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const Left = styled('div')`
|
||||||
|
&& {
|
||||||
|
align-items: center;
|
||||||
|
display: none;
|
||||||
|
${() => {
|
||||||
|
return mq.medium(css`
|
||||||
|
display: flex;
|
||||||
|
`);
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const Right = styled(Left)({
|
||||||
|
'&&': {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Right = styled(Left)({
|
export const ToolTip = styled('span')({
|
||||||
display: 'flex',
|
'&&': {
|
||||||
|
position: 'relative',
|
||||||
|
height: '18px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Earth = styled(Icon)({
|
export const Earth = styled(Icon)({
|
||||||
padding: '0 10px',
|
'&&': {
|
||||||
});
|
padding: '0 10px',
|
||||||
|
|
||||||
export const Flags = styled('span')<{ theme?: Theme }>(props => ({
|
|
||||||
position: 'absolute',
|
|
||||||
background: props.theme && props.theme.palette.greyAthens,
|
|
||||||
padding: '1px 4px',
|
|
||||||
borderRadius: 3,
|
|
||||||
height: 20,
|
|
||||||
display: 'inline-flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
visibility: 'hidden',
|
|
||||||
top: -2,
|
|
||||||
':before': {
|
|
||||||
content: "''",
|
|
||||||
position: 'absolute',
|
|
||||||
top: '29%',
|
|
||||||
left: -4,
|
|
||||||
marginLeft: -5,
|
|
||||||
border: '5px solid',
|
|
||||||
borderColor: `${props.theme && props.theme.palette.greyAthens} transparent transparent transparent`,
|
|
||||||
transform: 'rotate(90deg)',
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const ToolTip = styled('span')({
|
|
||||||
position: 'relative',
|
|
||||||
height: '18px',
|
|
||||||
':hover': {
|
|
||||||
[`${Flags}`]: {
|
|
||||||
visibility: 'visible',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Love = styled('span')<{ theme?: Theme }>(props => ({
|
export const Flags = styled('span')`
|
||||||
color: props.theme && props.theme.palette.love,
|
&& {
|
||||||
padding: '0 5px',
|
position: absolute;
|
||||||
}));
|
background: ${colors.greyAthens};
|
||||||
|
padding: 1px 4px;
|
||||||
|
border-radius: 3px;
|
||||||
|
height: 20px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
visibility: hidden;
|
||||||
|
top: -2px;
|
||||||
|
:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 29%;
|
||||||
|
left: -4px;
|
||||||
|
margin-left: -5px;
|
||||||
|
border: 5px solid;
|
||||||
|
border-color: ${colors.greyAthens} transparent transparent transparent;
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
${/* sc-selector */ ToolTip}:hover & {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const Love = styled('span')({
|
||||||
|
'&&': {
|
||||||
|
color: colors.love,
|
||||||
|
padding: '0 5px',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const Flag = styled(Icon)({
|
export const Flag = styled(Icon)({
|
||||||
padding: '0 5px',
|
'&&': {
|
||||||
|
padding: '0 5px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Logo = Flag;
|
export const Logo = Flag;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
|
import { render, fireEvent, waitForElementToBeRemoved, waitForElement } from '@testing-library/react';
|
||||||
import { render, fireEvent, waitForElementToBeRemoved, waitForElement } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import { css } from 'emotion';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import Search from '../Search/';
|
import Search from '../Search/';
|
||||||
@@ -12,15 +12,15 @@ interface Props {
|
|||||||
logo?: string;
|
logo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledLink = styled(Link)({
|
|
||||||
marginRight: '1em',
|
|
||||||
});
|
|
||||||
|
|
||||||
const HeaderLeft: React.FC<Props> = ({ withoutSearch = false, logo }) => (
|
const HeaderLeft: React.FC<Props> = ({ withoutSearch = false, logo }) => (
|
||||||
<LeftSide>
|
<LeftSide>
|
||||||
<StyledLink to={'/'}>
|
<Link
|
||||||
|
className={css`
|
||||||
|
margin-right: 1em;
|
||||||
|
`}
|
||||||
|
to={'/'}>
|
||||||
<HeaderLogo logo={logo} />
|
<HeaderLogo logo={logo} />
|
||||||
</StyledLink>
|
</Link>
|
||||||
{!withoutSearch && (
|
{!withoutSearch && (
|
||||||
<SearchWrapper>
|
<SearchWrapper>
|
||||||
<Search />
|
<Search />
|
||||||
|
|||||||
@@ -1,166 +1,28 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Header /> component with logged in state should load the component in logged in state 1`] = `
|
exports[`<Header /> component with logged in state should load the component in logged in state 1`] = `
|
||||||
.emotion-24 {
|
|
||||||
background-color: #4b5e40;
|
|
||||||
min-height: 60px;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-box-pack: center;
|
|
||||||
-webkit-justify-content: center;
|
|
||||||
-ms-flex-pack: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:768px) {
|
|
||||||
.emotion-24 .emotion-13 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-24 .emotion-17 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-24 .e1jf5lit4 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:1024px) {
|
|
||||||
.emotion-24 .emotion-23 {
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:1275px) {
|
|
||||||
.emotion-24 .emotion-23 {
|
|
||||||
max-width: 1240px;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-22 {
|
|
||||||
-webkit-box-pack: justify;
|
|
||||||
-webkit-justify-content: space-between;
|
|
||||||
-ms-flex-pack: justify;
|
|
||||||
justify-content: space-between;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-14 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
padding: 0;
|
|
||||||
-webkit-flex: 1;
|
|
||||||
-ms-flex: 1;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-0 {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-position: center;
|
|
||||||
background-size: contain;
|
|
||||||
background-image: url([object Object]);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 {
|
|
||||||
display: none;
|
|
||||||
max-width: 393px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-10 {
|
|
||||||
width: 100%;
|
|
||||||
height: 32px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:before {
|
|
||||||
content: '';
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:after {
|
|
||||||
border-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:hover:before {
|
|
||||||
content: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-input {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-4 {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-8 {
|
|
||||||
max-height: 500px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-20 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-16 {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-18 {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
<header
|
<header
|
||||||
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic emotion-24 emotion-25 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-22 emotion-23 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1bjere7 emotion-8 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-14 emotion-15 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-i5xjw9 emotion-4 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="emotion-2 emotion-3"
|
class="css-1dk30lc"
|
||||||
href="/"
|
href="/"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-0 emotion-1"
|
class="css-1sifsqk emotion-0"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="emotion-12 emotion-13"
|
class="css-12prohx emotion-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-10 emotion-11"
|
class="css-1crzyyo emotion-2"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -172,13 +34,13 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
<div
|
<div
|
||||||
aria-autocomplete="list"
|
aria-autocomplete="list"
|
||||||
aria-controls="react-autowhatever-1"
|
aria-controls="react-autowhatever-1"
|
||||||
class="MuiFormControl-root MuiTextField-root react-autosuggest__input emotion-6 emotion-7 MuiFormControl-fullWidth"
|
class="MuiFormControl-root MuiTextField-root react-autosuggest__input MuiFormControl-fullWidth"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root emotion-4 emotion-5 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -195,7 +57,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
<input
|
<input
|
||||||
aria-invalid="false"
|
aria-invalid="false"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart"
|
class="MuiInputBase-input MuiInput-input css-hodoyq MuiInputBase-inputAdornedStart"
|
||||||
placeholder="Search Packages"
|
placeholder="Search Packages"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
@@ -203,7 +65,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container emotion-8 emotion-9"
|
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-cfo6a emotion-1"
|
||||||
id="react-autowhatever-1"
|
id="react-autowhatever-1"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
/>
|
/>
|
||||||
@@ -212,10 +74,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-20 emotion-21 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1qii1b7 emotion-7 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-16 emotion-17 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root css-13o7eu2 emotion-5 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -239,7 +101,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="emotion-18 emotion-19"
|
class="css-kbn7if emotion-6"
|
||||||
data-testid="header--tooltip-documentation"
|
data-testid="header--tooltip-documentation"
|
||||||
href="https://verdaccio.org/docs/en/installation"
|
href="https://verdaccio.org/docs/en/installation"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
@@ -332,166 +194,28 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`<Header /> component with logged in state should load the component in logged out state 1`] = `
|
exports[`<Header /> component with logged in state should load the component in logged out state 1`] = `
|
||||||
.emotion-24 {
|
|
||||||
background-color: #4b5e40;
|
|
||||||
min-height: 60px;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-box-pack: center;
|
|
||||||
-webkit-justify-content: center;
|
|
||||||
-ms-flex-pack: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:768px) {
|
|
||||||
.emotion-24 .emotion-13 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-24 .emotion-17 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-24 .e1jf5lit4 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:1024px) {
|
|
||||||
.emotion-24 .emotion-23 {
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width:1275px) {
|
|
||||||
.emotion-24 .emotion-23 {
|
|
||||||
max-width: 1240px;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-22 {
|
|
||||||
-webkit-box-pack: justify;
|
|
||||||
-webkit-justify-content: space-between;
|
|
||||||
-ms-flex-pack: justify;
|
|
||||||
justify-content: space-between;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-14 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
padding: 0;
|
|
||||||
-webkit-flex: 1;
|
|
||||||
-ms-flex: 1;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-0 {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-position: center;
|
|
||||||
background-size: contain;
|
|
||||||
background-image: url([object Object]);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 {
|
|
||||||
display: none;
|
|
||||||
max-width: 393px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-10 {
|
|
||||||
width: 100%;
|
|
||||||
height: 32px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:before {
|
|
||||||
content: '';
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:after {
|
|
||||||
border-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-root:hover:before {
|
|
||||||
content: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 .MuiInputBase-input {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-4 {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-8 {
|
|
||||||
max-height: 500px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-20 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-16 {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-18 {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
<header
|
<header
|
||||||
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic emotion-24 emotion-25 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-22 emotion-23 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1bjere7 emotion-8 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-14 emotion-15 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-i5xjw9 emotion-4 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="emotion-2 emotion-3"
|
class="css-1dk30lc"
|
||||||
href="/"
|
href="/"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-0 emotion-1"
|
class="css-1sifsqk emotion-0"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="emotion-12 emotion-13"
|
class="css-12prohx emotion-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-10 emotion-11"
|
class="css-1crzyyo emotion-2"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -503,13 +227,13 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
<div
|
<div
|
||||||
aria-autocomplete="list"
|
aria-autocomplete="list"
|
||||||
aria-controls="react-autowhatever-1"
|
aria-controls="react-autowhatever-1"
|
||||||
class="MuiFormControl-root MuiTextField-root react-autosuggest__input emotion-6 emotion-7 MuiFormControl-fullWidth"
|
class="MuiFormControl-root MuiTextField-root react-autosuggest__input MuiFormControl-fullWidth"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root emotion-4 emotion-5 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -526,7 +250,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
<input
|
<input
|
||||||
aria-invalid="false"
|
aria-invalid="false"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart"
|
class="MuiInputBase-input MuiInput-input css-hodoyq MuiInputBase-inputAdornedStart"
|
||||||
placeholder="Search Packages"
|
placeholder="Search Packages"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
@@ -534,7 +258,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container emotion-8 emotion-9"
|
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-cfo6a emotion-1"
|
||||||
id="react-autowhatever-1"
|
id="react-autowhatever-1"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
/>
|
/>
|
||||||
@@ -543,10 +267,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular emotion-20 emotion-21 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1qii1b7 emotion-7 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-16 emotion-17 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root css-13o7eu2 emotion-5 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -570,7 +294,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="emotion-18 emotion-19"
|
class="css-kbn7if emotion-6"
|
||||||
data-testid="header--tooltip-documentation"
|
data-testid="header--tooltip-documentation"
|
||||||
href="https://verdaccio.org/docs/en/installation"
|
href="https://verdaccio.org/docs/en/installation"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import { Theme } from '../../design-tokens/theme';
|
import colors from '../../utils/styles/colors';
|
||||||
import { breakpoints } from '../../utils/styles/media';
|
import mq from '../../utils/styles/media';
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
import AppBar from '../../muiComponents/AppBar';
|
import AppBar from '../../muiComponents/AppBar';
|
||||||
import Toolbar from '../../muiComponents/Toolbar';
|
import Toolbar from '../../muiComponents/Toolbar';
|
||||||
@@ -27,63 +27,68 @@ export const LeftSide = styled(RightSide)({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MobileNavBar = styled('div')<{ theme?: Theme }>(props => ({
|
export const MobileNavBar = styled('div')({
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
borderBottom: `1px solid ${props.theme && props.theme.palette.greyLight}`,
|
borderBottom: `1px solid ${colors.greyLight}`,
|
||||||
padding: '8px',
|
padding: '8px',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
}));
|
});
|
||||||
|
|
||||||
export const InnerMobileNavBar = styled('div')<{ theme?: Theme }>(props => ({
|
export const InnerMobileNavBar = styled('div')({
|
||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
backgroundColor: props.theme && props.theme.palette.greyLight,
|
backgroundColor: colors.greyLight,
|
||||||
color: props.theme && props.theme.palette.white,
|
color: colors.white,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: '0 5px',
|
padding: '0 5px',
|
||||||
margin: '0 10px 0 0',
|
margin: '0 10px 0 0',
|
||||||
}));
|
});
|
||||||
|
|
||||||
export const IconSearchButton = styled(IconButton)({
|
export const IconSearchButton = styled(IconButton)({
|
||||||
display: 'block',
|
display: 'block',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SearchWrapper = styled('div')({
|
export const SearchWrapper = styled('div')({
|
||||||
display: 'none',
|
// display: 'none',
|
||||||
maxWidth: '393px',
|
maxWidth: '393px',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const NavBar = styled(AppBar)<{ theme?: Theme }>(props => ({
|
export const NavBar = styled(AppBar)`
|
||||||
backgroundColor: props.theme && props.theme.palette.primary.main,
|
&& {
|
||||||
minHeight: 60,
|
background-color: ${colors.primary};
|
||||||
display: 'flex',
|
min-height: 60px;
|
||||||
justifyContent: 'center',
|
display: flex;
|
||||||
[`@media (min-width: ${breakpoints.medium}px)`]: css`
|
justify-content: center;
|
||||||
${SearchWrapper} {
|
${() =>
|
||||||
display: flex;
|
mq.medium(css`
|
||||||
}
|
${SearchWrapper} {
|
||||||
${IconSearchButton} {
|
display: flex;
|
||||||
display: none;
|
}
|
||||||
}
|
${IconSearchButton} {
|
||||||
${MobileNavBar} {
|
display: none;
|
||||||
display: none;
|
}
|
||||||
}
|
${MobileNavBar} {
|
||||||
`,
|
display: none;
|
||||||
[`@media (min-width: ${breakpoints.large}px)`]: css`
|
}
|
||||||
${InnerNavBar} {
|
`)};
|
||||||
padding: 0 20px;
|
${() =>
|
||||||
}
|
mq.large(css`
|
||||||
`,
|
${InnerNavBar} {
|
||||||
[`@media (min-width: ${breakpoints.xlarge}px)`]: css`
|
padding: 0 20px;
|
||||||
${InnerNavBar} {
|
}
|
||||||
max-width: 1240px;
|
`)};
|
||||||
width: 100%;
|
${() =>
|
||||||
margin: 0 auto;
|
mq.xlarge(css`
|
||||||
}
|
${InnerNavBar} {
|
||||||
`,
|
max-width: 1240px;
|
||||||
}));
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
`)};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const StyledLink = styled(Link)<{ theme?: Theme }>(props => ({
|
export const StyledLink = styled(Link)({
|
||||||
color: props.theme && props.theme.palette.white,
|
color: 'white',
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Help from './Help';
|
import Help from './Help';
|
||||||
|
|
||||||
describe('<Help /> component', () => {
|
describe('<Help /> component', () => {
|
||||||
test('should load the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<Help />);
|
const wrapper = mount(<Help />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,159 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Help /> component should load the component in default state 1`] = `
|
exports[`<Help /> component should render the component in default state 1`] = `"<div class=\\"MuiPaper-root MuiPaper-elevation1 MuiCard-root css-ryznli e1wgaou60 MuiPaper-rounded\\" id=\\"help-card\\"><div class=\\"MuiCardContent-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h5 MuiTypography-gutterBottom\\" id=\\"help-card__title\\">No Package Published Yet.</h2><h6 class=\\"MuiTypography-root css-zg2fwz e1wgaou61 MuiTypography-h6 MuiTypography-colorTextSecondary MuiTypography-gutterBottom\\">To publish your first package just:</h6><p class=\\"MuiTypography-root MuiTypography-body1\\">1. Login</p><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">npm adduser --registry http://localhost</span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div><p class=\\"MuiTypography-root MuiTypography-body1\\">2. Publish</p><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">npm publish --registry http://localhost</span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div><p class=\\"MuiTypography-root MuiTypography-body2\\">3. Refresh this page.</p></div><div class=\\"MuiCardActions-root MuiCardActions-spacing\\"><a class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-textSizeSmall MuiButton-sizeSmall\\" tabindex=\\"0\\" aria-disabled=\\"false\\" href=\\"https://verdaccio.org/docs/en/installation\\"><span class=\\"MuiButton-label\\">Learn More</span><span class=\\"MuiTouchRipple-root\\"></span></a></div></div>"`;
|
||||||
.emotion-14 {
|
|
||||||
width: 600px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-0 {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
-webkit-box-pack: justify;
|
|
||||||
-webkit-justify-content: space-between;
|
|
||||||
-ms-flex-pack: justify;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
display: inline-block;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
height: 21px;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="MuiPaper-root MuiPaper-elevation1 MuiCard-root emotion-14 emotion-15 MuiPaper-rounded"
|
|
||||||
id="help-card"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="MuiCardContent-root"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="MuiTypography-root MuiTypography-h5 MuiTypography-gutterBottom"
|
|
||||||
id="help-card__title"
|
|
||||||
>
|
|
||||||
No Package Published Yet.
|
|
||||||
</h2>
|
|
||||||
<h6
|
|
||||||
class="MuiTypography-root emotion-0 emotion-1 MuiTypography-h6 MuiTypography-colorTextSecondary MuiTypography-gutterBottom"
|
|
||||||
>
|
|
||||||
To publish your first package just:
|
|
||||||
</h6>
|
|
||||||
<p
|
|
||||||
class="MuiTypography-root MuiTypography-body1"
|
|
||||||
>
|
|
||||||
1. Login
|
|
||||||
</p>
|
|
||||||
<div
|
|
||||||
class="emotion-6 emotion-7"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="emotion-2 emotion-3"
|
|
||||||
>
|
|
||||||
npm adduser --registry http://localhost
|
|
||||||
</span>
|
|
||||||
<button
|
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-4 emotion-5"
|
|
||||||
tabindex="0"
|
|
||||||
title="Copy to Clipboard"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="MuiIconButton-label"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
class="MuiSvgIcon-root"
|
|
||||||
focusable="false"
|
|
||||||
role="presentation"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
class="MuiTouchRipple-root"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p
|
|
||||||
class="MuiTypography-root MuiTypography-body1"
|
|
||||||
>
|
|
||||||
2. Publish
|
|
||||||
</p>
|
|
||||||
<div
|
|
||||||
class="emotion-6 emotion-7"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="emotion-2 emotion-3"
|
|
||||||
>
|
|
||||||
npm publish --registry http://localhost
|
|
||||||
</span>
|
|
||||||
<button
|
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-4 emotion-5"
|
|
||||||
tabindex="0"
|
|
||||||
title="Copy to Clipboard"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="MuiIconButton-label"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
class="MuiSvgIcon-root"
|
|
||||||
focusable="false"
|
|
||||||
role="presentation"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
class="MuiTouchRipple-root"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p
|
|
||||||
class="MuiTypography-root MuiTypography-body2"
|
|
||||||
>
|
|
||||||
3. Refresh this page.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="MuiCardActions-root MuiCardActions-spacing"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
aria-disabled="false"
|
|
||||||
class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-textSizeSmall MuiButton-sizeSmall"
|
|
||||||
href="https://verdaccio.org/docs/en/installation"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="MuiButton-label"
|
|
||||||
>
|
|
||||||
Learn More
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
class="MuiTouchRipple-root"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ import { default as Typography } from '../../muiComponents/Heading';
|
|||||||
import Card from '../../muiComponents/Card';
|
import Card from '../../muiComponents/Card';
|
||||||
|
|
||||||
export const CardStyled = styled(Card)({
|
export const CardStyled = styled(Card)({
|
||||||
width: 600,
|
'&&': {
|
||||||
margin: 'auto',
|
width: '600px',
|
||||||
|
margin: 'auto',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const HelpTitle = styled(Typography)({
|
export const HelpTitle = styled(Typography)({
|
||||||
marginBottom: 20,
|
'&&': {
|
||||||
|
marginBottom: '20px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Icon from './Icon';
|
import Icon from './Icon';
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ describe('<Icon /> component', () => {
|
|||||||
name: 'austria',
|
name: 'austria',
|
||||||
};
|
};
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<Icon name={props.name} />);
|
const wrapper = shallow(<Icon name={props.name} />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -63,11 +63,10 @@ export interface Props {
|
|||||||
modifiers?: null | undefined;
|
modifiers?: null | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable verdaccio/jsx-spread */
|
|
||||||
const Icon: React.FC<Props> = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => {
|
const Icon: React.FC<Props> = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => {
|
||||||
const title = capitalize(name.toString());
|
const title = capitalize(name.toString());
|
||||||
return img ? (
|
return img ? (
|
||||||
<ImgWrapper className={className} pointer={pointer} size={size} title={title} {...props}>
|
<ImgWrapper className={className} name={name} pointer={pointer} size={size} title={title} {...props}>
|
||||||
<Img alt={title} src={Icons[name]} />
|
<Img alt={title} src={Icons[name]} />
|
||||||
</ImgWrapper>
|
</ImgWrapper>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,22 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Icon /> component should render the component in default state 1`] = `
|
exports[`<Icon /> component should render the component in default state 1`] = `"<svg class=\\"css-j2zgvv ek145dl0\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg>"`;
|
||||||
.emotion-0 {
|
|
||||||
box-sizing: initial;
|
|
||||||
display: inline-block;
|
|
||||||
cursor: default;
|
|
||||||
width: 14px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
<svg
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
>
|
|
||||||
<title>
|
|
||||||
Austria
|
|
||||||
</title>
|
|
||||||
<use
|
|
||||||
xlink:href="[object Object]#austria"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
|
import { css } from '@emotion/core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
||||||
|
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
||||||
|
|
||||||
const getSize = (size: Breakpoint): { width: number; height: number } => {
|
const getSize = (size: Breakpoint): string => {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 'md':
|
case 'md':
|
||||||
return {
|
return `
|
||||||
width: 18,
|
width: 18px;
|
||||||
height: 18,
|
height: 18px;
|
||||||
};
|
`;
|
||||||
default:
|
default:
|
||||||
return {
|
return `
|
||||||
width: 14,
|
width: 14px;
|
||||||
height: 16,
|
height: 16px;
|
||||||
};
|
`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
interface CommonStyleProps {
|
const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }) => css`
|
||||||
size: Breakpoint;
|
&& {
|
||||||
pointer?: boolean;
|
display: inline-block;
|
||||||
}
|
cursor: ${pointer ? 'pointer' : 'Developers'};
|
||||||
const commonStyle = ({ size = 'sm', pointer }: CommonStyleProps): object => ({
|
${getSize(size)};
|
||||||
display: 'inline-block',
|
${modifiers && modifiers};
|
||||||
cursor: pointer ? 'pointer' : 'default',
|
}
|
||||||
...getSize(size),
|
`;
|
||||||
});
|
|
||||||
|
|
||||||
export const Svg = styled('svg')<CommonStyleProps>(props => ({
|
export const Svg = styled('svg')`
|
||||||
boxSizing: 'initial',
|
${commonStyle};
|
||||||
...commonStyle(props),
|
box-sizing: initial;
|
||||||
}));
|
`;
|
||||||
|
|
||||||
export const ImgWrapper = styled('span')<CommonStyleProps>(props => ({
|
export const ImgWrapper = styled('span')`
|
||||||
boxSizing: 'initial',
|
${commonStyle};
|
||||||
...commonStyle(props),
|
box-sizing: initial;
|
||||||
}));
|
`;
|
||||||
|
|
||||||
export const Img = styled('img')({
|
export const Img = styled('img')({
|
||||||
width: '100%',
|
'&&': {
|
||||||
height: 'auto',
|
width: '100%',
|
||||||
|
height: 'auto',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
||||||
|
|
||||||
import data from './__partials__/data.json';
|
import data from './__partials__/data.json';
|
||||||
|
|||||||
@@ -1,71 +1,24 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Install /> renders correctly 1`] = `
|
exports[`<Install /> renders correctly 1`] = `
|
||||||
.emotion-0 {
|
|
||||||
font-weight: 700;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12 {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-12:hover {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
border-radius: 0px;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-10 {
|
|
||||||
padding: 0 10px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-8 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
-webkit-box-pack: justify;
|
|
||||||
-webkit-justify-content: space-between;
|
|
||||||
-ms-flex-pack: justify;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-4 {
|
|
||||||
display: inline-block;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
height: 21px;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
<ul
|
<ul
|
||||||
class="MuiList-root MuiList-padding MuiList-subheader"
|
class="MuiList-root MuiList-padding MuiList-subheader"
|
||||||
data-testid="installList"
|
data-testid="installList"
|
||||||
>
|
>
|
||||||
<h6
|
<h6
|
||||||
class="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
class="MuiTypography-root css-b8upko emotion-0 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
Installation
|
Installation
|
||||||
</h6>
|
</h6>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
||||||
data-testid="installListItem-npm"
|
data-testid="installListItem-npm"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="npm"
|
alt="npm"
|
||||||
@@ -74,21 +27,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-8 emotion-9"
|
class="css-1mta3t8 emotion-4"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="emotion-4 emotion-5"
|
class="css-lh0wgu emotion-2"
|
||||||
>
|
>
|
||||||
npm install foo
|
npm install foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -126,13 +79,13 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
||||||
data-testid="installListItem-yarn"
|
data-testid="installListItem-yarn"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="yarn"
|
alt="yarn"
|
||||||
@@ -141,21 +94,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-8 emotion-9"
|
class="css-1mta3t8 emotion-4"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="emotion-4 emotion-5"
|
class="css-lh0wgu emotion-2"
|
||||||
>
|
>
|
||||||
yarn add foo
|
yarn add foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -193,13 +146,13 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
||||||
data-testid="installListItem-pnpm"
|
data-testid="installListItem-pnpm"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="pnpm"
|
alt="pnpm"
|
||||||
@@ -208,21 +161,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="emotion-8 emotion-9"
|
class="css-1mta3t8 emotion-4"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="emotion-4 emotion-5"
|
class="css-lh0wgu emotion-2"
|
||||||
>
|
>
|
||||||
pnpm install foo
|
pnpm install foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Label from './Label';
|
import Label from './Label';
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ describe('<Label /> component', () => {
|
|||||||
text: 'test',
|
text: 'test',
|
||||||
};
|
};
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<Label text={props.text} />);
|
const wrapper = mount(<Label text={props.text} />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,17 +7,19 @@ interface Props {
|
|||||||
text: string;
|
text: string;
|
||||||
capitalize?: boolean;
|
capitalize?: boolean;
|
||||||
weight?: string;
|
weight?: string;
|
||||||
|
modifiers?: null | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WrapperProps {
|
interface WrapperProps {
|
||||||
capitalize: boolean;
|
capitalize: boolean;
|
||||||
weight: string;
|
weight: string;
|
||||||
|
modifiers?: null;
|
||||||
}
|
}
|
||||||
|
const Wrapper = styled('div')`
|
||||||
const Wrapper = styled('div')<WrapperProps>(props => ({
|
font-weight: ${({ weight }: WrapperProps) => fontWeight[weight]};
|
||||||
fontWeight: fontWeight[props.weight],
|
text-transform: ${({ capitalize }: WrapperProps) => (capitalize ? 'capitalize' : 'none')};
|
||||||
textTransform: props.capitalize ? 'capitalize' : 'none',
|
${({ modifiers }: WrapperProps) => modifiers};
|
||||||
}));
|
`;
|
||||||
|
|
||||||
const Label: React.FC<Props> = ({ text = '', capitalize = false, weight = 'regular', ...props }) => {
|
const Label: React.FC<Props> = ({ text = '', capitalize = false, weight = 'regular', ...props }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,14 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Label /> component should render the component in default state 1`] = `
|
exports[`<Label /> component should render the component in default state 1`] = `"<div class=\\"css-1xfhjjm esyufg60\\">test</div>"`;
|
||||||
.emotion-0 {
|
|
||||||
font-weight: 400;
|
|
||||||
text-transform: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
>
|
|
||||||
test
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,29 +1,33 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { Theme } from '../../design-tokens/theme';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const Content = styled('div')<{ theme?: Theme }>(props => ({
|
export const Content = styled('div')({
|
||||||
backgroundColor: props.theme && props.theme.palette.white,
|
'&&': {
|
||||||
flex: 1,
|
backgroundColor: colors.white,
|
||||||
display: 'flex',
|
flex: 1,
|
||||||
position: 'relative',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
position: 'relative',
|
||||||
}));
|
flexDirection: 'column',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
interface ContainerProps {
|
interface ContainerProps {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Container = styled('div')<ContainerProps>(props => ({
|
export const Container = styled('div')`
|
||||||
display: 'flex',
|
&& {
|
||||||
flexDirection: 'column',
|
display: flex;
|
||||||
minHeight: '100vh',
|
flex-direction: column;
|
||||||
overflow: 'hidden',
|
min-height: 100vh;
|
||||||
...(props.isLoading &&
|
overflow: hidden;
|
||||||
css`
|
${({ isLoading }: ContainerProps) =>
|
||||||
${Content} {
|
isLoading &&
|
||||||
background-color: #f5f6f8;
|
css`
|
||||||
}
|
${Content} {
|
||||||
`),
|
background-color: #f5f6f8;
|
||||||
}));
|
}
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Loading from './Loading';
|
import Loading from './Loading';
|
||||||
|
|
||||||
describe('<Loading /> component', () => {
|
describe('<Loading /> component', () => {
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<Loading />);
|
const wrapper = shallow(<Loading />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,86 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Loading /> component should render the component in default state 1`] = `
|
exports[`<Loading /> component should render the component in default state 1`] = `"<div data-testid=\\"loading\\" class=\\"css-1221txa eimgwje0\\"><div class=\\"css-bxochs eimgwje1\\"><div class=\\"css-ge0nak em793ed0\\"></div></div><div class=\\"css-vqrgi e1ag4h8b0\\"><div class=\\"MuiCircularProgress-root css-15gl0ho e1ag4h8b1 MuiCircularProgress-colorPrimary MuiCircularProgress-indeterminate\\" style=\\"width:50px;height:50px\\" role=\\"progressbar\\"><svg class=\\"MuiCircularProgress-svg\\" viewBox=\\"22 22 44 44\\"><circle class=\\"MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate\\" cx=\\"44\\" cy=\\"44\\" r=\\"20.2\\" fill=\\"none\\" stroke-width=\\"3.6\\"></circle></svg></div></div></div>"`;
|
||||||
.emotion-8 {
|
|
||||||
-webkit-transform: translate(-50%,-50%);
|
|
||||||
-ms-transform: translate(-50%,-50%);
|
|
||||||
transform: translate(-50%,-50%);
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
margin: 0 0 30px 0;
|
|
||||||
border-radius: 25px;
|
|
||||||
box-shadow: 0 10px 20px 0 rgba(69,58,100,0.2);
|
|
||||||
background: #f7f8f6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-0 {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-position: center;
|
|
||||||
background-size: contain;
|
|
||||||
background-image: url([object Object]);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 90px;
|
|
||||||
height: 90px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-6 {
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-box-align: center;
|
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
|
||||||
-webkit-box-pack: center;
|
|
||||||
-webkit-justify-content: center;
|
|
||||||
-ms-flex-pack: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-4 {
|
|
||||||
color: #4b5e40;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="emotion-8 emotion-9"
|
|
||||||
data-testid="loading"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="emotion-2 emotion-3"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="emotion-6 emotion-7"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="MuiCircularProgress-root emotion-4 emotion-5 MuiCircularProgress-colorPrimary MuiCircularProgress-indeterminate"
|
|
||||||
role="progressbar"
|
|
||||||
style="width: 50px; height: 50px;"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="MuiCircularProgress-svg"
|
|
||||||
viewBox="22 22 44 44"
|
|
||||||
>
|
|
||||||
<circle
|
|
||||||
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate"
|
|
||||||
cx="44"
|
|
||||||
cy="44"
|
|
||||||
fill="none"
|
|
||||||
r="20.2"
|
|
||||||
stroke-width="3.6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled('div')({
|
export const Wrapper = styled('div')`
|
||||||
transform: 'translate(-50%, -50%)',
|
&& {
|
||||||
top: '50%',
|
transform: translate(-50%, -50%);
|
||||||
left: '50%',
|
top: 50%;
|
||||||
position: 'absolute',
|
left: 50%;
|
||||||
});
|
position: absolute;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const Badge = styled('div')({
|
export const Badge = styled('div')`
|
||||||
margin: '0 0 30px 0',
|
&& {
|
||||||
borderRadius: 25,
|
margin: 0 0 30px 0;
|
||||||
boxShadow: '0 10px 20px 0 rgba(69, 58, 100, 0.2)',
|
border-radius: 25px;
|
||||||
background: '#f7f8f6',
|
box-shadow: 0 10px 20px 0 rgba(69, 58, 100, 0.2);
|
||||||
});
|
background: #f7f8f6;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import LoginModal from './Login';
|
import LoginModal from './Login';
|
||||||
|
|
||||||
@@ -67,7 +66,7 @@ describe('<LoginModal />', () => {
|
|||||||
onCancel: () => {},
|
onCancel: () => {},
|
||||||
onSubmit: () => {},
|
onSubmit: () => {},
|
||||||
};
|
};
|
||||||
const wrapper = mount(<LoginModal {...props} />);
|
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
||||||
const { setCredentials } = wrapper.instance();
|
const { setCredentials } = wrapper.instance();
|
||||||
|
|
||||||
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
||||||
@@ -84,7 +83,7 @@ describe('<LoginModal />', () => {
|
|||||||
onSubmit: jest.fn(),
|
onSubmit: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = mount(<LoginModal {...props} />);
|
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
||||||
const instance = wrapper.instance();
|
const instance = wrapper.instance();
|
||||||
|
|
||||||
instance.submitCredentials = jest.fn();
|
instance.submitCredentials = jest.fn();
|
||||||
@@ -109,7 +108,7 @@ describe('<LoginModal />', () => {
|
|||||||
onSubmit: jest.fn(),
|
onSubmit: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = mount(<LoginModal {...props} />);
|
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
||||||
const { setCredentials, submitCredentials } = wrapper.instance();
|
const { setCredentials, submitCredentials } = wrapper.instance();
|
||||||
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
||||||
expect(wrapper.state('form').username.value).toEqual('xyz');
|
expect(wrapper.state('form').username.value).toEqual('xyz');
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import ErrorIcon from '@material-ui/icons/Error';
|
import ErrorIcon from '@material-ui/icons/Error';
|
||||||
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
import Dialog from '../../muiComponents/Dialog';
|
import Dialog from '../../muiComponents/Dialog';
|
||||||
@@ -204,9 +205,9 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
|
|||||||
} = this.state;
|
} = this.state;
|
||||||
return (
|
return (
|
||||||
<FormControl
|
<FormControl
|
||||||
// className={css`
|
className={css`
|
||||||
// margin-top: 8px;
|
margin-top: 8px;
|
||||||
// `}
|
`}
|
||||||
error={!password.value && !password.pristine}
|
error={!password.value && !password.pristine}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
required={password.required}>
|
required={password.required}>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<LoginModal /> should load the component in default state 1`] = `"<div role=\\"presentation\\" class=\\"MuiDialog-root\\" id=\\"login--form-container\\" style=\\"position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;\\"><div class=\\"MuiBackdrop-root\\" aria-hidden=\\"true\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\"></div><div tabindex=\\"0\\" data-test=\\"sentinelStart\\"></div><div class=\\"MuiDialog-container MuiDialog-scrollPaper\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\" role=\\"none presentation\\" tabindex=\\"-1\\"><div class=\\"MuiPaper-root MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXs MuiDialog-paperFullWidth MuiPaper-rounded\\" role=\\"dialog\\"><form novalidate=\\"\\"><div class=\\"MuiDialogTitle-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h6\\">Login</h2></div><div class=\\"MuiDialogContent-root\\"><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"username\\">Username<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
exports[`<LoginModal /> should load the component in default state 1`] = `"<div role=\\"presentation\\" class=\\"MuiDialog-root\\" id=\\"login--form-container\\" style=\\"position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;\\"><div class=\\"MuiBackdrop-root\\" aria-hidden=\\"true\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\"></div><div tabindex=\\"0\\" data-test=\\"sentinelStart\\"></div><div class=\\"MuiDialog-container MuiDialog-scrollPaper\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\" role=\\"none presentation\\" tabindex=\\"-1\\"><div class=\\"MuiPaper-root MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXs MuiDialog-paperFullWidth MuiPaper-rounded\\" role=\\"dialog\\"><form novalidate=\\"\\"><div class=\\"MuiDialogTitle-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h6\\">Login</h2></div><div class=\\"MuiDialogContent-root\\"><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"username\\">Username<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div><div class=\\"MuiFormControl-root css-164r41r MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
||||||
|
|
||||||
exports[`<LoginModal /> should load the component with props 1`] = `"<div role=\\"presentation\\" class=\\"MuiDialog-root\\" id=\\"login--form-container\\" style=\\"position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;\\"><div class=\\"MuiBackdrop-root\\" aria-hidden=\\"true\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\"></div><div tabindex=\\"0\\" data-test=\\"sentinelStart\\"></div><div class=\\"MuiDialog-container MuiDialog-scrollPaper\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\" role=\\"none presentation\\" tabindex=\\"-1\\"><div class=\\"MuiPaper-root MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXs MuiDialog-paperFullWidth MuiPaper-rounded\\" role=\\"dialog\\"><form novalidate=\\"\\"><div class=\\"MuiDialogTitle-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h6\\">Login</h2></div><div class=\\"MuiDialogContent-root\\"><div class=\\"MuiTypography-root MuiPaper-root MuiPaper-elevation6 MuiSnackbarContent-root css-xlgaf-loginError MuiTypography-body2\\" role=\\"alert\\"><div class=\\"MuiSnackbarContent-message\\"><div class=\\"css-vvv32-loginErrorMsg\\" id=\\"client-snackbar\\"><svg class=\\"MuiSvgIcon-root css-tkvt8h-loginIcon\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\\"></path></svg><span><div><strong>Error Title</strong></div><div>Error Description</div></span></div></div></div><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"username\\">Username<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
exports[`<LoginModal /> should load the component with props 1`] = `"<div role=\\"presentation\\" class=\\"MuiDialog-root\\" id=\\"login--form-container\\" style=\\"position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;\\"><div class=\\"MuiBackdrop-root\\" aria-hidden=\\"true\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\"></div><div tabindex=\\"0\\" data-test=\\"sentinelStart\\"></div><div class=\\"MuiDialog-container MuiDialog-scrollPaper\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\" role=\\"none presentation\\" tabindex=\\"-1\\"><div class=\\"MuiPaper-root MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXs MuiDialog-paperFullWidth MuiPaper-rounded\\" role=\\"dialog\\"><form novalidate=\\"\\"><div class=\\"MuiDialogTitle-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h6\\">Login</h2></div><div class=\\"MuiDialogContent-root\\"><div class=\\"MuiTypography-root MuiPaper-root MuiPaper-elevation6 MuiSnackbarContent-root css-11e09xf MuiTypography-body2\\" role=\\"alert\\"><div class=\\"MuiSnackbarContent-message\\"><div class=\\"css-70qvj9\\" id=\\"client-snackbar\\"><svg class=\\"MuiSvgIcon-root css-1mbwbu9\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\\"></path></svg><span><div><strong>Error Title</strong></div><div>Error Description</div></span></div></div></div><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"username\\">Username<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div><div class=\\"MuiFormControl-root css-164r41r MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import { theme } from '../../design-tokens/theme';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
export const loginDialog = css({
|
export const loginDialog = css({
|
||||||
minWidth: '300px',
|
minWidth: '300px',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const loginError = css({
|
export const loginError = css({
|
||||||
backgroundColor: `${theme.palette.red} !important`,
|
backgroundColor: `${colors.red} !important`,
|
||||||
minWidth: 'inherit !important',
|
minWidth: 'inherit !important',
|
||||||
marginBottom: '10px !important',
|
marginBottom: '10px !important',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Logo from './Logo';
|
import Logo from './Logo';
|
||||||
|
|
||||||
describe('<Logo /> component', () => {
|
describe('<Logo /> component', () => {
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<Logo />);
|
const wrapper = shallow(<Logo />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,18 +12,19 @@ interface Props {
|
|||||||
size?: Size;
|
size?: Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledLogo = styled('div')<Props>(props => ({
|
const StyledLogo = styled('div')<Props>`
|
||||||
display: 'inline-block',
|
&& {
|
||||||
verticalAlign: 'middle',
|
display: inline-block;
|
||||||
boxSizing: 'border-box',
|
vertical-align: middle;
|
||||||
backgroundPosition: 'center',
|
box-sizing: border-box;
|
||||||
backgroundSize: 'contain',
|
background-position: center;
|
||||||
backgroundImage: `url(${logo})`,
|
background-size: contain;
|
||||||
backgroundRepeat: ' no-repeat',
|
background-image: url(${logo});
|
||||||
width: props.size,
|
background-repeat: no-repeat;
|
||||||
height: props.size,
|
width: ${({ size }) => size};
|
||||||
}));
|
height: ${({ size }) => size};
|
||||||
|
}
|
||||||
|
`;
|
||||||
const Logo: React.FC<Props> = ({ size = Size.Small }) => {
|
const Logo: React.FC<Props> = ({ size = Size.Small }) => {
|
||||||
return <StyledLogo size={size} />;
|
return <StyledLogo size={size} />;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,19 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Logo /> component should render the component in default state 1`] = `
|
exports[`<Logo /> component should render the component in default state 1`] = `"<div class=\\"css-1sifsqk em793ed0\\"></div>"`;
|
||||||
.emotion-0 {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-position: center;
|
|
||||||
background-size: contain;
|
|
||||||
background-image: url([object Object]);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
/>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow, mount } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import NoItems from './NoItems';
|
import NoItems from './NoItems';
|
||||||
|
|
||||||
|
console.error = jest.fn();
|
||||||
|
|
||||||
describe('<NoItem /> component', () => {
|
describe('<NoItem /> component', () => {
|
||||||
const props = {
|
const props = {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
};
|
};
|
||||||
|
|
||||||
test('should load the component in default state', () => {
|
test('should load the component in default state', () => {
|
||||||
const { container } = render(<NoItems text={props.text} />);
|
const wrapper = shallow(<NoItems text={props.text} />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should set html from props', () => {
|
||||||
|
const props = {
|
||||||
|
text: 'This is a test string',
|
||||||
|
};
|
||||||
|
const wrapper = mount(<NoItems text={props.text} />);
|
||||||
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<NoItem /> component should load the component in default state 1`] = `
|
exports[`<NoItem /> component should load the component in default state 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">test</h6>"`;
|
||||||
<h6
|
|
||||||
class="MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom"
|
exports[`<NoItem /> component should set html from props 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">This is a test string</h6>"`;
|
||||||
>
|
|
||||||
test
|
|
||||||
</h6>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { useHistory } from 'react-router-dom';
|
|||||||
import Box from '../../muiComponents/Box';
|
import Box from '../../muiComponents/Box';
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
import Heading from '../../muiComponents/Heading';
|
import Heading from '../../muiComponents/Heading';
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import { spacings } from '../../utils/styles/spacings';
|
import { spacings } from '../../utils/styles/spacings';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
import PackageImg from './img/package.svg';
|
import PackageImg from './img/package.svg';
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@ const EmptyPackage = styled('img')({
|
|||||||
margin: '0 auto',
|
margin: '0 auto',
|
||||||
});
|
});
|
||||||
|
|
||||||
const StyledHeading = styled(Heading)<{ theme?: Theme }>(props => ({
|
const StyledHeading = styled(Heading)({
|
||||||
color: props.theme && props.theme.palette.primary.main,
|
color: colors.primary,
|
||||||
marginBottom: spacings.sm,
|
marginBottom: spacings.sm,
|
||||||
}));
|
});
|
||||||
|
|
||||||
const NotFound: React.FC = () => {
|
const NotFound: React.FC = () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
|
import { render, fireEvent } from '@testing-library/react';
|
||||||
import { render, fireEvent } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import NotFound, { GO_TO_HOME_PAGE } from './NotFound';
|
import NotFound, { GO_TO_HOME_PAGE } from './NotFound';
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,17 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<NotFound /> component should load the component in default state 1`] = `
|
exports[`<NotFound /> component should load the component in default state 1`] = `
|
||||||
.emotion-0 {
|
|
||||||
width: 150px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emotion-2 {
|
|
||||||
color: #4b5e40;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="MuiBox-root MuiBox-root-2"
|
class="MuiBox-root MuiBox-root-2"
|
||||||
data-testid="404"
|
data-testid="404"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="404 - Page not found"
|
alt="404 - Page not found"
|
||||||
class="emotion-0 emotion-1"
|
class="css-17y48z2 emotion-0"
|
||||||
src="[object Object]"
|
src="[object Object]"
|
||||||
/>
|
/>
|
||||||
<h4
|
<h4
|
||||||
class="MuiTypography-root not-found-text emotion-2 emotion-3 MuiTypography-h4"
|
class="MuiTypography-root not-found-text css-7pe7kh emotion-1 MuiTypography-h4"
|
||||||
>
|
>
|
||||||
Sorry, we couldn't find it...
|
Sorry, we couldn't find it...
|
||||||
</h4>
|
</h4>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
import { shallow } from '../../utils/test-enzyme';
|
|
||||||
import Tag from '../Tag';
|
import Tag from '../Tag';
|
||||||
|
|
||||||
import Package from './Package';
|
import Package from './Package';
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
|
|||||||
import { breakpoints } from '../../utils/styles/media';
|
import { breakpoints } from '../../utils/styles/media';
|
||||||
import Ico from '../Icon';
|
import Ico from '../Icon';
|
||||||
import Label from '../Label';
|
import Label from '../Label';
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import { default as MuiIconButton } from '../../muiComponents/IconButton';
|
import { default as MuiIconButton } from '../../muiComponents/IconButton';
|
||||||
import { default as Photo } from '../../muiComponents/Avatar';
|
import { default as Photo } from '../../muiComponents/Avatar';
|
||||||
@@ -11,115 +12,147 @@ import List from '../../muiComponents/List';
|
|||||||
import { default as Typography } from '../../muiComponents/Heading';
|
import { default as Typography } from '../../muiComponents/Heading';
|
||||||
import Grid from '../../muiComponents/Grid';
|
import Grid from '../../muiComponents/Grid';
|
||||||
import ListItemText from '../../muiComponents/ListItemText';
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export const OverviewItem = styled('span')<{ theme?: Theme }>(props => ({
|
export const OverviewItem = styled('span')`
|
||||||
display: 'flex',
|
&& {
|
||||||
alignItems: 'center',
|
display: flex;
|
||||||
margin: '0 0 0 16px',
|
align-items: center;
|
||||||
color: props.theme && props.theme.palette.greyLight2,
|
margin: 0 0 0 16px;
|
||||||
fontSize: 12,
|
color: ${colors.greyLight2};
|
||||||
[`@media (max-width: ${breakpoints.medium}px)`]: {
|
font-size: 12px;
|
||||||
':nth-of-type(3)': {
|
@media (max-width: ${breakpoints.medium}px) {
|
||||||
display: 'none',
|
&:nth-child(3) {
|
||||||
},
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: ${breakpoints.small}px) {
|
||||||
|
&:nth-child(4) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const Icon = styled(Ico)({
|
||||||
|
'&&': {
|
||||||
|
margin: '2px 10px 0 0',
|
||||||
|
fill: colors.greyLight2,
|
||||||
},
|
},
|
||||||
[`@media (max-width: ${breakpoints.small}px)`]: {
|
});
|
||||||
':nth-of-type(4)': {
|
|
||||||
display: 'none',
|
export const Published = styled('span')({
|
||||||
},
|
'&&': {
|
||||||
|
color: colors.greyLight2,
|
||||||
|
margin: '0 5px 0 0',
|
||||||
},
|
},
|
||||||
}));
|
});
|
||||||
|
|
||||||
export const Icon = styled(Ico)<{ theme?: Theme }>(props => ({
|
export const Text = styled(Label)({
|
||||||
margin: '2px 10px 0 0',
|
'&&': {
|
||||||
fill: props.theme && props.theme.palette.greyLight2,
|
fontSize: '12px',
|
||||||
}));
|
fontWeight: fontWeight.semiBold,
|
||||||
|
color: colors.greyLight2,
|
||||||
export const Published = styled('span')<{ theme?: Theme }>(props => ({
|
},
|
||||||
color: props.theme && props.theme.palette.greyLight2,
|
});
|
||||||
margin: '0 5px 0 0',
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const Text = styled(Label)<{ theme?: Theme }>(props => ({
|
|
||||||
fontSize: '12px',
|
|
||||||
fontWeight: fontWeight.semiBold,
|
|
||||||
color: props.theme && props.theme.palette.greyLight2,
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const Details = styled('span')({
|
export const Details = styled('span')({
|
||||||
marginLeft: '5px',
|
'&&': {
|
||||||
lineHeight: 1.5,
|
marginLeft: '5px',
|
||||||
display: 'flex',
|
lineHeight: 1.5,
|
||||||
flexDirection: 'column',
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Author = styled('div')({
|
export const Author = styled('div')({
|
||||||
display: 'flex',
|
'&&': {
|
||||||
alignItems: 'center',
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Avatar = styled(Photo)({
|
export const Avatar = styled(Photo)({
|
||||||
width: '20px',
|
'&&': {
|
||||||
height: '20px',
|
width: '20px',
|
||||||
|
height: '20px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const WrapperLink = styled(Link)({
|
export const WrapperLink = styled(Link)({
|
||||||
textDecoration: 'none',
|
'&&': {
|
||||||
|
textDecoration: 'none',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PackageTitle = styled('span')<{ theme?: Theme }>(props => ({
|
export const PackageTitle = styled('span')`
|
||||||
fontWeight: 600,
|
&& {
|
||||||
fontSize: 20,
|
font-weight: 600;
|
||||||
display: 'block',
|
font-size: 20px;
|
||||||
marginBottom: 12,
|
display: block;
|
||||||
color: props.theme && props.theme.palette.eclipse,
|
margin-bottom: 12px;
|
||||||
cursor: 'pointer',
|
color: ${colors.eclipse};
|
||||||
':hover': {
|
cursor: pointer;
|
||||||
color: props.theme && props.theme.palette.black,
|
|
||||||
},
|
&:hover {
|
||||||
[`@media (max-width: ${breakpoints.small}px)`]: {
|
color: ${colors.black};
|
||||||
fontSize: 14,
|
}
|
||||||
marginBottom: 8,
|
|
||||||
},
|
@media (max-width: ${breakpoints.small}px) {
|
||||||
}));
|
font-size: 14px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const GridRightAligned = styled(Grid)({
|
export const GridRightAligned = styled(Grid)({
|
||||||
textAlign: 'right',
|
'&&': {
|
||||||
|
textAlign: 'right',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PackageList = styled(List)<{ theme?: Theme }>(props => ({
|
export const PackageList = styled(List)({
|
||||||
padding: '12px 0 12px 0',
|
'&&': {
|
||||||
':hover': {
|
padding: '12px 0 12px 0',
|
||||||
backgroundColor: props.theme && props.theme.palette.greyLight3,
|
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: colors.greyLight3,
|
||||||
|
},
|
||||||
|
|
||||||
|
'> :last-child': {
|
||||||
|
paddingTop: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'> :last-child': {
|
});
|
||||||
paddingTop: 0,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const IconButton = styled(MuiIconButton)({
|
export const IconButton = styled(MuiIconButton)({
|
||||||
padding: 6,
|
'&&': {
|
||||||
svg: {
|
padding: '6px',
|
||||||
fontSize: 16,
|
|
||||||
|
svg: {
|
||||||
|
fontSize: '16px',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TagContainer = styled('span')({
|
export const TagContainer = styled('span')`
|
||||||
marginTop: 8,
|
&& {
|
||||||
marginBottom: 12,
|
margin-top: 8px;
|
||||||
display: 'block',
|
margin-bottom: 12px;
|
||||||
[`@media (max-width: ${breakpoints.medium}px)`]: {
|
display: block;
|
||||||
display: 'none',
|
@media (max-width: ${breakpoints.medium}px) {
|
||||||
},
|
display: none;
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const PackageListItemText = styled(ListItemText)({
|
export const PackageListItemText = styled(ListItemText)({
|
||||||
paddingRight: 0,
|
'&&': {
|
||||||
|
paddingRight: 0,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Description = styled(Typography)<{ theme?: Theme }>(props => ({
|
export const Description = styled(Typography)({
|
||||||
color: props.theme && props.theme.palette.greyDark2,
|
color: colors.greyDark2,
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import Help from '../Help';
|
import Help from '../Help';
|
||||||
|
|
||||||
import { PackageList } from './PackageList';
|
import { PackageList } from './PackageList';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import Readme from './Readme';
|
import Readme from './Readme';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render, cleanup, fireEvent } from '@testing-library/react';
|
||||||
import { render, cleanup, fireEvent } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import RegistryInfoContent from './RegistryInfoContent';
|
import RegistryInfoContent from './RegistryInfoContent';
|
||||||
|
|
||||||
|
|||||||
@@ -47,13 +47,7 @@ const RegistryInfoContent: React.FC<Props> = props => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tabs
|
<Tabs data-testid={'tabs-el'} indicatorColor="primary" onChange={handleChange} textColor="primary" value={tabPosition} variant="fullWidth">
|
||||||
data-testid={'tabs-el'}
|
|
||||||
indicatorColor="primary"
|
|
||||||
onChange={handleChange}
|
|
||||||
textColor="primary"
|
|
||||||
value={tabPosition}
|
|
||||||
variant="fullWidth">
|
|
||||||
<Tab data-testid={'npm-tab'} label={NODE_MANAGER.npm} />
|
<Tab data-testid={'npm-tab'} label={NODE_MANAGER.npm} />
|
||||||
<Tab data-testid={'pnpm-tab'} label={NODE_MANAGER.pnpm} />
|
<Tab data-testid={'pnpm-tab'} label={NODE_MANAGER.pnpm} />
|
||||||
<Tab data-testid={'yarn-tab'} label={NODE_MANAGER.yarn} />
|
<Tab data-testid={'yarn-tab'} label={NODE_MANAGER.yarn} />
|
||||||
@@ -70,10 +64,10 @@ const RegistryInfoContent: React.FC<Props> = props => {
|
|||||||
return (
|
return (
|
||||||
<CommandContainer>
|
<CommandContainer>
|
||||||
<Typography
|
<Typography
|
||||||
// className={css`
|
className={css`
|
||||||
// padding: 0;
|
padding: 0;
|
||||||
// min-height: 170;
|
min-height: 170;
|
||||||
// `}
|
`}
|
||||||
component="div">
|
component="div">
|
||||||
{children}
|
{children}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const CommandContainer = styled('div')({
|
export const CommandContainer = styled('div')({
|
||||||
paddingTop: 20,
|
'&&': {
|
||||||
|
paddingTop: '20px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontSize } from '../../utils/styles/sizes';
|
import { fontSize } from '../../utils/styles/sizes';
|
||||||
import DialogTitle from '../../muiComponents/DialogTitle';
|
import DialogTitle from '../../muiComponents/DialogTitle';
|
||||||
import DialogContent from '../../muiComponents/DialogContent';
|
import DialogContent from '../../muiComponents/DialogContent';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export const Title = styled(DialogTitle)<{ theme?: Theme }>(props => ({
|
export const Title = styled(DialogTitle)({
|
||||||
backgroundColor: props.theme && props.theme.palette.primary.main,
|
backgroundColor: colors.primary,
|
||||||
color: props.theme && props.theme.palette.white,
|
color: colors.white,
|
||||||
fontSize: fontSize.lg,
|
fontSize: fontSize.lg,
|
||||||
}));
|
});
|
||||||
|
|
||||||
export const Content = styled(DialogContent)({
|
export const Content = styled(DialogContent)({
|
||||||
padding: '0 24px',
|
padding: '0 24px',
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import Repository from './Repository';
|
import Repository from './Repository';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Repository /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-dense MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-1na337r-StyledText e1wmjxnh0 MuiTypography-subtitle1\\">Repository</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-719o4l-RepositoryListItem e1wmjxnh4 MuiListItem-dense MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root css-1lp4n02-RepositoryListItemText e1wmjxnh5 MuiListItemText-dense\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body2\\"><div class=\\"css-1in239f-ClipBoardCopy eb8w2fo0\\"><span class=\\"css-7gar9h-ClipBoardCopyText eb8w2fo1\\"><a href=\\"git+https://github.com/verdaccio/ui.git\\" target=\\"_blank\\" class=\\"css-6tc7qn-GithubLink e1wmjxnh2\\">git+https://github.com/verdaccio/ui.git</a></span><button class=\\"MuiButtonBase-root MuiIconButton-root css-1fs86cq-CopyIcon eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div></span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Repository /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-dense MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko e1wmjxnh0 MuiTypography-subtitle1\\">Repository</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-xugzlj e1wmjxnh4 MuiListItem-dense MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root css-1vhg3jx e1wmjxnh5 MuiListItemText-dense\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body2\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\"><a href=\\"git+https://github.com/verdaccio/ui.git\\" target=\\"_blank\\" class=\\"css-15gl0ho e1wmjxnh2\\">git+https://github.com/verdaccio/ui.git</a></span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div></span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import Github from '../../icons/GitHub';
|
import Github from '../../icons/GitHub';
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
import ListItemText from '../../muiComponents/ListItemText';
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
import Grid from '../../muiComponents/Grid';
|
import Grid from '../../muiComponents/Grid';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
@@ -17,24 +17,32 @@ export const GridRepo = styled(Grid)({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GithubLink = styled('a')<{ theme?: Theme }>(props => ({
|
export const GithubLink = styled('a')({
|
||||||
color: props.theme && props.theme.palette.primary.main,
|
'&&': {
|
||||||
}));
|
color: colors.primary,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const GithubLogo = styled(Github)<{ theme?: Theme }>(props => ({
|
export const GithubLogo = styled(Github)({
|
||||||
fontSize: 40,
|
'&&': {
|
||||||
color: props.theme && props.theme.palette.primary.main,
|
fontSize: '40px',
|
||||||
backgroundColor: props.theme && props.theme.palette.greySuperLight,
|
color: colors.primary,
|
||||||
}));
|
backgroundColor: colors.greySuperLight,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const RepositoryListItem = styled(ListItem)({
|
export const RepositoryListItem = styled(ListItem)({
|
||||||
padding: 0,
|
'&&': {
|
||||||
':hover': {
|
padding: 0,
|
||||||
|
},
|
||||||
|
'&&:hover': {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const RepositoryListItemText = styled(ListItemText)({
|
export const RepositoryListItemText = styled(ListItemText)({
|
||||||
padding: '0 10px',
|
'&&': {
|
||||||
margin: 0,
|
padding: '0 10px',
|
||||||
|
margin: 0,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount, shallow } from 'enzyme';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import { mount, shallow } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import Search from './Search';
|
import Search from './Search';
|
||||||
|
|
||||||
const SEARCH_FILE_PATH = './Search';
|
const SEARCH_FILE_PATH = './Search';
|
||||||
|
|||||||
@@ -1,32 +1,8 @@
|
|||||||
import React, { KeyboardEvent, Component, ReactElement } from 'react';
|
import React from 'react';
|
||||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
|
||||||
import { SuggestionSelectedEventData, ChangeEvent } from 'react-autosuggest';
|
|
||||||
import styled from '@emotion/styled';
|
|
||||||
import { default as IconSearch } from '@material-ui/icons/Search';
|
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
|
||||||
import InputAdornment from '../../muiComponents/InputAdornment';
|
import AutoComplete from '../../muiComponents/AutoComplete';
|
||||||
import AutoComplete from '../AutoComplete';
|
|
||||||
import { callSearch } from '../../utils/calls';
|
import { callSearch } from '../../utils/calls';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
export interface State {
|
|
||||||
search: string;
|
|
||||||
suggestions: unknown[];
|
|
||||||
loading: boolean;
|
|
||||||
loaded: boolean;
|
|
||||||
error: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type cancelAllSearchRequests = () => void;
|
|
||||||
export type handlePackagesClearRequested = () => void;
|
|
||||||
export type handleSearch = (event: React.FormEvent<HTMLInputElement>, { newValue, method }: ChangeEvent) => void;
|
|
||||||
export type handleClickSearch = (
|
|
||||||
event: KeyboardEvent<HTMLInputElement>,
|
|
||||||
{ suggestionValue, method }: { suggestionValue: object[]; method: string }
|
|
||||||
) => void;
|
|
||||||
export type handleFetchPackages = ({ value: string }) => Promise<void>;
|
|
||||||
export type onBlur = (event: React.FormEvent<HTMLInputElement>) => void;
|
|
||||||
|
|
||||||
const CONSTANTS = {
|
const CONSTANTS = {
|
||||||
API_DELAY: 300,
|
API_DELAY: 300,
|
||||||
@@ -34,168 +10,71 @@ const CONSTANTS = {
|
|||||||
ABORT_ERROR: 'AbortError',
|
ABORT_ERROR: 'AbortError',
|
||||||
};
|
};
|
||||||
|
|
||||||
const StyledInputAdornment = styled(InputAdornment)<{ theme?: Theme }>(props => ({
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
color: props.theme && props.theme.palette.white,
|
const Search: React.FC = () => {
|
||||||
}));
|
const [suggestions, setSuggestions] = React.useState([]);
|
||||||
|
const [isLoading, setIsLoading] = React.useState();
|
||||||
|
const [hasBeenLoaded, setHasBeenLoaded] = React.useState();
|
||||||
|
const [error, setError] = React.useState();
|
||||||
|
|
||||||
export class Search extends Component<RouteComponentProps<{}>, State> {
|
const handleFetchPackages = debounce(async (value: string) => {
|
||||||
constructor(props: RouteComponentProps<{}>) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
search: '',
|
|
||||||
suggestions: [],
|
|
||||||
// loading: A boolean value to indicate that request is in pending state.
|
|
||||||
loading: false,
|
|
||||||
// loaded: A boolean value to indicate that result has been loaded.
|
|
||||||
loaded: false,
|
|
||||||
// error: A boolean value to indicate API error.
|
|
||||||
error: false,
|
|
||||||
};
|
|
||||||
this.requestList = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): ReactElement<HTMLElement> {
|
|
||||||
const { suggestions, search, loaded, loading, error } = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AutoComplete
|
|
||||||
onBlur={this.handleOnBlur}
|
|
||||||
onChange={this.handleSearch}
|
|
||||||
onCleanSuggestions={this.handlePackagesClearRequested}
|
|
||||||
onClick={this.handleClickSearch}
|
|
||||||
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
|
|
||||||
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
|
|
||||||
startAdornment={this.getAdorment()}
|
|
||||||
suggestions={suggestions}
|
|
||||||
suggestionsError={error}
|
|
||||||
suggestionsLoaded={loaded}
|
|
||||||
suggestionsLoading={loading}
|
|
||||||
value={search}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel all the requests which are in pending state.
|
|
||||||
*/
|
|
||||||
private cancelAllSearchRequests: cancelAllSearchRequests = () => {
|
|
||||||
this.requestList.forEach(request => request.abort());
|
|
||||||
this.requestList = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel all the request from list and make request list empty.
|
|
||||||
*/
|
|
||||||
private handlePackagesClearRequested: handlePackagesClearRequested = () => {
|
|
||||||
this.setState({
|
|
||||||
suggestions: [],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onChange method for the input element.
|
|
||||||
*/
|
|
||||||
private handleSearch: handleSearch = (event, { newValue, method }) => {
|
|
||||||
// stops event bubbling
|
|
||||||
event.stopPropagation();
|
|
||||||
if (method === 'type') {
|
|
||||||
const value = newValue.trim();
|
|
||||||
this.setState(
|
|
||||||
{
|
|
||||||
search: value,
|
|
||||||
loading: true,
|
|
||||||
loaded: false,
|
|
||||||
error: false,
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
/**
|
|
||||||
* A use case where User keeps adding and removing value in input field,
|
|
||||||
* so we cancel all the existing requests when input is empty.
|
|
||||||
*/
|
|
||||||
if (value.length === 0) {
|
|
||||||
this.cancelAllSearchRequests();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When an user select any package by clicking or pressing return key.
|
|
||||||
*/
|
|
||||||
private handleClickSearch = (
|
|
||||||
event: React.FormEvent<HTMLInputElement>,
|
|
||||||
{ suggestionValue, method }: SuggestionSelectedEventData<unknown>
|
|
||||||
): void | undefined => {
|
|
||||||
const { history } = this.props;
|
|
||||||
// stops event bubbling
|
|
||||||
event.stopPropagation();
|
|
||||||
switch (method) {
|
|
||||||
case 'click':
|
|
||||||
case 'enter':
|
|
||||||
this.setState({ search: '' });
|
|
||||||
history.push(`/-/web/detail/${suggestionValue}`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch packages from API.
|
|
||||||
* For AbortController see: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
||||||
*/
|
|
||||||
private handleFetchPackages: handleFetchPackages = async ({ value }) => {
|
|
||||||
try {
|
try {
|
||||||
const controller = new window.AbortController();
|
const controller = new window.AbortController();
|
||||||
const signal = controller.signal;
|
const signal = controller.signal;
|
||||||
// Keep track of search requests.
|
// Keep track of search requests.
|
||||||
this.requestList.push(controller);
|
// this.requestList.push(controller);
|
||||||
const suggestions = await callSearch(value, signal);
|
const suggestions = await callSearch(value, signal);
|
||||||
// @ts-ignore
|
setSuggestions(
|
||||||
this.setState({
|
// @ts-ignore
|
||||||
suggestions,
|
suggestions.map(suggestion => ({
|
||||||
loaded: true,
|
...suggestion,
|
||||||
});
|
id: suggestion._id,
|
||||||
|
label: suggestion.name,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
setHasBeenLoaded(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
/**
|
/**
|
||||||
* AbortError is not the API error.
|
* AbortError is not the API error.
|
||||||
* It means browser has cancelled the API request.
|
* It means browser has cancelled the API request.
|
||||||
*/
|
*/
|
||||||
if (error.name === CONSTANTS.ABORT_ERROR) {
|
if (error.name === CONSTANTS.ABORT_ERROR) {
|
||||||
this.setState({ error: false, loaded: false });
|
setError(false);
|
||||||
|
setHasBeenLoaded(false);
|
||||||
} else {
|
} else {
|
||||||
this.setState({ error: true, loaded: false });
|
setError(true);
|
||||||
|
setHasBeenLoaded(false);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ loading: false });
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}, CONSTANTS.API_DELAY);
|
||||||
|
|
||||||
private requestList: AbortController[];
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
public getAdorment(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<StyledInputAdornment position={'start'}>
|
|
||||||
<IconSearch />
|
|
||||||
</StyledInputAdornment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* As user focuses out from input, we cancel all the request from requestList
|
|
||||||
* and set the API state parameters to default boolean values.
|
|
||||||
*/
|
|
||||||
private handleOnBlur: onBlur = event => {
|
|
||||||
// stops event bubbling
|
// stops event bubbling
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.setState(
|
setIsLoading(true);
|
||||||
{
|
setHasBeenLoaded(false);
|
||||||
loaded: false,
|
setError(undefined);
|
||||||
loading: false,
|
handleFetchPackages(event.target.value);
|
||||||
error: false,
|
|
||||||
},
|
|
||||||
() => this.cancelAllSearchRequests()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export default withRouter(Search);
|
return (
|
||||||
|
<AutoComplete
|
||||||
|
// onBlur={this.handleOnBlur}
|
||||||
|
onChange={handleChange}
|
||||||
|
// onCleanSuggestions={this.handlePackagesClearRequested}
|
||||||
|
// onClick={this.handleClickSearch}
|
||||||
|
// onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
|
||||||
|
options={suggestions}
|
||||||
|
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
|
||||||
|
// startAdornment={this.getAdorment()}
|
||||||
|
// suggestionsError={error}
|
||||||
|
// suggestionsLoaded={loaded}
|
||||||
|
// suggestionsLoading={loading}
|
||||||
|
// value={search}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Search;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Search /> component test should load the component in default state 1`] = `"<div class=\\"css-pnwf4z-Wrapper e1rflf270\\"><div role=\\"combobox\\" aria-haspopup=\\"listbox\\" aria-owns=\\"react-autowhatever-1\\" aria-expanded=\\"false\\" class=\\"react-autosuggest__container\\"><div class=\\"MuiFormControl-root MuiTextField-root react-autosuggest__input css-ae5nkp-StyledTextField e1rflf271 MuiFormControl-fullWidth\\" aria-autocomplete=\\"list\\" aria-controls=\\"react-autowhatever-1\\"><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart\\"><div class=\\"MuiInputAdornment-root css-1wub48n-StyledInputAdornment e1n3ivvz0 MuiInputAdornment-positionStart\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\\"></path></svg></div><input aria-invalid=\\"false\\" autocomplete=\\"off\\" placeholder=\\"Search Packages\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart\\" value=\\"\\"></div></div><div class=\\"MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-kc7cda-SuggestionContainer e1rflf272\\" id=\\"react-autowhatever-1\\" role=\\"listbox\\"></div></div></div>"`;
|
exports[`<Search /> component test should load the component in default state 1`] = `"<div class=\\"css-1crzyyo e1rflf270\\"><div role=\\"combobox\\" aria-haspopup=\\"listbox\\" aria-owns=\\"react-autowhatever-1\\" aria-expanded=\\"false\\" class=\\"react-autosuggest__container\\"><div class=\\"MuiFormControl-root MuiTextField-root react-autosuggest__input MuiFormControl-fullWidth\\" aria-autocomplete=\\"list\\" aria-controls=\\"react-autowhatever-1\\"><div class=\\"MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart\\"><div class=\\"MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\\"></path></svg></div><input aria-invalid=\\"false\\" autocomplete=\\"off\\" placeholder=\\"Search Packages\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input css-hodoyq MuiInputBase-inputAdornedStart\\" value=\\"\\"></div></div><div class=\\"MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-cfo6a e1rflf271\\" id=\\"react-autowhatever-1\\" role=\\"listbox\\"></div></div></div>"`;
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
|
|
||||||
import Spinner from './Spinner';
|
import Spinner from './Spinner';
|
||||||
import { Circular, Wrapper } from './styles';
|
import { Circular, Wrapper } from './styles';
|
||||||
|
|
||||||
describe('<Spinner /> component', () => {
|
describe('<Spinner /> component', () => {
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const wrapper = mount(<Spinner />);
|
const wrapper = shallow(<Spinner />);
|
||||||
const wrapperComponent = wrapper.find(Wrapper);
|
const wrapperComponent = wrapper.find(Wrapper);
|
||||||
const circular = wrapper.find(Circular);
|
const circular = wrapper.find(Circular);
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ describe('<Spinner /> component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should render the component in custom state', () => {
|
test('should render the component in custom state', () => {
|
||||||
const wrapper = mount(<Spinner centered={true} size={10} />);
|
const wrapper = shallow(<Spinner centered={true} size={10} />);
|
||||||
const wrapperComponent = wrapper.find(Wrapper);
|
const wrapperComponent = wrapper.find(Wrapper);
|
||||||
const circular = wrapper.find(Circular);
|
const circular = wrapper.find(Circular);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Spinner /> component should render the component in custom state 1`] = `"<div class=\\"css-1ju0ex2-Wrapper e1ag4h8b0\\"><div class=\\"MuiCircularProgress-root css-evyw70-Circular e1ag4h8b1 MuiCircularProgress-colorPrimary MuiCircularProgress-indeterminate\\" style=\\"width: 10px; height: 10px;\\" role=\\"progressbar\\"><svg class=\\"MuiCircularProgress-svg\\" viewBox=\\"22 22 44 44\\"><circle class=\\"MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate\\" cx=\\"44\\" cy=\\"44\\" r=\\"20.2\\" fill=\\"none\\" stroke-width=\\"3.6\\"></circle></svg></div></div>"`;
|
exports[`<Spinner /> component should render the component in custom state 1`] = `"<div class=\\"css-zo92co e1ag4h8b0\\"><div class=\\"MuiCircularProgress-root css-15gl0ho e1ag4h8b1 MuiCircularProgress-colorPrimary MuiCircularProgress-indeterminate\\" style=\\"width:10px;height:10px\\" role=\\"progressbar\\"><svg class=\\"MuiCircularProgress-svg\\" viewBox=\\"22 22 44 44\\"><circle class=\\"MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate\\" cx=\\"44\\" cy=\\"44\\" r=\\"20.2\\" fill=\\"none\\" stroke-width=\\"3.6\\"></circle></svg></div></div>"`;
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
|
import colors from '../../utils/styles/colors';
|
||||||
import CircularProgress from '../../muiComponents/CircularProgress';
|
import CircularProgress from '../../muiComponents/CircularProgress';
|
||||||
import { Theme } from '../../design-tokens/theme';
|
|
||||||
|
|
||||||
interface WrapperProps {
|
interface WrapperProps {
|
||||||
centered: boolean;
|
centered: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Wrapper = styled('div')<WrapperProps>(props => ({
|
export const Wrapper = styled('div')`
|
||||||
display: 'flex',
|
&& {
|
||||||
alignItems: 'center',
|
display: flex;
|
||||||
justifyContent: 'center',
|
align-items: center;
|
||||||
...(props.centered && {
|
justify-content: center;
|
||||||
position: 'absolute',
|
${(props: WrapperProps) =>
|
||||||
top: '50%',
|
props.centered &&
|
||||||
left: '50%',
|
css`
|
||||||
transform: 'translate(-50%, -50%)',
|
position: absolute;
|
||||||
}),
|
top: 50%;
|
||||||
}));
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
`};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const Circular = styled(CircularProgress)<{ theme?: Theme }>(props => ({
|
export const Circular = styled(CircularProgress)({
|
||||||
color: props.theme && props.theme.palette.primary.main,
|
'&&': {
|
||||||
}));
|
color: colors.primary,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import Tag from './Tag';
|
import Tag from './Tag';
|
||||||
|
|
||||||
describe('<Tag /> component', () => {
|
describe('<Tag /> component', () => {
|
||||||
test('should load the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(
|
const wrapper = shallow(
|
||||||
<Tag>
|
<Tag>
|
||||||
<span>{'I am a child'}</span>
|
<span>{'I am a child'}</span>
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,21 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Tag /> component should load the component in default state 1`] = `
|
exports[`<Tag /> component should render the component in default state 1`] = `"<span class=\\"css-le0azu e1q9boj50\\"><span>I am a child</span></span>"`;
|
||||||
.emotion-0 {
|
|
||||||
vertical-align: middle;
|
|
||||||
line-height: 22px;
|
|
||||||
border-radius: 2px;
|
|
||||||
color: #485a3e;
|
|
||||||
background-color: #f3f4f2;
|
|
||||||
padding: 0.22rem 0.4rem;
|
|
||||||
margin: 8px 8px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
<span
|
|
||||||
class="emotion-0 emotion-1"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
I am a child
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled('span')({
|
export const Wrapper = styled('span')({
|
||||||
verticalAlign: 'middle',
|
'&&': {
|
||||||
lineHeight: '22px',
|
verticalAlign: 'middle',
|
||||||
borderRadius: '2px',
|
lineHeight: '22px',
|
||||||
color: '#485a3e',
|
borderRadius: '2px',
|
||||||
backgroundColor: '#f3f4f2',
|
color: '#485a3e',
|
||||||
padding: '0.22rem 0.4rem',
|
backgroundColor: '#f3f4f2',
|
||||||
margin: '8px 8px 0 0',
|
padding: '0.22rem 0.4rem',
|
||||||
|
margin: '8px 8px 0 0',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow, mount } from 'enzyme';
|
||||||
|
|
||||||
import { mount, shallow } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
|
||||||
import UpLinks from './UpLinks';
|
import UpLinks from './UpLinks';
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">verdaccio has no uplinks.</h6>"`;
|
exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">verdaccio has no uplinks.</h6>"`;
|
||||||
|
|
||||||
exports[`<UpLinks /> component should render the component with uplinks 1`] = `"<h6 class=\\"MuiTypography-root css-5wp24z-StyledText e14i1sy10 MuiTypography-subtitle1\\">Uplinks</h6><ul class=\\"MuiList-root MuiList-padding\\"><li class=\\"MuiListItem-root MuiListItem-gutters\\"><div class=\\"MuiListItemText-root css-1pxn9ma-ListItemText e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">npmjs</span></div><div class=\\"css-t1rp47-Spacer e14i1sy11\\"></div><div class=\\"MuiListItemText-root css-1pxn9ma-ListItemText e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">over 1 year ago</span></div></li></ul>"`;
|
exports[`<UpLinks /> component should render the component with uplinks 1`] = `"<h6 class=\\"MuiTypography-root css-1vg6q84 e14i1sy10 MuiTypography-subtitle1\\">Uplinks</h6><ul class=\\"MuiList-root MuiList-padding\\"><li class=\\"MuiListItem-root MuiListItem-gutters\\"><div class=\\"MuiListItemText-root css-o655gb e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">npmjs</span></div><div class=\\"css-1l1cv61 e14i1sy11\\"></div><div class=\\"MuiListItemText-root css-o655gb e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">over 1 year ago</span></div></li></ul>"`;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
import { render, cleanup } from '@testing-library/react';
|
||||||
|
|
||||||
import { render, cleanup } from '../../utils/test-react-testing-library';
|
|
||||||
import { mount } from '../../utils/test-enzyme';
|
|
||||||
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
||||||
|
|
||||||
import Versions, { LABEL_CURRENT_TAGS, LABEL_VERSION_HISTORY } from './Versions';
|
import Versions, { LABEL_CURRENT_TAGS, LABEL_VERSION_HISTORY } from './Versions';
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ const resetStyles = makeStyles(() => ({
|
|||||||
'html, body, #root': {
|
'html, body, #root': {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
},
|
},
|
||||||
ul: {
|
|
||||||
margin: 0,
|
|
||||||
padding: 0,
|
|
||||||
listStyle: 'none',
|
|
||||||
},
|
|
||||||
'.container': {
|
'.container': {
|
||||||
padding: 15,
|
padding: 15,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
|
|
||||||
import { ThemeProvider as EmotionThemeProvider } from 'emotion-theming';
|
|
||||||
|
|
||||||
import theme from './theme';
|
|
||||||
|
|
||||||
const ThemeProvider: React.FC = ({ children }) => (
|
|
||||||
<EmotionThemeProvider theme={theme}>
|
|
||||||
<MuiThemeProvider theme={theme}>{children}</MuiThemeProvider>
|
|
||||||
</EmotionThemeProvider>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default ThemeProvider;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import styled, { CreateStyled } from '@emotion/styled';
|
|
||||||
|
|
||||||
import { Theme } from './theme';
|
|
||||||
|
|
||||||
export default styled as CreateStyled<Theme>;
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import createMuiTheme from '@material-ui/core/styles/createMuiTheme';
|
|
||||||
|
|
||||||
// Main colors
|
|
||||||
// -------------------------
|
|
||||||
const colors = {
|
|
||||||
black: '#000',
|
|
||||||
white: '#fff',
|
|
||||||
red: '#d32f2f',
|
|
||||||
greySuperLight: '#f5f5f5',
|
|
||||||
greyLight: '#d3d3d3',
|
|
||||||
greyLight2: '#908ba1',
|
|
||||||
greyLight3: '#f3f4f240',
|
|
||||||
greyDark: '#a9a9a9',
|
|
||||||
greyDark2: '#586069',
|
|
||||||
greyChateau: '#95989a',
|
|
||||||
greyGainsboro: '#e3e3e3',
|
|
||||||
greyAthens: '#d3dddd',
|
|
||||||
eclipse: '#3c3c3c',
|
|
||||||
paleNavy: '#e4e8f1',
|
|
||||||
saltpan: '#f7f8f6',
|
|
||||||
snow: '#f9f9f9',
|
|
||||||
love: '#e25555',
|
|
||||||
nobel01: '#999999',
|
|
||||||
nobel02: '#9f9f9f',
|
|
||||||
primary: window.VERDACCIO_PRIMARY_COLOR || '#4b5e40',
|
|
||||||
secondary: '#20232a',
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Colors = keyof typeof colors;
|
|
||||||
|
|
||||||
export const theme = createMuiTheme({
|
|
||||||
typography: {
|
|
||||||
fontFamily: 'inherit',
|
|
||||||
},
|
|
||||||
palette: {
|
|
||||||
...colors,
|
|
||||||
primary: { main: colors.primary },
|
|
||||||
secondary: { main: colors.secondary },
|
|
||||||
error: { main: colors.red },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export type Theme = typeof theme;
|
|
||||||
|
|
||||||
declare module '@material-ui/core/styles/createPalette' {
|
|
||||||
interface CustomPalette {
|
|
||||||
black: string;
|
|
||||||
white: string;
|
|
||||||
red: string;
|
|
||||||
greySuperLight: string;
|
|
||||||
greyLight: string;
|
|
||||||
greyLight2: string;
|
|
||||||
greyLight3: string;
|
|
||||||
greyDark: string;
|
|
||||||
greyDark2: string;
|
|
||||||
greyChateau: string;
|
|
||||||
greyGainsboro: string;
|
|
||||||
greyAthens: string;
|
|
||||||
eclipse: string;
|
|
||||||
paleNavy: string;
|
|
||||||
saltpan: string;
|
|
||||||
snow: string;
|
|
||||||
love: string;
|
|
||||||
nobel01: string;
|
|
||||||
nobel02: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-empty-interface */
|
|
||||||
interface Palette extends CustomPalette {}
|
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-empty-interface */
|
|
||||||
interface PaletteOptions extends Partial<CustomPalette> {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { ...theme };
|
|
||||||
@@ -5,18 +5,13 @@ import ReactDOM from 'react-dom';
|
|||||||
import { AppContainer } from 'react-hot-loader';
|
import { AppContainer } from 'react-hot-loader';
|
||||||
|
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import ThemeProvider from './design-tokens/ThemeProvider';
|
|
||||||
import StyleBaseline from './design-tokens/StyleBaseline';
|
|
||||||
|
|
||||||
const rootNode = document.getElementById('root');
|
const rootNode = document.getElementById('root');
|
||||||
|
|
||||||
const renderApp = (Component: React.ElementType): void => {
|
const renderApp = (Component: React.ElementType): void => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<AppContainer>
|
<AppContainer>
|
||||||
<ThemeProvider>
|
<Component />
|
||||||
<StyleBaseline />
|
|
||||||
<Component />
|
|
||||||
</ThemeProvider>
|
|
||||||
</AppContainer>,
|
</AppContainer>,
|
||||||
rootNode
|
rootNode
|
||||||
);
|
);
|
||||||
|
|||||||
93
src/muiComponents/AutoComplete/AutoComplete.tsx
Normal file
93
src/muiComponents/AutoComplete/AutoComplete.tsx
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import React, { forwardRef, ChangeEvent, useState } from 'react';
|
||||||
|
import { default as MuiAutoComplete, AutocompleteProps } from '@material-ui/lab/Autocomplete';
|
||||||
|
import TextField from '@material-ui/core/TextField';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import Search from '@material-ui/icons/Search';
|
||||||
|
|
||||||
|
import CircularProgress from '../CircularProgress';
|
||||||
|
|
||||||
|
import AutoCompleteTextField from './AutoCompleteTextField';
|
||||||
|
|
||||||
|
const StyledAutoComplete = styled(MuiAutoComplete)({
|
||||||
|
width: '100%',
|
||||||
|
color: 'white',
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledSearch = styled(Search)({
|
||||||
|
color: 'white',
|
||||||
|
marginRight: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledTextField = styled(TextField)({
|
||||||
|
'& .MuiInputBase-root': {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
'& .MuiInput-underline': {
|
||||||
|
':before': {
|
||||||
|
content: "''",
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
':after': {
|
||||||
|
borderColor: 'white',
|
||||||
|
},
|
||||||
|
':hover:before': {
|
||||||
|
content: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
placeholder?: string;
|
||||||
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
options: Array<Option>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type AutoCompleteRef = HTMLDivElement;
|
||||||
|
|
||||||
|
/* eslint-disable react/jsx-no-bind */
|
||||||
|
|
||||||
|
const AutoComplete = forwardRef<AutoCompleteRef, Props>(function AutoComplete({ placeholder, options = [], onChange }, ref) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const isLoading = open && options.length === 0;
|
||||||
|
|
||||||
|
console.log('options', options);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledAutoComplete
|
||||||
|
autoHighlight={true}
|
||||||
|
freeSolo={true}
|
||||||
|
options={options}
|
||||||
|
loading={isLoading}
|
||||||
|
innerRef={ref}
|
||||||
|
open={open}
|
||||||
|
onOpen={() => {
|
||||||
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
getOptionLabel={option => option.label}
|
||||||
|
renderInput={params => (
|
||||||
|
<StyledTextField
|
||||||
|
{...params}
|
||||||
|
onChange={onChange}
|
||||||
|
fullWidth={true}
|
||||||
|
variant="standard"
|
||||||
|
placeholder={placeholder}
|
||||||
|
InputProps={{
|
||||||
|
...params.InputProps,
|
||||||
|
startAdornment: <StyledSearch />,
|
||||||
|
endAdornment: isLoading ? <CircularProgress color="inherit" size={20} /> : null,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AutoComplete;
|
||||||
35
src/muiComponents/AutoComplete/AutoCompleteTextField.tsx
Normal file
35
src/muiComponents/AutoComplete/AutoCompleteTextField.tsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import Search from '@material-ui/icons/Search';
|
||||||
|
|
||||||
|
import TextField, { TextFieldProps } from '../TextField';
|
||||||
|
|
||||||
|
const StyledTextField = styled(TextField)({
|
||||||
|
'& .MuiInputBase-root': {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
'& .MuiInput-underline': {
|
||||||
|
':before': {
|
||||||
|
content: "''",
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
':after': {
|
||||||
|
borderColor: 'white',
|
||||||
|
},
|
||||||
|
':hover:before': {
|
||||||
|
content: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledSearch = styled(Search)({
|
||||||
|
color: 'white',
|
||||||
|
marginRight: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const AutoCompleteTextField: React.FC<TextFieldProps> = props => {
|
||||||
|
// @ts-ignore: Types of property 'ref' are incompatible.
|
||||||
|
return <StyledTextField {...props} InputProps={{ startAdornment: <StyledSearch /> }} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AutoCompleteTextField;
|
||||||
1
src/muiComponents/AutoComplete/index.ts
Normal file
1
src/muiComponents/AutoComplete/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './AutoComplete';
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
|
|
||||||
import TextField from './TextField';
|
import TextField from './TextField';
|
||||||
|
|
||||||
@@ -9,8 +8,8 @@ describe('<TextField /> component', () => {
|
|||||||
name: 'test',
|
name: 'test',
|
||||||
value: 'test',
|
value: 'test',
|
||||||
};
|
};
|
||||||
test('should load the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const { container } = render(<TextField name={props.name} value={props.value} />);
|
const wrapper = mount(<TextField name={props.name} value={props.value} />);
|
||||||
expect(container.firstChild).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ const TextField = forwardRef<TextFieldRef, TextFieldProps>(function TextField({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { TextFieldProps };
|
||||||
export default TextField;
|
export default TextField;
|
||||||
|
|||||||
@@ -1,19 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<TextField /> component should load the component in default state 1`] = `
|
exports[`<TextField /> component should render the component in default state 1`] = `"<div class=\\"MuiFormControl-root MuiTextField-root\\"><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" name=\\"test\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"test\\"></div></div>"`;
|
||||||
<div
|
|
||||||
class="MuiFormControl-root MuiTextField-root"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-invalid="false"
|
|
||||||
class="MuiInputBase-input MuiInput-input"
|
|
||||||
name="test"
|
|
||||||
type="text"
|
|
||||||
value="test"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export { default } from './TextField';
|
export { default, TextFieldProps } from './TextField';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MemoryRouter } from 'react-router';
|
import { MemoryRouter } from 'react-router';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
import { waitForElement } from '@testing-library/dom';
|
import { waitForElement } from '@testing-library/dom';
|
||||||
|
|
||||||
import { render } from '../../utils/test-react-testing-library';
|
|
||||||
import { NOT_FOUND_TEXT } from '../../components/NotFound';
|
import { NOT_FOUND_TEXT } from '../../components/NotFound';
|
||||||
|
|
||||||
import Version from './Version';
|
import Version from './Version';
|
||||||
|
|||||||
37
src/utils/styles/colors.ts
Normal file
37
src/utils/styles/colors.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// Verdaccio
|
||||||
|
// -------------------------
|
||||||
|
|
||||||
|
// Main colors
|
||||||
|
// -------------------------
|
||||||
|
const colors = {
|
||||||
|
black: '#000',
|
||||||
|
white: '#fff',
|
||||||
|
red: '#d32f2f',
|
||||||
|
grey: '#808080',
|
||||||
|
greySuperLight: '#f5f5f5',
|
||||||
|
greyLight: '#d3d3d3',
|
||||||
|
greyLight2: '#908ba1',
|
||||||
|
greyLight3: '#f3f4f240',
|
||||||
|
greyDark: '#a9a9a9',
|
||||||
|
greyDark2: '#586069',
|
||||||
|
greyChateau: '#95989a',
|
||||||
|
greyGainsboro: '#e3e3e3',
|
||||||
|
greyAthens: '#d3dddd',
|
||||||
|
|
||||||
|
eclipse: '#3c3c3c',
|
||||||
|
paleNavy: '#e4e8f1',
|
||||||
|
saltpan: '#f7f8f6',
|
||||||
|
snow: '#f9f9f9',
|
||||||
|
love: '#e25555',
|
||||||
|
|
||||||
|
nobel01: '#999999',
|
||||||
|
nobel02: '#9f9f9f',
|
||||||
|
|
||||||
|
// Main colors
|
||||||
|
// -------------------------
|
||||||
|
|
||||||
|
primary: window.VERDACCIO_PRIMARY_COLOR || '#4b5e40',
|
||||||
|
secondary: '#20232a',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default colors;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user