mirror of
https://github.com/SomboChea/ui
synced 2026-01-18 00:56:00 +07:00
Compare commits
77 Commits
v0.3.4
...
juanpicado
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45f76bfc2c | ||
|
|
111f0c50e5 | ||
|
|
a0dcf87368 | ||
|
|
9ed5a833d9 | ||
|
|
1ed229363a | ||
|
|
34dff06bdb | ||
|
|
5d300cd9be | ||
|
|
acfc902a99 | ||
|
|
2f35eb7790 | ||
|
|
cf6c5e159d | ||
|
|
fa9e1d3487 | ||
|
|
d70c78f201 | ||
|
|
effde37c35 | ||
|
|
d65483401d | ||
|
|
5f80d00502 | ||
|
|
430608d276 | ||
|
|
9975edbb6f | ||
|
|
dbaa0c43b8 | ||
|
|
fd306def95 | ||
|
|
ec3f69a542 | ||
|
|
fc4a7ee12c | ||
|
|
5c6d9f68ca | ||
|
|
3e8af72193 | ||
|
|
3f58be32b3 | ||
|
|
042571e72f | ||
|
|
dd6ba2cbe9 | ||
|
|
bf613231f4 | ||
|
|
7074eddf27 | ||
|
|
d3ddd439d1 | ||
|
|
26724bb20e | ||
|
|
cba41ceead | ||
|
|
2688b59f5b | ||
|
|
4d285dbb00 | ||
|
|
739333b1f1 | ||
|
|
5809a9f7cb | ||
|
|
e1c5e30b4c | ||
|
|
5a3ea02449 | ||
|
|
535d8f9c85 | ||
|
|
8a46678698 | ||
|
|
3265ed561d | ||
|
|
3a6c6f7fb9 | ||
|
|
09fe1db850 | ||
|
|
f265b6ba33 | ||
|
|
185b2016d3 | ||
|
|
3751acef1c | ||
|
|
50fa39f7d6 | ||
|
|
cd2e36513e | ||
|
|
b20fe3f44a | ||
|
|
be30cbdd14 | ||
|
|
c6e3fd0b92 | ||
|
|
f27254ca6b | ||
|
|
f4dd8b01b4 | ||
|
|
a94485e614 | ||
|
|
ce4b13d3b5 | ||
|
|
fcd471ef6f | ||
|
|
9915fb6193 | ||
|
|
886684817b | ||
|
|
76d11d4674 | ||
|
|
322197dc70 | ||
|
|
d2e9d68c6d | ||
|
|
f1971edf6d | ||
|
|
c9f6bf43ae | ||
|
|
bdef686914 | ||
|
|
84257e1a84 | ||
|
|
b74ca2285e | ||
|
|
803da1c532 | ||
|
|
5cb47ed49e | ||
|
|
b56e43846b | ||
|
|
a4cdd145d2 | ||
|
|
0eb0566cde | ||
|
|
e6b53c0479 | ||
|
|
b03e6d6c27 | ||
|
|
cdfbde1df1 | ||
|
|
521e11a453 | ||
|
|
fd4d7037ed | ||
|
|
c918518f69 | ||
|
|
5ff4b8a184 |
3
.babelrc
3
.babelrc
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"presets": [["@verdaccio"]]
|
"presets": [["@verdaccio"]],
|
||||||
|
"plugins": ["emotion"]
|
||||||
}
|
}
|
||||||
|
|||||||
50
.github/workflows/canary.yml
vendored
Normal file
50
.github/workflows/canary.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: CI Canary
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_test_lint:
|
||||||
|
name: Node Smoke Test Befor Canary
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '12.x'
|
||||||
|
registry-url: 'https://registry.verdaccio.org'
|
||||||
|
- name: Install
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
- name: Lint
|
||||||
|
run: yarn lint
|
||||||
|
- name: Build
|
||||||
|
run: yarn build
|
||||||
|
- name: Archive production artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: static
|
||||||
|
path: static
|
||||||
|
canary:
|
||||||
|
name: Publish Canary Version of a PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Download math result for job 2
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: static
|
||||||
|
- uses: verdaccio/github-actions/canary@v0.4.0
|
||||||
|
with:
|
||||||
|
message: 'Thanks for your PR, the @verdaccio/ui package will be accessible from here for testing purposes:'
|
||||||
|
is-global: false
|
||||||
|
package-name: '@verdaccio/ui-theme'
|
||||||
|
registry: 'https://registry.verdaccio.org'
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
bot-token: ${{ secrets.VERDACCIO_BOT_TOKEN }}
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '12.x'
|
||||||
|
registry-url: 'https://registry.verdaccio.org'
|
||||||
|
- run: npm publish --tag canary
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
|
||||||
|
needs: build_test_lint
|
||||||
24
.github/workflows/main.yml
vendored
24
.github/workflows/main.yml
vendored
@@ -9,20 +9,20 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node_version: [10, 12]
|
node_version: [12, 13]
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Use Node.js ${{ matrix.node_version }}
|
- name: Use Node.js ${{ matrix.node_version }}
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
- name: Build
|
- name: Lint
|
||||||
run: yarn build
|
run: yarn lint
|
||||||
- name: Lint
|
- name: Build
|
||||||
run: yarn lint
|
run: yarn build
|
||||||
|
|||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -2,6 +2,24 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.3.6](https://github.com/verdaccio/ui/compare/v0.3.5...v0.3.6) (2019-11-08)
|
||||||
|
|
||||||
|
### [0.3.5](https://github.com/verdaccio/ui/compare/v0.3.4...v0.3.5) (2019-11-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* adds unit tests for api service ([#235](https://github.com/verdaccio/ui/issues/235)) ([803da1c](https://github.com/verdaccio/ui/commit/803da1c))
|
||||||
|
* convert Engine component to hooks ([#233](https://github.com/verdaccio/ui/issues/233)) ([5cb47ed](https://github.com/verdaccio/ui/commit/5cb47ed))
|
||||||
|
* refactor/116 RegistryInfoContent is converted to functional component ([#229](https://github.com/verdaccio/ui/issues/229)) ([b74ca22](https://github.com/verdaccio/ui/commit/b74ca22)), closes [#116](https://github.com/verdaccio/ui/issues/116) [#116](https://github.com/verdaccio/ui/issues/116)
|
||||||
|
* rest MUI components - Introduced ForwardRef ([#224](https://github.com/verdaccio/ui/issues/224)) ([b56e438](https://github.com/verdaccio/ui/commit/b56e438))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* added download tarball button at list ([#237](https://github.com/verdaccio/ui/issues/237)) ([bdef686](https://github.com/verdaccio/ui/commit/bdef686))
|
||||||
|
* update date fns to v2 ([#232](https://github.com/verdaccio/ui/issues/232)) ([a4cdd14](https://github.com/verdaccio/ui/commit/a4cdd14))
|
||||||
|
|
||||||
### [0.3.4](https://github.com/verdaccio/ui/compare/v0.3.3...v0.3.4) (2019-10-26)
|
### [0.3.4](https://github.com/verdaccio/ui/compare/v0.3.3...v0.3.4) (2019-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
3
CONTRIBUTING.md
Normal file
3
CONTRIBUTING.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Contributing Guidelines
|
||||||
|
|
||||||
|
// TODO
|
||||||
@@ -15,6 +15,8 @@ global.__APP_VERSION__ = '1.0.0';
|
|||||||
// @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
|
// @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
|
||||||
global.__VERDACCIO_BASENAME_UI_OPTIONS = {};
|
global.__VERDACCIO_BASENAME_UI_OPTIONS = {};
|
||||||
|
|
||||||
|
global.VERDACCIO_API_URL = 'https://verdaccio.tld';
|
||||||
|
|
||||||
const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
|
const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
|
||||||
customGlobal.fetch = require('jest-fetch-mock');
|
customGlobal.fetch = require('jest-fetch-mock');
|
||||||
customGlobal.fetchMock = customGlobal.fetch;
|
customGlobal.fetchMock = customGlobal.fetch;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import addHours from 'date-fns/add_hours';
|
import addHours from 'date-fns/addHours';
|
||||||
|
|
||||||
export function generateTokenWithTimeRange(limit = 0) {
|
export function generateTokenWithTimeRange(limit = 0) {
|
||||||
const payload = {
|
const payload = {
|
||||||
|
|||||||
96
package.json
96
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@verdaccio/ui-theme",
|
"name": "@verdaccio/ui-theme",
|
||||||
"version": "0.3.4",
|
"version": "0.3.6",
|
||||||
"description": "Verdaccio User Interface",
|
"description": "Verdaccio User Interface",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Verdaccio Core Team",
|
"name": "Verdaccio Core Team",
|
||||||
@@ -15,28 +15,30 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "8.2.0",
|
"@commitlint/cli": "8.2.0",
|
||||||
"@commitlint/config-conventional": "8.2.0",
|
"@commitlint/config-conventional": "8.2.0",
|
||||||
"@material-ui/core": "4.5.1",
|
"@emotion/core": "10.0.22",
|
||||||
|
"@emotion/styled": "10.0.23",
|
||||||
|
"@material-ui/core": "4.6.1",
|
||||||
"@material-ui/icons": "4.5.1",
|
"@material-ui/icons": "4.5.1",
|
||||||
"@octokit/rest": "16.34.0",
|
"@octokit/rest": "16.35.0",
|
||||||
"@testing-library/react": "9.3.0",
|
"@testing-library/react": "9.3.2",
|
||||||
"@types/autosuggest-highlight": "3.1.0",
|
"@types/autosuggest-highlight": "3.1.0",
|
||||||
"@types/enzyme": "3.10.3",
|
"@types/enzyme": "3.10.3",
|
||||||
"@types/jest": "24.0.20",
|
"@types/jest": "24.0.23",
|
||||||
"@types/js-base64": "2.3.1",
|
"@types/js-base64": "2.3.1",
|
||||||
"@types/lodash": "4.14.144",
|
"@types/lodash": "4.14.149",
|
||||||
"@types/node": "12.11.7",
|
"@types/node": "12.12.11",
|
||||||
"@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.3",
|
"@types/react-dom": "16.9.4",
|
||||||
"@types/react-router-dom": "5.1.0",
|
"@types/react-router-dom": "5.1.2",
|
||||||
"@types/request": "2.48.3",
|
"@types/request": "2.48.3",
|
||||||
"@types/validator": "10.11.3",
|
"@types/validator": "12.0.0",
|
||||||
"@types/webpack-env": "1.14.1",
|
"@types/webpack-env": "1.14.1",
|
||||||
"@typescript-eslint/parser": "2.4.0",
|
"@typescript-eslint/parser": "2.8.0",
|
||||||
"@verdaccio/babel-preset": "8.2.0",
|
"@verdaccio/babel-preset": "8.2.0",
|
||||||
"@verdaccio/commons-api": "8.2.0",
|
"@verdaccio/commons-api": "8.3.0",
|
||||||
"@verdaccio/eslint-config": "2.0.0",
|
"@verdaccio/eslint-config": "8.2.0",
|
||||||
"@verdaccio/types": "8.1.0",
|
"@verdaccio/types": "8.3.0",
|
||||||
"autosuggest-highlight": "3.1.1",
|
"autosuggest-highlight": "3.1.1",
|
||||||
"babel-loader": "8.0.6",
|
"babel-loader": "8.0.6",
|
||||||
"bundlesize": "0.18.0",
|
"bundlesize": "0.18.0",
|
||||||
@@ -45,26 +47,27 @@
|
|||||||
"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": "1.30.1",
|
"date-fns": "2.8.1",
|
||||||
"detect-secrets": "1.0.4",
|
"detect-secrets": "1.0.5",
|
||||||
"emotion": "9.2.12",
|
"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.5.1",
|
"eslint": "6.6.0",
|
||||||
"eslint-plugin-codeceptjs": "1.1.0",
|
"eslint-plugin-codeceptjs": "1.2.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.0",
|
"eslint-plugin-prettier": "3.1.1",
|
||||||
"eslint-plugin-react": "7.14.3",
|
"eslint-plugin-react": "7.16.0",
|
||||||
"eslint-plugin-react-hooks": "2.0.1",
|
"eslint-plugin-react-hooks": "2.3.0",
|
||||||
"eslint-plugin-verdaccio": "2.0.0",
|
"eslint-plugin-verdaccio": "8.2.0",
|
||||||
"file-loader": "4.2.0",
|
"file-loader": "4.3.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.0.9",
|
"husky": "3.1.0",
|
||||||
"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",
|
||||||
@@ -77,47 +80,46 @@
|
|||||||
"js-yaml": "3.13.1",
|
"js-yaml": "3.13.1",
|
||||||
"lint-staged": "8.2.1",
|
"lint-staged": "8.2.1",
|
||||||
"localstorage-memory": "1.0.3",
|
"localstorage-memory": "1.0.3",
|
||||||
"lockfile-lint": "2.1.6",
|
"lockfile-lint": "2.2.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"mini-css-extract-plugin": "0.8.0",
|
"mini-css-extract-plugin": "0.8.0",
|
||||||
"node-mocks-http": "1.8.0",
|
"node-mocks-http": "1.8.0",
|
||||||
"normalize.css": "8.0.1",
|
"normalize.css": "8.0.1",
|
||||||
"optimize-css-assets-webpack-plugin": "5.0.3",
|
"optimize-css-assets-webpack-plugin": "5.0.3",
|
||||||
"ora": "4.0.2",
|
"ora": "4.0.3",
|
||||||
"prettier": "1.18.2",
|
"prettier": "1.19.1",
|
||||||
"prop-types": "15.7.2",
|
"prop-types": "15.7.2",
|
||||||
"puppeteer": "1.8.0",
|
"puppeteer": "2.0.0",
|
||||||
"react": "16.11.0",
|
"react": "16.12.0",
|
||||||
"react-autosuggest": "9.4.3",
|
"react-autosuggest": "9.4.3",
|
||||||
"react-dom": "16.11.0",
|
"react-dom": "16.12.0",
|
||||||
"react-emotion": "9.2.12",
|
"react-hot-loader": "4.12.18",
|
||||||
"react-hot-loader": "4.12.15",
|
|
||||||
"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.0",
|
"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.0",
|
"standard-version": "7.0.1",
|
||||||
"style-loader": "1.0.0",
|
"style-loader": "1.0.0",
|
||||||
"stylelint": "11.1.1",
|
"stylelint": "12.0.0",
|
||||||
"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.0.3",
|
"stylelint-webpack-plugin": "1.1.0",
|
||||||
"supertest": "4.0.2",
|
"supertest": "4.0.2",
|
||||||
"typeface-roboto": "0.0.75",
|
"typeface-roboto": "0.0.75",
|
||||||
"typescript": "3.7.1-rc",
|
"typescript": "3.7.2",
|
||||||
"uglifyjs-webpack-plugin": "2.2.0",
|
"uglifyjs-webpack-plugin": "2.2.0",
|
||||||
"url-loader": "2.2.0",
|
"url-loader": "2.3.0",
|
||||||
"validator": "11.1.0",
|
"validator": "12.1.0",
|
||||||
"verdaccio": "4.3.4",
|
"verdaccio": "4.3.5",
|
||||||
"verdaccio-auth-memory": "8.2.0",
|
"verdaccio-auth-memory": "8.3.0",
|
||||||
"verdaccio-memory": "8.2.0",
|
"verdaccio-memory": "8.3.0",
|
||||||
"wait-on": "3.3.0",
|
"wait-on": "3.3.0",
|
||||||
"webpack": "4.41.2",
|
"webpack": "4.41.2",
|
||||||
"webpack-bundle-analyzer": "3.6.0",
|
"webpack-bundle-analyzer": "3.6.0",
|
||||||
"webpack-bundle-size-analyzer": "3.1.0",
|
"webpack-bundle-size-analyzer": "3.1.0",
|
||||||
"webpack-cli": "3.3.9",
|
"webpack-cli": "3.3.10",
|
||||||
"webpack-dev-server": "3.9.0",
|
"webpack-dev-server": "3.9.0",
|
||||||
"webpack-merge": "4.2.2",
|
"webpack-merge": "4.2.2",
|
||||||
"whatwg-fetch": "3.0.0",
|
"whatwg-fetch": "3.0.0",
|
||||||
@@ -171,7 +173,6 @@
|
|||||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts verdaccio npm yarn",
|
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts verdaccio npm yarn",
|
||||||
"coverage:publish": "codecov",
|
"coverage:publish": "codecov",
|
||||||
"pre:webpack": "rimraf static/*",
|
"pre:webpack": "rimraf static/*",
|
||||||
"prepublish": "in-publish && npm run build || not-in-publish",
|
|
||||||
"dev:web": "cross-env BABEL_ENV=ui babel-node tools/dev.server.js",
|
"dev:web": "cross-env BABEL_ENV=ui babel-node tools/dev.server.js",
|
||||||
"verdaccio:server": "node tools/verdaccio.js",
|
"verdaccio:server": "node tools/verdaccio.js",
|
||||||
"build": "npm run pre:webpack && cross-env BABEL_ENV=ui webpack --config tools/webpack.prod.config.babel.js",
|
"build": "npm run pre:webpack && cross-env BABEL_ENV=ui webpack --config tools/webpack.prod.config.babel.js",
|
||||||
@@ -193,7 +194,7 @@
|
|||||||
"relative": true,
|
"relative": true,
|
||||||
"linters": {
|
"linters": {
|
||||||
"*.{js,tsx,ts}": [
|
"*.{js,tsx,ts}": [
|
||||||
"eslint .",
|
"eslint . --ext .js,.ts,.tsx",
|
||||||
"prettier --write"
|
"prettier --write"
|
||||||
],
|
],
|
||||||
"*": [
|
"*": [
|
||||||
@@ -215,5 +216,6 @@
|
|||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
"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": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount, ReactWrapper } from 'enzyme';
|
import { 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';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import React, { Component, ReactElement } from 'react';
|
import React, { Component, ReactElement } from 'react';
|
||||||
import isNil from 'lodash/isNil';
|
import isNil from 'lodash/isNil';
|
||||||
import 'normalize.css';
|
|
||||||
import 'typeface-roboto/index.css';
|
|
||||||
|
|
||||||
import storage from '../utils/storage';
|
import storage from '../utils/storage';
|
||||||
import { makeLogin, isTokenExpire } from '../utils/login';
|
import { makeLogin, isTokenExpire } from '../utils/login';
|
||||||
@@ -10,7 +8,6 @@ import LoginModal from '../components/Login';
|
|||||||
import Header from '../components/Header';
|
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 '../utils/styles/global';
|
|
||||||
import Footer from '../components/Footer';
|
import Footer from '../components/Footer';
|
||||||
|
|
||||||
import AppRoute from './AppRoute';
|
import AppRoute from './AppRoute';
|
||||||
@@ -146,7 +143,14 @@ export default class App extends Component<{}, AppProps> {
|
|||||||
|
|
||||||
public renderLoginModal = (): ReactElement<HTMLElement> => {
|
public renderLoginModal = (): ReactElement<HTMLElement> => {
|
||||||
const { error, showLoginModal } = this.state;
|
const { error, showLoginModal } = this.state;
|
||||||
return <LoginModal error={error} onCancel={this.handleToggleLoginModal} onSubmit={this.handleDoLogin} visibility={showLoginModal} />;
|
return (
|
||||||
|
<LoginModal
|
||||||
|
error={error}
|
||||||
|
onCancel={this.handleToggleLoginModal}
|
||||||
|
onSubmit={this.handleDoLogin}
|
||||||
|
visibility={showLoginModal}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
public renderContent = (): ReactElement<HTMLElement> => {
|
public renderContent = (): ReactElement<HTMLElement> => {
|
||||||
@@ -167,6 +171,14 @@ export default class App extends Component<{}, AppProps> {
|
|||||||
scope,
|
scope,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return <Header logo={logoUrl} onLogout={this.handleLogout} onToggleLoginModal={this.handleToggleLoginModal} scope={scope} username={username} />;
|
return (
|
||||||
|
<Header
|
||||||
|
logo={logoUrl}
|
||||||
|
onLogout={this.handleLogout}
|
||||||
|
onToggleLoginModal={this.handleToggleLoginModal}
|
||||||
|
scope={scope}
|
||||||
|
username={username}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import colors from '../utils/styles/colors';
|
import { theme } from '../design-tokens/theme';
|
||||||
|
|
||||||
export const alertError = css({
|
export const alertError = css({
|
||||||
backgroundColor: `${colors.red} !important`,
|
backgroundColor: `${theme.palette.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';
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ export interface Action {
|
|||||||
export async function downloadHandler(link: string): Promise<void> {
|
export async function downloadHandler(link: string): Promise<void> {
|
||||||
const fileStream: Blob = await api.request(link, 'GET', {
|
const fileStream: Blob = await api.request(link, 'GET', {
|
||||||
headers: {
|
headers: {
|
||||||
['accept']: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
|
['accept']:
|
||||||
|
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
|
||||||
},
|
},
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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-1br2q5z eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><button class=\\"MuiButtonBase-root MuiFab-root css-96oxa0 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-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 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-96oxa0 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-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>"`;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiFab } from '@material-ui/core/Fab';
|
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
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,10 +10,8 @@ export const ActionListItem = styled(ListItem)({
|
|||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Fab = styled(MuiFab)({
|
export const Fab = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
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-b8upko e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-xugzlj 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\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div></a><div class=\\"MuiListItemText-root css-1vhg3jx 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-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 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-xugzlj e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div><div class=\\"MuiListItemText-root css-1vhg3jx 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>"`;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
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';
|
||||||
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
@@ -11,17 +11,13 @@ export const StyledText = styled(Text)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const AuthorListItem = styled(ListItem)({
|
export const AuthorListItem = styled(ListItem)({
|
||||||
'&&': {
|
padding: 0,
|
||||||
padding: 0,
|
':hover': {
|
||||||
},
|
|
||||||
'&&:hover': {
|
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const AuthorListItemText = styled(ListItemText)({
|
export const AuthorListItemText = styled(ListItemText)({
|
||||||
'&&': {
|
padding: '0 10px',
|
||||||
padding: '0 10px',
|
margin: 0,
|
||||||
margin: 0,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,21 +1,28 @@
|
|||||||
import React, { KeyboardEvent } from 'react';
|
import React, { KeyboardEvent } from 'react';
|
||||||
import { css } from 'emotion';
|
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';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
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;
|
||||||
@@ -54,23 +61,18 @@ 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 (
|
||||||
<MenuItem component="div" selected={isHighlighted}>
|
<StyledMenuItem 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 (
|
||||||
<a
|
<StyledAnchor fw={fw} key={String(index)}>
|
||||||
className={css`
|
|
||||||
font-weight: ${fw};
|
|
||||||
`}
|
|
||||||
href={suggestion.link}
|
|
||||||
key={String(index)}>
|
|
||||||
{part.text}
|
{part.text}
|
||||||
</a>
|
</StyledAnchor>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</MenuItem>
|
</StyledMenuItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -97,7 +99,6 @@ const AutoComplete = ({
|
|||||||
value = '',
|
value = '',
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
disableUnderline = false,
|
disableUnderline = false,
|
||||||
color,
|
|
||||||
onClick,
|
onClick,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
@@ -121,7 +122,6 @@ const AutoComplete = ({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
startAdornment,
|
startAdornment,
|
||||||
disableUnderline,
|
disableUnderline,
|
||||||
color,
|
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
};
|
};
|
||||||
@@ -140,7 +140,12 @@ const AutoComplete = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Autosuggest {...autosuggestProps} inputProps={inputProps} onSuggestionSelected={onClick} renderSuggestionsContainer={renderSuggestionsContainer} />
|
<Autosuggest
|
||||||
|
{...autosuggestProps}
|
||||||
|
inputProps={inputProps}
|
||||||
|
onSuggestionSelected={onClick}
|
||||||
|
renderSuggestionsContainer={renderSuggestionsContainer}
|
||||||
|
/>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,60 +1,44 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import Paper from '@material-ui/core/Paper';
|
|
||||||
|
|
||||||
import TextField from '../../muiComponents/TextField';
|
import TextField from '../../muiComponents/TextField';
|
||||||
|
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%',
|
||||||
width: '100%',
|
height: '32px',
|
||||||
height: '32px',
|
position: 'relative',
|
||||||
position: 'relative',
|
zIndex: 1,
|
||||||
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 */
|
||||||
export const InputField: React.FC<InputFieldProps> = ({ color, ...others }) => (
|
// @ts-ignore types of color are incompatible
|
||||||
<TextField
|
export const InputField: React.FC<InputFieldProps> = ({ ...others }) => <StyledTextField {...others} />;
|
||||||
{...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',
|
||||||
maxHeight: '500px',
|
overflowY: 'auto',
|
||||||
overflowY: 'auto',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ export interface AvatarDeveloper {
|
|||||||
|
|
||||||
const AvatarTooltip: FC<AvatarDeveloper> = ({ name, packageName, version, avatar, email }) => {
|
const AvatarTooltip: FC<AvatarDeveloper> = ({ name, packageName, version, avatar, email }) => {
|
||||||
const avatarComponent = <Avatar aria-label={name} src={avatar} />;
|
const avatarComponent = <Avatar aria-label={name} src={avatar} />;
|
||||||
function renderLinkForMail(email: string, avatarComponent: JSX.Element, packageName: string, version: string): JSX.Element {
|
function renderLinkForMail(
|
||||||
|
email: string,
|
||||||
|
avatarComponent: JSX.Element,
|
||||||
|
packageName: string,
|
||||||
|
version: string
|
||||||
|
): JSX.Element {
|
||||||
if (!email || isEmail(email) === false) {
|
if (!email || isEmail(email) === false) {
|
||||||
return avatarComponent;
|
return avatarComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount, ReactWrapper } from 'enzyme';
|
import { 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';
|
||||||
@@ -16,7 +17,7 @@ describe('<CopyToClipBoard /> component', () => {
|
|||||||
wrapper = mount(<CopyToClipBoard text={copyText} />);
|
wrapper = mount(<CopyToClipBoard text={copyText} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('render the component', () => {
|
test('should load the component in default state', () => {
|
||||||
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 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>"`;
|
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>"`;
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
import styled from 'react-emotion';
|
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',
|
||||||
display: 'flex',
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
justifyContent: 'space-between',
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ClipBoardCopyText = styled('span')({
|
export const ClipBoardCopyText = styled('span')({
|
||||||
'&&': {
|
display: 'inline-block',
|
||||||
display: 'inline-block',
|
textOverflow: 'ellipsis',
|
||||||
textOverflow: 'ellipsis',
|
overflow: 'hidden',
|
||||||
overflow: 'hidden',
|
whiteSpace: 'nowrap',
|
||||||
whiteSpace: 'nowrap',
|
height: '21px',
|
||||||
height: '21px',
|
fontSize: '1rem',
|
||||||
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,7 +1,7 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
|
||||||
|
|
||||||
|
import CardContent from '../../muiComponents/CardContent';
|
||||||
import { PackageDependencies } from '../../../types/packageMeta';
|
import { PackageDependencies } from '../../../types/packageMeta';
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import NoItems from '../NoItems';
|
import NoItems from '../NoItems';
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import Chip from '@material-ui/core/Chip';
|
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
import Card from '../../muiComponents/Card';
|
import Card from '../../muiComponents/Card';
|
||||||
|
import Chip from '../../muiComponents/Chip';
|
||||||
|
|
||||||
export const CardWrap = styled(Card)({
|
export const CardWrap = styled(Card)({
|
||||||
'&&': {
|
margin: '0 0 16px',
|
||||||
margin: '0 0 16px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
@@ -17,16 +15,12 @@ export const StyledText = styled(Text)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const Tags = styled('div')({
|
export const Tags = styled('div')({
|
||||||
'&&': {
|
display: 'flex',
|
||||||
display: 'flex',
|
justifyContent: 'start',
|
||||||
justifyContent: 'start',
|
flexWrap: 'wrap',
|
||||||
flexWrap: 'wrap',
|
margin: '0 -5px',
|
||||||
margin: '0 -5px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Tag = styled(Chip)({
|
export const Tag = styled(Chip)({
|
||||||
'&&': {
|
margin: '5px',
|
||||||
margin: '5px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +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 DetailContainer from './DetailContainer';
|
import DetailContainer from './DetailContainer';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback, useState, ChangeEvent, useContext } from 'react';
|
import React, { useCallback, useState, ChangeEvent, useContext } from 'react';
|
||||||
import Box from '@material-ui/core/Box';
|
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
import Box from '../../muiComponents/Box';
|
||||||
|
|
||||||
import DetailContainerTabs from './DetailContainerTabs';
|
import DetailContainerTabs from './DetailContainerTabs';
|
||||||
import DetailContainerContent from './DetailContainerContent';
|
import DetailContainerContent from './DetailContainerContent';
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import React, { ChangeEvent, useState, useEffect } from 'react';
|
import React, { ChangeEvent, useState, useEffect } from 'react';
|
||||||
import { default as MuiTabs } from '@material-ui/core/Tabs';
|
import styled from '@emotion/styled';
|
||||||
import Tab from '@material-ui/core/Tab';
|
|
||||||
import styled from 'react-emotion';
|
import { default as MuiTabs } from '../../muiComponents/Tabs';
|
||||||
|
import Tab from '../../muiComponents/Tab';
|
||||||
|
|
||||||
import { TabPosition } from './tabs';
|
import { TabPosition } from './tabs';
|
||||||
|
|
||||||
@@ -14,7 +15,8 @@ const Tabs = styled(MuiTabs)({
|
|||||||
marginBottom: 16,
|
marginBottom: 16,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTabIndex = (tabPosition: TabPosition): number => Object.keys(TabPosition).findIndex(position => position === String(tabPosition).toUpperCase());
|
const getTabIndex = (tabPosition: TabPosition): number =>
|
||||||
|
Object.keys(TabPosition).findIndex(position => position === String(tabPosition).toUpperCase());
|
||||||
|
|
||||||
const DetailContainerTabs: React.FC<Props> = ({ tabPosition, onChangeTabPosition }) => {
|
const DetailContainerTabs: React.FC<Props> = ({ tabPosition, onChangeTabPosition }) => {
|
||||||
const [tabPositionIndex, setTabPositionIndex] = useState(0);
|
const [tabPositionIndex, setTabPositionIndex] = useState(0);
|
||||||
@@ -25,7 +27,12 @@ const DetailContainerTabs: React.FC<Props> = ({ tabPosition, onChangeTabPosition
|
|||||||
}, [tabPosition]);
|
}, [tabPosition]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs indicatorColor={'primary'} onChange={onChangeTabPosition} textColor={'primary'} value={tabPositionIndex} variant={'fullWidth'}>
|
<Tabs
|
||||||
|
indicatorColor={'primary'}
|
||||||
|
onChange={onChangeTabPosition}
|
||||||
|
textColor={'primary'}
|
||||||
|
value={tabPositionIndex}
|
||||||
|
variant={'fullWidth'}>
|
||||||
<Tab data-testid={'readme-tab'} id={'readme-tab'} label={TabPosition.README} />
|
<Tab data-testid={'readme-tab'} id={'readme-tab'} label={TabPosition.README} />
|
||||||
<Tab data-testid={'dependencies-tab'} id={'dependencies-tab'} label={TabPosition.DEPENDENCIES} />
|
<Tab data-testid={'dependencies-tab'} id={'dependencies-tab'} label={TabPosition.DEPENDENCIES} />
|
||||||
<Tab data-testid={'versions-tab'} id={'versions-tab'} label={TabPosition.VERSIONS} />
|
<Tab data-testid={'versions-tab'} id={'versions-tab'} label={TabPosition.VERSIONS} />
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
// 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 css-1qm1lh emotion-0"
|
class="MuiTabs-root emotion-0 emotion-1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiTabs-scroller MuiTabs-fixed"
|
class="MuiTabs-scroller MuiTabs-fixed"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { ReactElement } from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
|
||||||
|
|
||||||
import { ActionBar } from '../ActionBar/ActionBar';
|
import { ActionBar } from '../ActionBar/ActionBar';
|
||||||
import Author from '../Author';
|
import Author from '../Author';
|
||||||
@@ -11,10 +10,11 @@ import Repository from '../Repository/Repository';
|
|||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import List from '../../muiComponents/List';
|
import List from '../../muiComponents/List';
|
||||||
import Card from '../../muiComponents/Card';
|
import Card from '../../muiComponents/Card';
|
||||||
|
import CardContent from '../../muiComponents/CardContent';
|
||||||
|
|
||||||
import { TitleListItem, TitleListItemText, PackageDescription, PackageVersion } from './styles';
|
import { TitleListItem, TitleListItemText, PackageDescription, PackageVersion } from './styles';
|
||||||
|
|
||||||
const renderLatestDescription = (description, version, isLatest: boolean = true): JSX.Element => {
|
const renderLatestDescription = (description, version, isLatest = true): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PackageDescription>{description}</PackageDescription>
|
<PackageDescription>{description}</PackageDescription>
|
||||||
@@ -42,7 +42,10 @@ const renderTitle = (packageName, packageVersion, packageMeta): JSX.Element => {
|
|||||||
return (
|
return (
|
||||||
<List className="detail-info">
|
<List className="detail-info">
|
||||||
<TitleListItem alignItems="flex-start" button={true}>
|
<TitleListItem alignItems="flex-start" button={true}>
|
||||||
<TitleListItemText primary={<b>{packageName}</b>} secondary={renderLatestDescription(packageMeta.latest.description, version, isLatest)} />
|
<TitleListItemText
|
||||||
|
primary={<b>{packageName}</b>}
|
||||||
|
secondary={renderLatestDescription(packageMeta.latest.description, version, isLatest)}
|
||||||
|
/>
|
||||||
</TitleListItem>
|
</TitleListItem>
|
||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
|
||||||
export const TitleListItem = styled(ListItem)({
|
export const TitleListItem = styled(ListItem)({
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
@@ -10,21 +10,15 @@ export const TitleListItem = styled(ListItem)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const TitleListItemText = styled(ListItemText)({
|
export const TitleListItemText = styled(ListItemText)({
|
||||||
'&&': {
|
paddingLeft: 0,
|
||||||
paddingLeft: 0,
|
paddingRight: 0,
|
||||||
paddingRight: 0,
|
paddingTop: '8px',
|
||||||
paddingTop: '8px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PackageDescription = styled('span')({
|
export const PackageDescription = styled('span')({
|
||||||
'&&': {
|
display: 'block',
|
||||||
display: 'block',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PackageVersion = styled('span')({
|
export const PackageVersion = styled('span')({
|
||||||
'&&': {
|
display: 'block',
|
||||||
display: 'block',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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,22 +1,57 @@
|
|||||||
// 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"
|
||||||
>
|
>
|
||||||
<Styled(Component)
|
<StyledText
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Text)
|
<ForwardRef(Text)
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<WithStyles(ForwardRef(Typography))
|
<WithStyles(ForwardRef(Typography))
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Typography)
|
<ForwardRef(Typography)
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
"alignCenter": "MuiTypography-alignCenter",
|
"alignCenter": "MuiTypography-alignCenter",
|
||||||
@@ -54,23 +89,23 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<h6
|
<h6
|
||||||
className="MuiTypography-root css-48zeoi emotion-0 MuiTypography-subtitle1"
|
className="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
contributors
|
contributors
|
||||||
</h6>
|
</h6>
|
||||||
</ForwardRef(Typography)>
|
</ForwardRef(Typography)>
|
||||||
</WithStyles(ForwardRef(Typography))>
|
</WithStyles(ForwardRef(Typography))>
|
||||||
</ForwardRef(Text)>
|
</ForwardRef(Text)>
|
||||||
</Styled(Component)>
|
</StyledText>
|
||||||
<Styled(div)>
|
<Content>
|
||||||
<div
|
<div
|
||||||
className="css-mkcn9c emotion-6"
|
className="emotion-12 emotion-13"
|
||||||
>
|
>
|
||||||
<Styled(span)
|
<Details
|
||||||
key="dave.methvin@gmail.com"
|
key="dave.methvin@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="css-dvxtzn emotion-4"
|
className="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="dave.methvin@gmail.com"
|
email="dave.methvin@gmail.com"
|
||||||
@@ -122,15 +157,18 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
|
"circle": "MuiAvatar-circle",
|
||||||
"colorDefault": "MuiAvatar-colorDefault",
|
"colorDefault": "MuiAvatar-colorDefault",
|
||||||
"img": "MuiAvatar-img",
|
"img": "MuiAvatar-img",
|
||||||
"root": "MuiAvatar-root",
|
"root": "MuiAvatar-root",
|
||||||
|
"rounded": "MuiAvatar-rounded",
|
||||||
|
"square": "MuiAvatar-square",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
className="MuiAvatar-root MuiAvatar-colorDefault"
|
className="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</ForwardRef(Avatar)>
|
</ForwardRef(Avatar)>
|
||||||
</WithStyles(ForwardRef(Avatar))>
|
</WithStyles(ForwardRef(Avatar))>
|
||||||
@@ -146,7 +184,7 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
class="MuiAvatar-root MuiAvatar-colorDefault"
|
class="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@@ -161,12 +199,12 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Styled(span)>
|
</Details>
|
||||||
<Styled(span)
|
<Details
|
||||||
key="m.goleb@gmail.com"
|
key="m.goleb@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="css-dvxtzn emotion-4"
|
className="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="m.goleb@gmail.com"
|
email="m.goleb@gmail.com"
|
||||||
@@ -218,15 +256,18 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
|
"circle": "MuiAvatar-circle",
|
||||||
"colorDefault": "MuiAvatar-colorDefault",
|
"colorDefault": "MuiAvatar-colorDefault",
|
||||||
"img": "MuiAvatar-img",
|
"img": "MuiAvatar-img",
|
||||||
"root": "MuiAvatar-root",
|
"root": "MuiAvatar-root",
|
||||||
|
"rounded": "MuiAvatar-rounded",
|
||||||
|
"square": "MuiAvatar-square",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
className="MuiAvatar-root MuiAvatar-colorDefault"
|
className="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</ForwardRef(Avatar)>
|
</ForwardRef(Avatar)>
|
||||||
</WithStyles(ForwardRef(Avatar))>
|
</WithStyles(ForwardRef(Avatar))>
|
||||||
@@ -242,7 +283,7 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
class="MuiAvatar-root MuiAvatar-colorDefault"
|
class="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@@ -257,29 +298,64 @@ exports[`test Developers should render the component for contributors with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Styled(span)>
|
</Details>
|
||||||
</div>
|
</div>
|
||||||
</Styled(div)>
|
</Content>
|
||||||
</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"
|
||||||
>
|
>
|
||||||
<Styled(Component)
|
<StyledText
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Text)
|
<ForwardRef(Text)
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<WithStyles(ForwardRef(Typography))
|
<WithStyles(ForwardRef(Typography))
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<ForwardRef(Typography)
|
<ForwardRef(Typography)
|
||||||
className="css-48zeoi emotion-0"
|
className="emotion-0 emotion-1"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
"alignCenter": "MuiTypography-alignCenter",
|
"alignCenter": "MuiTypography-alignCenter",
|
||||||
@@ -317,23 +393,23 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
<h6
|
<h6
|
||||||
className="MuiTypography-root css-48zeoi emotion-0 MuiTypography-subtitle1"
|
className="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
maintainers
|
maintainers
|
||||||
</h6>
|
</h6>
|
||||||
</ForwardRef(Typography)>
|
</ForwardRef(Typography)>
|
||||||
</WithStyles(ForwardRef(Typography))>
|
</WithStyles(ForwardRef(Typography))>
|
||||||
</ForwardRef(Text)>
|
</ForwardRef(Text)>
|
||||||
</Styled(Component)>
|
</StyledText>
|
||||||
<Styled(div)>
|
<Content>
|
||||||
<div
|
<div
|
||||||
className="css-mkcn9c emotion-6"
|
className="emotion-12 emotion-13"
|
||||||
>
|
>
|
||||||
<Styled(span)
|
<Details
|
||||||
key="dave.methvin@gmail.com"
|
key="dave.methvin@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="css-dvxtzn emotion-4"
|
className="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="dave.methvin@gmail.com"
|
email="dave.methvin@gmail.com"
|
||||||
@@ -385,15 +461,18 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
|
"circle": "MuiAvatar-circle",
|
||||||
"colorDefault": "MuiAvatar-colorDefault",
|
"colorDefault": "MuiAvatar-colorDefault",
|
||||||
"img": "MuiAvatar-img",
|
"img": "MuiAvatar-img",
|
||||||
"root": "MuiAvatar-root",
|
"root": "MuiAvatar-root",
|
||||||
|
"rounded": "MuiAvatar-rounded",
|
||||||
|
"square": "MuiAvatar-square",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
className="MuiAvatar-root MuiAvatar-colorDefault"
|
className="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</ForwardRef(Avatar)>
|
</ForwardRef(Avatar)>
|
||||||
</WithStyles(ForwardRef(Avatar))>
|
</WithStyles(ForwardRef(Avatar))>
|
||||||
@@ -409,7 +488,7 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="dmethvin"
|
aria-label="dmethvin"
|
||||||
class="MuiAvatar-root MuiAvatar-colorDefault"
|
class="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@@ -424,12 +503,12 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Styled(span)>
|
</Details>
|
||||||
<Styled(span)
|
<Details
|
||||||
key="m.goleb@gmail.com"
|
key="m.goleb@gmail.com"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="css-dvxtzn emotion-4"
|
className="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<AvatarTooltip
|
<AvatarTooltip
|
||||||
email="m.goleb@gmail.com"
|
email="m.goleb@gmail.com"
|
||||||
@@ -481,15 +560,18 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
classes={
|
classes={
|
||||||
Object {
|
Object {
|
||||||
|
"circle": "MuiAvatar-circle",
|
||||||
"colorDefault": "MuiAvatar-colorDefault",
|
"colorDefault": "MuiAvatar-colorDefault",
|
||||||
"img": "MuiAvatar-img",
|
"img": "MuiAvatar-img",
|
||||||
"root": "MuiAvatar-root",
|
"root": "MuiAvatar-root",
|
||||||
|
"rounded": "MuiAvatar-rounded",
|
||||||
|
"square": "MuiAvatar-square",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
className="MuiAvatar-root MuiAvatar-colorDefault"
|
className="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</ForwardRef(Avatar)>
|
</ForwardRef(Avatar)>
|
||||||
</WithStyles(ForwardRef(Avatar))>
|
</WithStyles(ForwardRef(Avatar))>
|
||||||
@@ -505,7 +587,7 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="mgol"
|
aria-label="mgol"
|
||||||
class="MuiAvatar-root MuiAvatar-colorDefault"
|
class="MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@@ -520,9 +602,9 @@ exports[`test Developers should render the component for maintainers with items
|
|||||||
</ForwardRef(ToolTip)>
|
</ForwardRef(ToolTip)>
|
||||||
</AvatarTooltip>
|
</AvatarTooltip>
|
||||||
</span>
|
</span>
|
||||||
</Styled(span)>
|
</Details>
|
||||||
</div>
|
</div>
|
||||||
</Styled(div)>
|
</Content>
|
||||||
</Developers>
|
</Developers>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiFab } from '@material-ui/core/Fab';
|
|
||||||
|
|
||||||
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 { Theme } from '../../design-tokens/theme';
|
||||||
|
|
||||||
export const Details = styled('span')({
|
export const Details = styled('span')({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -26,9 +26,7 @@ export const StyledText = styled(Text)({
|
|||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Fab = styled(MuiFab)({
|
export const Fab = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
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-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-z8a2h0 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-1le6jk6 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-1le6jk6 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-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 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-z8a2h0 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-1le6jk6 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-1le6jk6 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-1le6jk6 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-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-z8a2h0 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-1le6jk6 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-1le6jk6 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-1le6jk6 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>"`;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiFab } from '@material-ui/core/Fab';
|
|
||||||
import Chip from '@material-ui/core/Chip';
|
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import { Theme } from '../../design-tokens/theme';
|
||||||
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';
|
||||||
|
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
||||||
|
import Chip from '../../muiComponents/Chip';
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
@@ -13,22 +13,16 @@ export const StyledText = styled(Text)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const DistListItem = styled(ListItem)({
|
export const DistListItem = styled(ListItem)({
|
||||||
'&&': {
|
paddingLeft: 0,
|
||||||
paddingLeft: 0,
|
paddingRight: 0,
|
||||||
paddingRight: 0,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const DistChips = styled(Chip)({
|
export const DistChips = styled(Chip)({
|
||||||
'&&': {
|
marginRight: 5,
|
||||||
marginRight: '5px',
|
textTransform: 'capitalize',
|
||||||
textTransform: 'capitalize',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const DownloadButton = styled(MuiFab)({
|
export const DownloadButton = styled(FloatingActionButton)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
backgroundColor: props.theme && props.theme.palette.primary.main,
|
||||||
backgroundColor: colors.primary,
|
color: props.theme && props.theme.palette.white,
|
||||||
color: colors.white,
|
}));
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,71 +1,61 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
|
||||||
|
import { mount } from '../../utils/test-enzyme';
|
||||||
|
import { DetailContext } from '../../pages/Version';
|
||||||
|
import { PackageMetaInterface } from '../../../types/packageMeta';
|
||||||
|
|
||||||
import Engine from './Engines';
|
import Engine from './Engines';
|
||||||
|
|
||||||
jest.mock('./img/node.png', () => '');
|
jest.mock('./img/node.png', () => '');
|
||||||
jest.mock('../Install/img/npm.svg', () => '');
|
jest.mock('../Install/img/npm.svg', () => '');
|
||||||
|
|
||||||
const mockPackageMeta: jest.Mock = jest.fn(() => ({
|
const mockPackageMeta = (engines?: PackageMetaInterface['latest']['engines']): PackageMetaInterface => ({
|
||||||
latest: {
|
latest: {
|
||||||
homepage: 'https://verdaccio.tld',
|
name: 'verdaccio',
|
||||||
bugs: {
|
version: '0.0.0',
|
||||||
url: 'https://verdaccio.tld/bugs',
|
|
||||||
},
|
|
||||||
dist: {
|
dist: {
|
||||||
tarball: 'https://verdaccio.tld/download',
|
fileCount: 1,
|
||||||
|
unpackedSize: 1,
|
||||||
},
|
},
|
||||||
|
...(engines && { engines }),
|
||||||
},
|
},
|
||||||
}));
|
_uplinks: {},
|
||||||
|
});
|
||||||
jest.mock('../../pages/Version', () => ({
|
|
||||||
DetailContextConsumer: component => {
|
|
||||||
return component.children({ packageMeta: mockPackageMeta() });
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('<Engines /> component', () => {
|
describe('<Engines /> component', () => {
|
||||||
beforeEach(() => {
|
|
||||||
jest.resetAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should render the component in default state', () => {
|
test('should render the component in default state', () => {
|
||||||
const packageMeta = {
|
const packageMeta = mockPackageMeta({
|
||||||
latest: {
|
node: '>= 0.1.98',
|
||||||
engines: {
|
npm: '>3',
|
||||||
node: '>= 0.1.98',
|
});
|
||||||
npm: '>3',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
mockPackageMeta.mockImplementation(() => packageMeta);
|
const wrapper = mount(
|
||||||
|
<DetailContext.Provider value={{ packageMeta }}>
|
||||||
const wrapper = mount(<Engine />);
|
<Engine />
|
||||||
|
</DetailContext.Provider>
|
||||||
|
);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render the component when there is no engine key in package meta', () => {
|
test('should render the component when there is no engine key in package meta', () => {
|
||||||
const packageMeta = {
|
const packageMeta = mockPackageMeta();
|
||||||
latest: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
mockPackageMeta.mockImplementation(() => packageMeta);
|
const wrapper = mount(
|
||||||
|
<DetailContext.Provider value={{ packageMeta }}>
|
||||||
const wrapper = mount(<Engine />);
|
<Engine />
|
||||||
expect(wrapper.html()).toEqual('');
|
</DetailContext.Provider>
|
||||||
|
);
|
||||||
|
expect(wrapper.html()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render the component when there is no keys in engine in package meta', () => {
|
test('should render the component when there is no keys in engine in package meta', () => {
|
||||||
const packageMeta = {
|
const packageMeta = mockPackageMeta({});
|
||||||
latest: {
|
|
||||||
engines: {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
mockPackageMeta.mockImplementation(() => packageMeta);
|
const wrapper = mount(
|
||||||
|
<DetailContext.Provider value={{ packageMeta }}>
|
||||||
const wrapper = mount(<Engine />);
|
<Engine />
|
||||||
expect(wrapper.html()).toEqual('');
|
</DetailContext.Provider>
|
||||||
|
);
|
||||||
|
expect(wrapper.html()).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,73 +1,51 @@
|
|||||||
import React, { Component, ReactElement } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import Grid from '@material-ui/core/Grid';
|
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import { VersionPageConsumerProps, DetailContextConsumer } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
import List from '../../muiComponents/List';
|
import List from '../../muiComponents/List';
|
||||||
import npm from '../Install/img/npm.svg';
|
import npm from '../Install/img/npm.svg';
|
||||||
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
import Grid from '../../muiComponents/Grid';
|
||||||
|
|
||||||
import { StyledText, EngineListItem } from './styles';
|
import { StyledText, EngineListItem } from './styles';
|
||||||
// @ts-ignore
|
|
||||||
import node from './img/node.png';
|
import node from './img/node.png';
|
||||||
|
|
||||||
const ICONS = {
|
const Engine: React.FC = () => {
|
||||||
'node-JS': <Avatar src={node} />,
|
const { packageMeta } = useContext(DetailContext);
|
||||||
'NPM-version': <Avatar src={npm} />,
|
|
||||||
};
|
|
||||||
|
|
||||||
class Engine extends Component {
|
const engines = packageMeta && packageMeta.latest && packageMeta.latest.engines;
|
||||||
public render(): ReactElement<HTMLElement> {
|
|
||||||
return (
|
if (!engines || (!engines.node && !engines.npm)) {
|
||||||
<DetailContextConsumer>
|
return null;
|
||||||
{context => {
|
|
||||||
return this.renderEngine(context as VersionPageConsumerProps);
|
|
||||||
}}
|
|
||||||
</DetailContextConsumer>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderEngine = ({ packageMeta }): ReactElement<HTMLElement> | null => {
|
/* eslint-disable react/jsx-max-depth */
|
||||||
const { engines } = packageMeta.latest;
|
return (
|
||||||
if (!engines) {
|
<Grid container={true}>
|
||||||
return null;
|
{engines.node && (
|
||||||
}
|
<Grid item={true} xs={6}>
|
||||||
|
<List subheader={<StyledText variant={'subtitle1'}>{'node JS'}</StyledText>}>
|
||||||
|
<EngineListItem button={true}>
|
||||||
|
<Avatar src={node} />
|
||||||
|
<ListItemText primary={engines.node} />
|
||||||
|
</EngineListItem>
|
||||||
|
</List>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
|
|
||||||
const engineDict = {
|
{engines.npm && (
|
||||||
'node-JS': engines.node,
|
<Grid item={true} xs={6}>
|
||||||
'NPM-version': engines.npm,
|
<List subheader={<StyledText variant={'subtitle1'}>{'NPM version'}</StyledText>}>
|
||||||
};
|
<EngineListItem button={true}>
|
||||||
|
<Avatar src={npm} />
|
||||||
const accumulator: React.ReactNode[] = [];
|
<ListItemText primary={engines.npm} />
|
||||||
const items = Object.keys(engineDict).reduce((markup, text, key) => {
|
</EngineListItem>
|
||||||
const heading = engineDict[text];
|
</List>
|
||||||
if (heading) {
|
</Grid>
|
||||||
markup.push(
|
)}
|
||||||
<Grid item={true} key={key} xs={6}>
|
</Grid>
|
||||||
{this.renderListItems(heading, text)}
|
);
|
||||||
</Grid>
|
/* eslint-enable react/jsx-max-depth */
|
||||||
);
|
};
|
||||||
}
|
|
||||||
return markup;
|
|
||||||
}, accumulator);
|
|
||||||
|
|
||||||
if (items.length < 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Grid container={true}>{items}</Grid>;
|
|
||||||
};
|
|
||||||
|
|
||||||
private renderListItems = (heading: string, text: string) => {
|
|
||||||
return (
|
|
||||||
<List subheader={<StyledText variant={'subtitle1'}>{text.split('-').join(' ')}</StyledText>}>
|
|
||||||
<EngineListItem button={true}>
|
|
||||||
{ICONS[text]}
|
|
||||||
<ListItemText primary={heading} />
|
|
||||||
</EngineListItem>
|
|
||||||
</List>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Engine;
|
export default Engine;
|
||||||
|
|||||||
@@ -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-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-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-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-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>"`;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
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';
|
||||||
|
|
||||||
jest.mock('../../../package.json', () => ({
|
|
||||||
version: '4.0.0-alpha.3',
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('<Footer /> component', () => {
|
describe('<Footer /> component', () => {
|
||||||
let wrapper: ReactWrapper;
|
beforeAll(() => {
|
||||||
beforeEach(() => {
|
|
||||||
window.VERDACCIO_VERSION = 'v.1.0.0';
|
window.VERDACCIO_VERSION = 'v.1.0.0';
|
||||||
wrapper = mount(<Footer />);
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
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', () => {
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
const { container } = render(<Footer />);
|
||||||
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,274 @@
|
|||||||
// 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`] = `"<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-tsfgle ek145dl0\\"><title>Earth</title><use xlink:href=\\"[object Object]#earth\\"></use></svg><span class=\\"css-8631ip ezbsl486\\"><svg class=\\"ezbsl488 css-13b76ay ek145dl0\\"><title>Spain</title><use xlink:href=\\"[object Object]#spain\\"></use></svg><svg class=\\"ezbsl488 css-13b76ay ek145dl0\\"><title>Nicaragua</title><use xlink:href=\\"[object Object]#nicaragua\\"></use></svg><svg class=\\"ezbsl488 css-13b76ay ek145dl0\\"><title>India</title><use xlink:href=\\"[object Object]#india\\"></use></svg><svg class=\\"ezbsl488 css-13b76ay ek145dl0\\"><title>Brazil</title><use xlink:href=\\"[object Object]#brazil\\"></use></svg><svg class=\\"ezbsl488 css-13b76ay ek145dl0\\"><title>China</title><use xlink:href=\\"[object Object]#china\\"></use></svg><svg class=\\"ezbsl488 css-13b76ay 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-i15wza ek145dl1\\" name=\\"verdaccio\\" title=\\"Verdaccio\\"><img alt=\\"Verdaccio\\" src=\\"[object Object]\\" class=\\"css-1ncdhax ek145dl2\\"></span>/ v.1.0.0</div></div></div>"`;
|
exports[`<Footer /> component should load the initial state of Footer component 1`] = `
|
||||||
|
.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,110 +1,88 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import mq from '../../utils/styles/media';
|
import { breakpoints } from '../../utils/styles/media';
|
||||||
import Icon from '../Icon/Icon';
|
import Icon from '../Icon/Icon';
|
||||||
import colors from '../../utils/styles/colors';
|
import { Theme } from '../../design-tokens/theme';
|
||||||
|
|
||||||
export const Wrapper = styled('div')({
|
export const Wrapper = styled('div')<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
background: props.theme && props.theme.palette.snow,
|
||||||
background: colors.snow,
|
borderTop: `1px solid ${props.theme && props.theme.palette.greyGainsboro}`,
|
||||||
borderTop: `1px solid ${colors.greyGainsboro}`,
|
color: props.theme && props.theme.palette.nobel01,
|
||||||
color: colors.nobel01,
|
fontSize: '14px',
|
||||||
fontSize: '14px',
|
padding: '20px',
|
||||||
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 Inner = styled('div')`
|
export const Left = styled('div')({
|
||||||
&& {
|
alignItems: 'center',
|
||||||
display: flex;
|
display: 'none',
|
||||||
align-items: center;
|
[`@media (min-width: ${breakpoints.medium}px)`]: {
|
||||||
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 ToolTip = styled('span')({
|
export const Right = styled(Left)({
|
||||||
'&&': {
|
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 Flags = styled('span')`
|
export const Love = styled('span')<{ theme?: Theme }>(props => ({
|
||||||
&& {
|
color: props.theme && props.theme.palette.love,
|
||||||
position: absolute;
|
padding: '0 5px',
|
||||||
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,6 +1,7 @@
|
|||||||
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';
|
||||||
|
|
||||||
@@ -17,7 +18,11 @@ describe('<Header /> component with logged in state', () => {
|
|||||||
test('should load the component in logged out state', () => {
|
test('should load the component in logged out state', () => {
|
||||||
const { container, queryByTestId, getByText } = render(
|
const { container, queryByTestId, getByText } = render(
|
||||||
<Router>
|
<Router>
|
||||||
<Header onLogout={headerProps.handleLogout} onToggleLoginModal={headerProps.handleToggleLoginModal} scope={headerProps.scope} />
|
<Header
|
||||||
|
onLogout={headerProps.handleLogout}
|
||||||
|
onToggleLoginModal={headerProps.handleToggleLoginModal}
|
||||||
|
scope={headerProps.scope}
|
||||||
|
/>
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -46,7 +51,11 @@ describe('<Header /> component with logged in state', () => {
|
|||||||
test('should open login dialog', async () => {
|
test('should open login dialog', async () => {
|
||||||
const { getByText } = render(
|
const { getByText } = render(
|
||||||
<Router>
|
<Router>
|
||||||
<Header onLogout={headerProps.handleLogout} onToggleLoginModal={headerProps.handleToggleLoginModal} scope={headerProps.scope} />
|
<Header
|
||||||
|
onLogout={headerProps.handleLogout}
|
||||||
|
onToggleLoginModal={headerProps.handleToggleLoginModal}
|
||||||
|
scope={headerProps.scope}
|
||||||
|
/>
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -131,7 +140,9 @@ describe('<Header /> component with logged in state', () => {
|
|||||||
const closeBtn = await waitForElement(() => getByText('CLOSE'));
|
const closeBtn = await waitForElement(() => getByText('CLOSE'));
|
||||||
fireEvent.click(closeBtn);
|
fireEvent.click(closeBtn);
|
||||||
|
|
||||||
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() => queryByTestId('registryInfo--dialog'));
|
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() =>
|
||||||
|
queryByTestId('registryInfo--dialog')
|
||||||
|
);
|
||||||
expect(hasRegistrationInfoModalBeenRemoved).toBeTruthy();
|
expect(hasRegistrationInfoModalBeenRemoved).toBeTruthy();
|
||||||
});
|
});
|
||||||
test.todo('autocompletion should display suggestions according to the type value');
|
test.todo('autocompletion should display suggestions according to the type value');
|
||||||
|
|||||||
@@ -38,14 +38,21 @@ const Header: React.FC<Props> = ({ logo, withoutSearch, username, onLogout, onTo
|
|||||||
withoutSearch={withoutSearch}
|
withoutSearch={withoutSearch}
|
||||||
/>
|
/>
|
||||||
</InnerNavBar>
|
</InnerNavBar>
|
||||||
<HeaderInfoDialog isOpen={isInfoDialogOpen} onCloseDialog={() => setOpenInfoDialog(false)} registryUrl={getRegistryURL()} scope={scope} />
|
<HeaderInfoDialog
|
||||||
|
isOpen={isInfoDialogOpen}
|
||||||
|
onCloseDialog={() => setOpenInfoDialog(false)}
|
||||||
|
registryUrl={getRegistryURL()}
|
||||||
|
scope={scope}
|
||||||
|
/>
|
||||||
</NavBar>
|
</NavBar>
|
||||||
{showMobileNavBar && !withoutSearch && (
|
{showMobileNavBar && !withoutSearch && (
|
||||||
<MobileNavBar>
|
<MobileNavBar>
|
||||||
<InnerMobileNavBar>
|
<InnerMobileNavBar>
|
||||||
<Search />
|
<Search />
|
||||||
</InnerMobileNavBar>
|
</InnerMobileNavBar>
|
||||||
<Button color="inherit">{'Cancel'}</Button>
|
<Button color="inherit" onClick={() => setShowMobileNavBar(false)}>
|
||||||
|
{'Cancel'}
|
||||||
|
</Button>
|
||||||
</MobileNavBar>
|
</MobileNavBar>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from 'emotion';
|
import styled from '@emotion/styled';
|
||||||
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>
|
||||||
<Link
|
<StyledLink to={'/'}>
|
||||||
className={css`
|
|
||||||
margin-right: 1em;
|
|
||||||
`}
|
|
||||||
to={'/'}>
|
|
||||||
<HeaderLogo logo={logo} />
|
<HeaderLogo logo={logo} />
|
||||||
</Link>
|
</StyledLink>
|
||||||
{!withoutSearch && (
|
{!withoutSearch && (
|
||||||
<SearchWrapper>
|
<SearchWrapper>
|
||||||
<Search />
|
<Search />
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { MouseEvent } from 'react';
|
import React, { MouseEvent } from 'react';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
|
||||||
import Menu from '@material-ui/core/Menu';
|
|
||||||
import AccountCircle from '@material-ui/icons/AccountCircle';
|
import AccountCircle from '@material-ui/icons/AccountCircle';
|
||||||
|
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
|
import MenuItem from '../../muiComponents/MenuItem';
|
||||||
|
import Menu from '../../muiComponents/Menu';
|
||||||
|
|
||||||
import HeaderGreetings from './HeaderGreetings';
|
import HeaderGreetings from './HeaderGreetings';
|
||||||
|
|
||||||
@@ -17,9 +17,20 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable react/jsx-max-depth */
|
/* eslint-disable react/jsx-max-depth */
|
||||||
const HeaderMenu: React.FC<Props> = ({ onLogout, username, isMenuOpen = false, anchorEl, onLoggedInMenu, onLoggedInMenuClose }) => (
|
const HeaderMenu: React.FC<Props> = ({
|
||||||
|
onLogout,
|
||||||
|
username,
|
||||||
|
isMenuOpen = false,
|
||||||
|
anchorEl,
|
||||||
|
onLoggedInMenu,
|
||||||
|
onLoggedInMenuClose,
|
||||||
|
}) => (
|
||||||
<>
|
<>
|
||||||
<IconButton color="inherit" data-testid="header--menu-acountcircle" id="header--button-account" onClick={onLoggedInMenu}>
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
data-testid="header--menu-acountcircle"
|
||||||
|
id="header--button-account"
|
||||||
|
onClick={onLoggedInMenu}>
|
||||||
<AccountCircle />
|
<AccountCircle />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Menu
|
<Menu
|
||||||
@@ -28,7 +39,6 @@ const HeaderMenu: React.FC<Props> = ({ onLogout, username, isMenuOpen = false, a
|
|||||||
vertical: 'top',
|
vertical: 'top',
|
||||||
horizontal: 'right',
|
horizontal: 'right',
|
||||||
}}
|
}}
|
||||||
id="header--button-account"
|
|
||||||
onClose={onLoggedInMenuClose}
|
onClose={onLoggedInMenuClose}
|
||||||
open={isMenuOpen}
|
open={isMenuOpen}
|
||||||
transformOrigin={{
|
transformOrigin={{
|
||||||
@@ -38,7 +48,7 @@ const HeaderMenu: React.FC<Props> = ({ onLogout, username, isMenuOpen = false, a
|
|||||||
<MenuItem disabled={true}>
|
<MenuItem disabled={true}>
|
||||||
<HeaderGreetings username={username} />
|
<HeaderGreetings username={username} />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem id="header--button-logout" onClick={onLogout}>
|
<MenuItem button={true} id="header--button-logout" onClick={onLogout}>
|
||||||
{'Logout'}
|
{'Logout'}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -15,7 +15,14 @@ interface Props {
|
|||||||
onLogout: () => void;
|
onLogout: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HeaderRight: React.FC<Props> = ({ withoutSearch = false, username, onToggleLogin, onLogout, onToggleMobileNav, onOpenRegistryInfoDialog }) => {
|
const HeaderRight: React.FC<Props> = ({
|
||||||
|
withoutSearch = false,
|
||||||
|
username,
|
||||||
|
onToggleLogin,
|
||||||
|
onLogout,
|
||||||
|
onToggleMobileNav,
|
||||||
|
onOpenRegistryInfoDialog,
|
||||||
|
}) => {
|
||||||
const [anchorEl, setAnchorEl] = useState();
|
const [anchorEl, setAnchorEl] = useState();
|
||||||
const [isMenuOpen, setIsMenuOpen] = useState();
|
const [isMenuOpen, setIsMenuOpen] = useState();
|
||||||
|
|
||||||
@@ -47,7 +54,9 @@ const HeaderRight: React.FC<Props> = ({ withoutSearch = false, username, onToggl
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<RightSide>
|
<RightSide>
|
||||||
{!withoutSearch && <HeaderToolTip onClick={onToggleMobileNav} title={'Search packages'} tooltipIconType={'search'} />}
|
{!withoutSearch && (
|
||||||
|
<HeaderToolTip onClick={onToggleMobileNav} title={'Search packages'} tooltipIconType={'search'} />
|
||||||
|
)}
|
||||||
<HeaderToolTip title={'Documentation'} tooltipIconType={'help'} />
|
<HeaderToolTip title={'Documentation'} tooltipIconType={'help'} />
|
||||||
<HeaderToolTip onClick={onOpenRegistryInfoDialog} title={'Registry Information'} tooltipIconType={'info'} />
|
<HeaderToolTip onClick={onOpenRegistryInfoDialog} title={'Registry Information'} tooltipIconType={'info'} />
|
||||||
{username ? (
|
{username ? (
|
||||||
|
|||||||
@@ -1,32 +1,46 @@
|
|||||||
import React from 'react';
|
import React, { forwardRef } from 'react';
|
||||||
import Info from '@material-ui/icons/Info';
|
import Info from '@material-ui/icons/Info';
|
||||||
import Help from '@material-ui/icons/Help';
|
import Help from '@material-ui/icons/Help';
|
||||||
import Search from '@material-ui/icons/Search';
|
import Search from '@material-ui/icons/Search';
|
||||||
|
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
|
|
||||||
import { IconSearchButton, StyledExternalLink } from './styles';
|
import { IconSearchButton, StyledLink } from './styles';
|
||||||
|
|
||||||
export type TooltipIconType = 'search' | 'help' | 'info';
|
export type TooltipIconType = 'search' | 'help' | 'info';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tooltipIconType: TooltipIconType;
|
tooltipIconType: TooltipIconType;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HeaderToolTipIcon: React.FC<Props> = ({ tooltipIconType, onClick }) => {
|
type HeaderToolTipIconRef = HTMLButtonElement;
|
||||||
|
|
||||||
|
/* eslint-disable react/jsx-no-undef */
|
||||||
|
/* eslint-disable react/display-name */
|
||||||
|
const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function HeaderToolTipIcon(
|
||||||
|
{ tooltipIconType, onClick },
|
||||||
|
ref
|
||||||
|
) {
|
||||||
switch (tooltipIconType) {
|
switch (tooltipIconType) {
|
||||||
case 'help':
|
case 'help':
|
||||||
return (
|
return (
|
||||||
<StyledExternalLink blank={true} data-testid={'header--tooltip-documentation'} to={'https://verdaccio.org/docs/en/installation'}>
|
<StyledLink
|
||||||
|
data-testid={'header--tooltip-documentation'}
|
||||||
|
external={true}
|
||||||
|
to={'https://verdaccio.org/docs/en/installation'}>
|
||||||
<IconButton color={'inherit'}>
|
<IconButton color={'inherit'}>
|
||||||
<Help />
|
<Help />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</StyledExternalLink>
|
</StyledLink>
|
||||||
);
|
);
|
||||||
case 'info':
|
case 'info':
|
||||||
return (
|
return (
|
||||||
<IconButton color="inherit" data-testid={'header--tooltip-info'} id="header--button-registryInfo" onClick={onClick}>
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
data-testid={'header--tooltip-info'}
|
||||||
|
id="header--button-registryInfo"
|
||||||
|
onClick={onClick}
|
||||||
|
ref={ref}>
|
||||||
<Info />
|
<Info />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
@@ -39,6 +53,6 @@ const HeaderToolTipIcon: React.FC<Props> = ({ tooltipIconType, onClick }) => {
|
|||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
export default HeaderToolTipIcon;
|
export default HeaderToolTipIcon;
|
||||||
|
|||||||
@@ -1,28 +1,166 @@
|
|||||||
// 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 css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic emotion-24 emotion-25 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1pwdmmq emotion-8 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-22 emotion-23 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1vacr9s emotion-4 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-14 emotion-15 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="css-1dk30lc"
|
class="emotion-2 emotion-3"
|
||||||
href="/"
|
href="/"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1sifsqk emotion-0"
|
class="emotion-0 emotion-1"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="css-13zpdre emotion-3"
|
class="emotion-12 emotion-13"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1crzyyo emotion-2"
|
class="emotion-10 emotion-11"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -34,13 +172,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 MuiFormControl-fullWidth"
|
class="MuiFormControl-root MuiTextField-root react-autosuggest__input emotion-6 emotion-7 MuiFormControl-fullWidth"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root css-16qv2i2 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root emotion-4 emotion-5 MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -57,7 +195,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 css-hodoyq MuiInputBase-inputAdornedStart"
|
class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart"
|
||||||
placeholder="Search Packages"
|
placeholder="Search Packages"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
@@ -65,7 +203,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 css-cfo6a emotion-1"
|
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container emotion-8 emotion-9"
|
||||||
id="react-autowhatever-1"
|
id="react-autowhatever-1"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
/>
|
/>
|
||||||
@@ -74,10 +212,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-m61s5i emotion-7 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-20 emotion-21 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-1y1xi9f emotion-5 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root emotion-16 emotion-17 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -101,35 +239,40 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="css-1aacqdd emotion-6"
|
class="emotion-18 emotion-19"
|
||||||
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"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<button
|
<h6
|
||||||
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
class="MuiTypography-root MuiTypography-subtitle1"
|
||||||
tabindex="0"
|
|
||||||
type="button"
|
|
||||||
>
|
>
|
||||||
<span
|
<button
|
||||||
class="MuiIconButton-label"
|
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<span
|
||||||
aria-hidden="true"
|
class="MuiIconButton-label"
|
||||||
class="MuiSvgIcon-root"
|
|
||||||
focusable="false"
|
|
||||||
role="presentation"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
>
|
||||||
<path
|
<svg
|
||||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
|
aria-hidden="true"
|
||||||
/>
|
class="MuiSvgIcon-root"
|
||||||
</svg>
|
focusable="false"
|
||||||
</span>
|
role="presentation"
|
||||||
<span
|
viewBox="0 0 24 24"
|
||||||
class="MuiTouchRipple-root"
|
>
|
||||||
/>
|
<path
|
||||||
</button>
|
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="MuiTouchRipple-root"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</h6>
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
||||||
@@ -189,28 +332,166 @@ 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 css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic emotion-24 emotion-25 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1pwdmmq emotion-8 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-22 emotion-23 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1vacr9s emotion-4 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-14 emotion-15 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="css-1dk30lc"
|
class="emotion-2 emotion-3"
|
||||||
href="/"
|
href="/"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1sifsqk emotion-0"
|
class="emotion-0 emotion-1"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="css-13zpdre emotion-3"
|
class="emotion-12 emotion-13"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1crzyyo emotion-2"
|
class="emotion-10 emotion-11"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -222,13 +503,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 MuiFormControl-fullWidth"
|
class="MuiFormControl-root MuiTextField-root react-autosuggest__input emotion-6 emotion-7 MuiFormControl-fullWidth"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root css-16qv2i2 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root emotion-4 emotion-5 MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -245,7 +526,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 css-hodoyq MuiInputBase-inputAdornedStart"
|
class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedStart"
|
||||||
placeholder="Search Packages"
|
placeholder="Search Packages"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
@@ -253,7 +534,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 css-cfo6a emotion-1"
|
class="MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container emotion-8 emotion-9"
|
||||||
id="react-autowhatever-1"
|
id="react-autowhatever-1"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
/>
|
/>
|
||||||
@@ -262,10 +543,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-m61s5i emotion-7 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular emotion-20 emotion-21 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-1y1xi9f emotion-5 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root emotion-16 emotion-17 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -289,35 +570,40 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="css-1aacqdd emotion-6"
|
class="emotion-18 emotion-19"
|
||||||
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"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<button
|
<h6
|
||||||
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
class="MuiTypography-root MuiTypography-subtitle1"
|
||||||
tabindex="0"
|
|
||||||
type="button"
|
|
||||||
>
|
>
|
||||||
<span
|
<button
|
||||||
class="MuiIconButton-label"
|
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<span
|
||||||
aria-hidden="true"
|
class="MuiIconButton-label"
|
||||||
class="MuiSvgIcon-root"
|
|
||||||
focusable="false"
|
|
||||||
role="presentation"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
>
|
||||||
<path
|
<svg
|
||||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
|
aria-hidden="true"
|
||||||
/>
|
class="MuiSvgIcon-root"
|
||||||
</svg>
|
focusable="false"
|
||||||
</span>
|
role="presentation"
|
||||||
<span
|
viewBox="0 0 24 24"
|
||||||
class="MuiTouchRipple-root"
|
>
|
||||||
/>
|
<path
|
||||||
</button>
|
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="MuiTouchRipple-root"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</h6>
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
|
||||||
|
|||||||
@@ -1,111 +1,89 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import AppBar from '@material-ui/core/AppBar';
|
import { css } from '@emotion/core';
|
||||||
import Toolbar from '@material-ui/core/Toolbar';
|
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import { Theme } from '../../design-tokens/theme';
|
||||||
import mq from '../../utils/styles/media';
|
import { breakpoints } from '../../utils/styles/media';
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
import ExternalLink from '../Link';
|
import AppBar from '../../muiComponents/AppBar';
|
||||||
|
import Toolbar from '../../muiComponents/Toolbar';
|
||||||
|
import Link from '../Link';
|
||||||
|
|
||||||
export const InnerNavBar = styled(Toolbar)({
|
export const InnerNavBar = styled(Toolbar)({
|
||||||
'&&': {
|
justifyContent: 'space-between',
|
||||||
justifyContent: 'space-between',
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
padding: '0 15px',
|
||||||
padding: '0 15px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Greetings = styled('span')({
|
export const Greetings = styled('span')({
|
||||||
'&&': {
|
margin: '0 5px 0 0',
|
||||||
margin: '0 5px 0 0',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const RightSide = styled(Toolbar)({
|
export const RightSide = styled(Toolbar)({
|
||||||
'&&': {
|
display: 'flex',
|
||||||
display: 'flex',
|
padding: 0,
|
||||||
padding: 0,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const LeftSide = styled(RightSide)({
|
export const LeftSide = styled(RightSide)({
|
||||||
'&&': {
|
flex: 1,
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MobileNavBar = styled('div')({
|
export const MobileNavBar = styled('div')<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
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')({
|
export const InnerMobileNavBar = styled('div')<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
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)`
|
export const NavBar = styled(AppBar)<{ theme?: Theme }>(props => ({
|
||||||
&& {
|
backgroundColor: props.theme && props.theme.palette.primary.main,
|
||||||
background-color: ${colors.primary};
|
minHeight: 60,
|
||||||
min-height: 60px;
|
display: 'flex',
|
||||||
display: flex;
|
justifyContent: 'center',
|
||||||
justify-content: center;
|
[`@media (min-width: ${breakpoints.medium}px)`]: css`
|
||||||
${() =>
|
${SearchWrapper} {
|
||||||
mq.medium(css`
|
display: flex;
|
||||||
${SearchWrapper} {
|
}
|
||||||
display: flex;
|
${IconSearchButton} {
|
||||||
}
|
display: none;
|
||||||
${IconSearchButton} {
|
}
|
||||||
display: none;
|
${MobileNavBar} {
|
||||||
}
|
display: none;
|
||||||
${MobileNavBar} {
|
}
|
||||||
display: none;
|
`,
|
||||||
}
|
[`@media (min-width: ${breakpoints.large}px)`]: css`
|
||||||
`)};
|
${InnerNavBar} {
|
||||||
${() =>
|
padding: 0 20px;
|
||||||
mq.large(css`
|
}
|
||||||
${InnerNavBar} {
|
`,
|
||||||
padding: 0 20px;
|
[`@media (min-width: ${breakpoints.xlarge}px)`]: css`
|
||||||
}
|
${InnerNavBar} {
|
||||||
`)};
|
max-width: 1240px;
|
||||||
${() =>
|
width: 100%;
|
||||||
mq.xlarge(css`
|
margin: 0 auto;
|
||||||
${InnerNavBar} {
|
}
|
||||||
max-width: 1240px;
|
`,
|
||||||
width: 100%;
|
}));
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
`)};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const StyledExternalLink = styled(ExternalLink)({
|
export const StyledLink = styled(Link)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
color: props.theme && props.theme.palette.white,
|
||||||
color: 'white',
|
}));
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
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 render the component in default state', () => {
|
test('should load the component in default state', () => {
|
||||||
const wrapper = mount(<Help />);
|
const { container } = render(<Help />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
import CardActions from '@material-ui/core/CardActions';
|
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
|
|
||||||
import { getRegistryURL } from '../../utils/url';
|
import { getRegistryURL } from '../../utils/url';
|
||||||
import CopyToClipBoard from '../CopyToClipBoard';
|
import CopyToClipBoard from '../CopyToClipBoard';
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
|
import CardContent from '../../muiComponents/CardContent';
|
||||||
import { default as Typography } from '../../muiComponents/Heading';
|
import { default as Typography } from '../../muiComponents/Heading';
|
||||||
|
import CardActions from '../../muiComponents/CardActions';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
|
|
||||||
import { CardStyled as Card, HelpTitle } from './styles';
|
import { CardStyled as Card, HelpTitle } from './styles';
|
||||||
|
|
||||||
|
export const HELP_TITLE = 'No Package Published Yet.';
|
||||||
|
export const COMPONENT_HELP_ID = 'help-card__title';
|
||||||
|
|
||||||
function renderHeadingClipboardSegments(title: string, text: string): React.ReactNode {
|
function renderHeadingClipboardSegments(title: string, text: string): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@@ -25,8 +28,8 @@ const Help: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<Card id="help-card">
|
<Card id="help-card">
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography component="h2" gutterBottom={true} id="help-card__title" variant="h5">
|
<Typography component="h2" gutterBottom={true} id={COMPONENT_HELP_ID} variant="h5">
|
||||||
{'No Package Published Yet.'}
|
{HELP_TITLE}
|
||||||
</Typography>
|
</Typography>
|
||||||
<HelpTitle color="textSecondary" gutterBottom={true}>
|
<HelpTitle color="textSecondary" gutterBottom={true}>
|
||||||
{'To publish your first package just:'}
|
{'To publish your first package just:'}
|
||||||
|
|||||||
@@ -1,3 +1,159 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
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>"`;
|
exports[`<Help /> component should load the component in default state 1`] = `
|
||||||
|
.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>
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { default as Typography } from '../../muiComponents/Heading';
|
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,
|
||||||
width: '600px',
|
margin: 'auto',
|
||||||
margin: 'auto',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const HelpTitle = styled(Typography)({
|
export const HelpTitle = styled(Typography)({
|
||||||
'&&': {
|
marginBottom: 20,
|
||||||
marginBottom: '20px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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';
|
||||||
|
|
||||||
@@ -8,7 +9,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 wrapper = shallow(<Icon name={props.name} />);
|
const { container } = render(<Icon name={props.name} />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -63,10 +63,11 @@ 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} name={name} pointer={pointer} size={size} title={title} {...props}>
|
<ImgWrapper className={className} pointer={pointer} size={size} title={title} {...props}>
|
||||||
<Img alt={title} src={Icons[name]} />
|
<Img alt={title} src={Icons[name]} />
|
||||||
</ImgWrapper>
|
</ImgWrapper>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
// 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`] = `"<svg class=\\"css-snirlv ek145dl0\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg>"`;
|
exports[`<Icon /> component should render the component in default state 1`] = `
|
||||||
|
.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,56 +1,42 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
||||||
import { StyledOtherComponent } from 'create-emotion-styled';
|
|
||||||
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
||||||
|
|
||||||
const getSize = (size: Breakpoint): string => {
|
const getSize = (size: Breakpoint): { width: number; height: number } => {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 'md':
|
case 'md':
|
||||||
return `
|
return {
|
||||||
width: 18px;
|
width: 18,
|
||||||
height: 18px;
|
height: 18,
|
||||||
`;
|
};
|
||||||
default:
|
default:
|
||||||
return `
|
return {
|
||||||
width: 14px;
|
width: 14,
|
||||||
height: 16px;
|
height: 16,
|
||||||
`;
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }): string => css`
|
interface CommonStyleProps {
|
||||||
&& {
|
size: Breakpoint;
|
||||||
display: inline-block;
|
pointer?: boolean;
|
||||||
cursor: ${pointer ? 'pointer' : 'Developers'};
|
}
|
||||||
${getSize(size)};
|
const commonStyle = ({ size = 'sm', pointer }: CommonStyleProps): object => ({
|
||||||
${modifiers && modifiers};
|
display: 'inline-block',
|
||||||
}
|
cursor: pointer ? 'pointer' : 'default',
|
||||||
`;
|
...getSize(size),
|
||||||
|
});
|
||||||
|
|
||||||
export const Svg = styled('svg')`
|
export const Svg = styled('svg')<CommonStyleProps>(props => ({
|
||||||
&& {
|
boxSizing: 'initial',
|
||||||
${commonStyle};
|
...commonStyle(props),
|
||||||
}
|
}));
|
||||||
`;
|
|
||||||
|
|
||||||
export const ImgWrapper: StyledOtherComponent<
|
export const ImgWrapper = styled('span')<CommonStyleProps>(props => ({
|
||||||
{
|
boxSizing: 'initial',
|
||||||
size?: Breakpoint;
|
...commonStyle(props),
|
||||||
pointer: boolean;
|
}));
|
||||||
modifiers?: null | undefined;
|
|
||||||
name?: string | unknown;
|
|
||||||
},
|
|
||||||
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>,
|
|
||||||
{}
|
|
||||||
> = styled('span')`
|
|
||||||
&& {
|
|
||||||
${commonStyle};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const Img = styled('img')({
|
export const Img = styled('img')({
|
||||||
'&&': {
|
width: '100%',
|
||||||
width: '100%',
|
height: 'auto',
|
||||||
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,5 +1,5 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { DetailContext } from '../../pages/Version';
|
import { DetailContext } from '../../pages/Version';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import CopyToClipBoard from '../CopyToClipBoard';
|
import CopyToClipBoard from '../CopyToClipBoard';
|
||||||
import Avatar from '../../muiComponents/Avatar';
|
import Avatar from '../../muiComponents/Avatar';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
|
||||||
// logos of package managers
|
// logos of package managers
|
||||||
import npmLogo from './img/npm.svg';
|
import npmLogo from './img/npm.svg';
|
||||||
@@ -45,21 +45,30 @@ const InstallListItem: React.FC<Interface> = ({ packageName, dependencyManager }
|
|||||||
return (
|
return (
|
||||||
<InstallItem button={true} data-testid={'installListItem-npm'}>
|
<InstallItem button={true} data-testid={'installListItem-npm'}>
|
||||||
<PackageMangerAvatar alt="npm" src={npmLogo} />
|
<PackageMangerAvatar alt="npm" src={npmLogo} />
|
||||||
<InstallListItemText primary={<CopyToClipBoard text={`npm install ${packageName}`} />} secondary={'Install using npm'} />
|
<InstallListItemText
|
||||||
|
primary={<CopyToClipBoard text={`npm install ${packageName}`} />}
|
||||||
|
secondary={'Install using npm'}
|
||||||
|
/>
|
||||||
</InstallItem>
|
</InstallItem>
|
||||||
);
|
);
|
||||||
case DependencyManager.YARN:
|
case DependencyManager.YARN:
|
||||||
return (
|
return (
|
||||||
<InstallItem button={true} data-testid={'installListItem-yarn'}>
|
<InstallItem button={true} data-testid={'installListItem-yarn'}>
|
||||||
<PackageMangerAvatar alt="yarn" src={yarnLogo} />
|
<PackageMangerAvatar alt="yarn" src={yarnLogo} />
|
||||||
<InstallListItemText primary={<CopyToClipBoard text={`yarn add ${packageName}`} />} secondary={'Install using yarn'} />
|
<InstallListItemText
|
||||||
|
primary={<CopyToClipBoard text={`yarn add ${packageName}`} />}
|
||||||
|
secondary={'Install using yarn'}
|
||||||
|
/>
|
||||||
</InstallItem>
|
</InstallItem>
|
||||||
);
|
);
|
||||||
case DependencyManager.PNPM:
|
case DependencyManager.PNPM:
|
||||||
return (
|
return (
|
||||||
<InstallItem button={true} data-testid={'installListItem-pnpm'}>
|
<InstallItem button={true} data-testid={'installListItem-pnpm'}>
|
||||||
<PackageMangerAvatar alt={'pnpm'} src={pnpmLogo} />
|
<PackageMangerAvatar alt={'pnpm'} src={pnpmLogo} />
|
||||||
<InstallListItemText primary={<CopyToClipBoard text={`pnpm install ${packageName}`} />} secondary={'Install using pnpm'} />
|
<InstallListItemText
|
||||||
|
primary={<CopyToClipBoard text={`pnpm install ${packageName}`} />}
|
||||||
|
secondary={'Install using pnpm'}
|
||||||
|
/>
|
||||||
</InstallItem>
|
</InstallItem>
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,24 +1,71 @@
|
|||||||
// 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 css-b8upko emotion-0 MuiTypography-subtitle1"
|
class="MuiTypography-root emotion-0 emotion-1 MuiTypography-subtitle1"
|
||||||
>
|
>
|
||||||
Installation
|
Installation
|
||||||
</h6>
|
</h6>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 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 css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="npm"
|
alt="npm"
|
||||||
@@ -27,21 +74,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1mta3t8 emotion-4"
|
class="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="css-lh0wgu emotion-2"
|
class="emotion-4 emotion-5"
|
||||||
>
|
>
|
||||||
npm install foo
|
npm install foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -79,13 +126,13 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 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 css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="yarn"
|
alt="yarn"
|
||||||
@@ -94,21 +141,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1mta3t8 emotion-4"
|
class="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="css-lh0wgu emotion-2"
|
class="emotion-4 emotion-5"
|
||||||
>
|
>
|
||||||
yarn add foo
|
yarn add foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -146,13 +193,13 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="MuiButtonBase-root MuiListItem-root css-zw46c6 emotion-6 MuiListItem-gutters MuiListItem-button"
|
class="MuiButtonBase-root MuiListItem-root emotion-12 emotion-13 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 css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle emotion-2 emotion-3"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="pnpm"
|
alt="pnpm"
|
||||||
@@ -161,21 +208,21 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiListItemText-root css-fipixf emotion-5 MuiListItemText-multiline"
|
class="MuiListItemText-root emotion-10 emotion-11 MuiListItemText-multiline"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1mta3t8 emotion-4"
|
class="emotion-8 emotion-9"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="css-lh0wgu emotion-2"
|
class="emotion-4 emotion-5"
|
||||||
>
|
>
|
||||||
pnpm install foo
|
pnpm install foo
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-0 emotion-3"
|
class="MuiButtonBase-root MuiIconButton-root emotion-6 emotion-7"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
title="Copy to Clipboard"
|
title="Copy to Clipboard"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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';
|
||||||
|
|
||||||
@@ -8,7 +9,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 wrapper = mount(<Label text={props.text} />);
|
const { container } = render(<Label text={props.text} />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
@@ -7,20 +7,17 @@ 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,3 +1,14 @@
|
|||||||
// 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`] = `"<div class=\\"css-1xfhjjm esyufg60\\">test</div>"`;
|
exports[`<Label /> component should render the component in default state 1`] = `
|
||||||
|
.emotion-0 {
|
||||||
|
font-weight: 400;
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="emotion-0 emotion-1"
|
||||||
|
>
|
||||||
|
test
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,32 +1,29 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import { Theme } from '../../design-tokens/theme';
|
||||||
|
|
||||||
export const Content = styled('div')({
|
export const Content = styled('div')<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
backgroundColor: props.theme && props.theme.palette.white,
|
||||||
backgroundColor: colors.white,
|
flex: 1,
|
||||||
flex: 1,
|
display: 'flex',
|
||||||
display: 'flex',
|
position: 'relative',
|
||||||
position: 'relative',
|
flexDirection: 'column',
|
||||||
flexDirection: 'column',
|
}));
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
interface ContainerProps {
|
interface ContainerProps {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Container = styled('div')`
|
export const Container = styled('div')<ContainerProps>(props => ({
|
||||||
&& {
|
display: 'flex',
|
||||||
display: flex;
|
flexDirection: 'column',
|
||||||
flex-direction: column;
|
minHeight: '100vh',
|
||||||
min-height: 100vh;
|
overflow: 'hidden',
|
||||||
overflow: hidden;
|
...(props.isLoading &&
|
||||||
${({ isLoading }: ContainerProps) =>
|
css`
|
||||||
isLoading &&
|
${Content} {
|
||||||
css`
|
background-color: #f5f6f8;
|
||||||
${Content} {
|
}
|
||||||
background-color: #f5f6f8;
|
`),
|
||||||
}
|
}));
|
||||||
`}
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { mount } from 'enzyme';
|
|
||||||
|
|
||||||
import Link from './Link';
|
|
||||||
|
|
||||||
describe('<Link /> component', () => {
|
|
||||||
const props = {
|
|
||||||
to: 'https://github.com/verdaccio/ui',
|
|
||||||
};
|
|
||||||
test('should render the component in default state', () => {
|
|
||||||
const wrapper = mount(<Link blank={true} to={props.to} />);
|
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,15 +1,26 @@
|
|||||||
import React, { ReactNode } from 'react';
|
import React from 'react';
|
||||||
|
import { Link as RouterLink } from 'react-router-dom';
|
||||||
|
|
||||||
interface Props {
|
import Text, { TextProps } from '../../muiComponents/Text';
|
||||||
children?: ReactNode;
|
|
||||||
|
interface Props extends Pick<TextProps, 'variant'> {
|
||||||
|
external?: boolean;
|
||||||
|
className?: string;
|
||||||
to: string;
|
to: string;
|
||||||
blank?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Link: React.FC<Props> = ({ children, to = '#', blank = false, ...props }) => (
|
/* eslint-disable verdaccio/jsx-spread */
|
||||||
<a href={to} target={blank ? '_blank' : '_self'} {...props}>
|
const Link: React.FC<Props> = ({ external, to, children, variant, className, ...props }) => {
|
||||||
{children}
|
const LinkTextContent = <Text variant={variant}>{children}</Text>;
|
||||||
</a>
|
return external ? (
|
||||||
);
|
<a className={className} href={to} rel="noopener noreferrer" target="_blank" {...props}>
|
||||||
|
{LinkTextContent}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<RouterLink className={className} to={to} {...props}>
|
||||||
|
{LinkTextContent}
|
||||||
|
</RouterLink>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default Link;
|
export default Link;
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`<Link /> component should render the component in default state 1`] = `"<a href=\\"https://github.com/verdaccio/ui\\" target=\\"_blank\\"></a>"`;
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
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 wrapper = shallow(<Loading />);
|
const { container } = render(<Loading />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,86 @@
|
|||||||
// 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`] = `"<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>"`;
|
exports[`<Loading /> component should render the component in default state 1`] = `
|
||||||
|
.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,19 +1,15 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled('div')`
|
export const Wrapper = styled('div')({
|
||||||
&& {
|
transform: 'translate(-50%, -50%)',
|
||||||
transform: translate(-50%, -50%);
|
top: '50%',
|
||||||
top: 50%;
|
left: '50%',
|
||||||
left: 50%;
|
position: 'absolute',
|
||||||
position: absolute;
|
});
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const Badge = styled('div')`
|
export const Badge = styled('div')({
|
||||||
&& {
|
margin: '0 0 30px 0',
|
||||||
margin: 0 0 30px 0;
|
borderRadius: 25,
|
||||||
border-radius: 25px;
|
boxShadow: '0 10px 20px 0 rgba(69, 58, 100, 0.2)',
|
||||||
box-shadow: 0 10px 20px 0 rgba(69, 58, 100, 0.2);
|
background: '#f7f8f6',
|
||||||
background: #f7f8f6;
|
});
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ describe('<LoginModal />', () => {
|
|||||||
onCancel: () => {},
|
onCancel: () => {},
|
||||||
onSubmit: () => {},
|
onSubmit: () => {},
|
||||||
};
|
};
|
||||||
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
const wrapper = mount(<LoginModal {...props} />);
|
||||||
const { setCredentials } = wrapper.instance();
|
const { setCredentials } = wrapper.instance();
|
||||||
|
|
||||||
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
expect(setCredentials('username', eventUsername)).toBeUndefined();
|
||||||
@@ -83,7 +84,7 @@ describe('<LoginModal />', () => {
|
|||||||
onSubmit: jest.fn(),
|
onSubmit: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
const wrapper = mount(<LoginModal {...props} />);
|
||||||
const instance = wrapper.instance();
|
const instance = wrapper.instance();
|
||||||
|
|
||||||
instance.submitCredentials = jest.fn();
|
instance.submitCredentials = jest.fn();
|
||||||
@@ -108,7 +109,7 @@ describe('<LoginModal />', () => {
|
|||||||
onSubmit: jest.fn(),
|
onSubmit: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = mount<LoginModal>(<LoginModal {...props} />);
|
const wrapper = mount(<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,17 +1,16 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import SnackbarContent from '@material-ui/core/SnackbarContent';
|
|
||||||
import ErrorIcon from '@material-ui/icons/Error';
|
import ErrorIcon from '@material-ui/icons/Error';
|
||||||
import InputLabel from '@material-ui/core/InputLabel';
|
|
||||||
import Input from '@material-ui/core/Input';
|
|
||||||
import FormControl from '@material-ui/core/FormControl';
|
|
||||||
import FormHelperText from '@material-ui/core/FormHelperText';
|
|
||||||
import { css } from 'emotion';
|
|
||||||
|
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
import Dialog from '../../muiComponents/Dialog';
|
import Dialog from '../../muiComponents/Dialog';
|
||||||
import DialogTitle from '../../muiComponents/DialogTitle';
|
import DialogTitle from '../../muiComponents/DialogTitle';
|
||||||
import DialogContent from '../../muiComponents/DialogContent';
|
import DialogContent from '../../muiComponents/DialogContent';
|
||||||
import DialogActions from '../../muiComponents/DialogActions';
|
import DialogActions from '../../muiComponents/DialogActions';
|
||||||
|
import FormControl from '../../muiComponents/FormControl';
|
||||||
|
import FormHelperText from '../../muiComponents/FormHelperText';
|
||||||
|
import Input from '../../muiComponents/Input';
|
||||||
|
import InputLabel from '../../muiComponents/InputLabel';
|
||||||
|
import SnackbarContent from '../../muiComponents/SnackbarContent';
|
||||||
|
|
||||||
import * as classes from './styles';
|
import * as classes from './styles';
|
||||||
|
|
||||||
@@ -172,7 +171,11 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public renderLoginError({ type, title, description }: FormError): JSX.Element | false {
|
public renderLoginError({ type, title, description }: FormError): JSX.Element | false {
|
||||||
return type === 'error' && <SnackbarContent className={classes.loginError} message={this.renderMessage(title, description)} />;
|
return (
|
||||||
|
type === 'error' && (
|
||||||
|
<SnackbarContent className={classes.loginError} message={this.renderMessage(title, description)} />
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderNameField = () => {
|
public renderNameField = () => {
|
||||||
@@ -182,8 +185,15 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
|
|||||||
return (
|
return (
|
||||||
<FormControl error={!username.value && !username.pristine} fullWidth={true} required={username.required}>
|
<FormControl error={!username.value && !username.pristine} fullWidth={true} required={username.required}>
|
||||||
<InputLabel htmlFor={'username'}>{'Username'}</InputLabel>
|
<InputLabel htmlFor={'username'}>{'Username'}</InputLabel>
|
||||||
<Input id={'login--form-username'} onChange={this.handleUsernameChange} placeholder={'Your username'} value={username.value} />
|
<Input
|
||||||
{!username.value && !username.pristine && <FormHelperText id={'username-error'}>{username.helperText}</FormHelperText>}
|
id={'login--form-username'}
|
||||||
|
onChange={this.handleUsernameChange}
|
||||||
|
placeholder={'Your username'}
|
||||||
|
value={username.value}
|
||||||
|
/>
|
||||||
|
{!username.value && !username.pristine && (
|
||||||
|
<FormHelperText id={'username-error'}>{username.helperText}</FormHelperText>
|
||||||
|
)}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -194,15 +204,23 @@ 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}>
|
||||||
<InputLabel htmlFor={'password'}>{'Password'}</InputLabel>
|
<InputLabel htmlFor={'password'}>{'Password'}</InputLabel>
|
||||||
<Input id={'login--form-password'} onChange={this.handlePasswordChange} placeholder={'Your strong password'} type={'password'} value={password.value} />
|
<Input
|
||||||
{!password.value && !password.pristine && <FormHelperText id={'password-error'}>{password.helperText}</FormHelperText>}
|
id={'login--form-password'}
|
||||||
|
onChange={this.handlePasswordChange}
|
||||||
|
placeholder={'Your strong password'}
|
||||||
|
type={'password'}
|
||||||
|
value={password.value}
|
||||||
|
/>
|
||||||
|
{!password.value && !password.pristine && (
|
||||||
|
<FormHelperText id={'password-error'}>{password.helperText}</FormHelperText>
|
||||||
|
)}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -217,7 +235,11 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
|
|||||||
<Button color={'inherit'} id={'login--form-cancel'} onClick={onCancel} type={'button'}>
|
<Button color={'inherit'} id={'login--form-cancel'} onClick={onCancel} type={'button'}>
|
||||||
{'Cancel'}
|
{'Cancel'}
|
||||||
</Button>
|
</Button>
|
||||||
<Button color={'inherit'} disabled={!password.value || !username.value} id={'login--form-submit'} type={'submit'}>
|
<Button
|
||||||
|
color={'inherit'}
|
||||||
|
disabled={!password.value || !username.value}
|
||||||
|
id={'login--form-submit'}
|
||||||
|
type={'submit'}>
|
||||||
{'Login'}
|
{'Login'}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
|||||||
@@ -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\\" class=\\"MuiInputBase-input MuiInput-input\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" 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\\" class=\\"MuiInputBase-input MuiInput-input\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" 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 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=\\"alertdialog\\"><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\\" class=\\"MuiInputBase-input MuiInput-input\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" 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\\" class=\\"MuiInputBase-input MuiInput-input\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" 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>"`;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import { theme } from '../../design-tokens/theme';
|
||||||
|
|
||||||
export const loginDialog = css({
|
export const loginDialog = css({
|
||||||
minWidth: '300px',
|
minWidth: '300px',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const loginError = css({
|
export const loginError = css({
|
||||||
backgroundColor: `${colors.red} !important`,
|
backgroundColor: `${theme.palette.red} !important`,
|
||||||
minWidth: 'inherit !important',
|
minWidth: 'inherit !important',
|
||||||
marginBottom: '10px !important',
|
marginBottom: '10px !important',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
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 wrapper = shallow(<Logo />);
|
const { container } = render(<Logo />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import logo from './img/logo.svg';
|
import logo from './img/logo.svg';
|
||||||
|
|
||||||
@@ -12,19 +12,18 @@ interface Props {
|
|||||||
size?: Size;
|
size?: Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledLogo = styled('div')<Props>`
|
const StyledLogo = styled('div')<Props>(props => ({
|
||||||
&& {
|
display: 'inline-block',
|
||||||
display: inline-block;
|
verticalAlign: 'middle',
|
||||||
vertical-align: middle;
|
boxSizing: 'border-box',
|
||||||
box-sizing: border-box;
|
backgroundPosition: 'center',
|
||||||
background-position: center;
|
backgroundSize: 'contain',
|
||||||
background-size: contain;
|
backgroundImage: `url(${logo})`,
|
||||||
background-image: url(${logo});
|
backgroundRepeat: ' no-repeat',
|
||||||
background-repeat: no-repeat;
|
width: props.size,
|
||||||
width: ${({ size }) => size};
|
height: props.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,3 +1,19 @@
|
|||||||
// 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`] = `"<div class=\\"css-1sifsqk em793ed0\\"></div>"`;
|
exports[`<Logo /> component should render the component in default state 1`] = `
|
||||||
|
.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,25 +1,16 @@
|
|||||||
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 wrapper = shallow(<NoItems text={props.text} />);
|
const { container } = render(<NoItems text={props.text} />);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(container.firstChild).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,5 +1,9 @@
|
|||||||
// 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`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">test</h6>"`;
|
exports[`<NoItem /> component should load the component in default state 1`] = `
|
||||||
|
<h6
|
||||||
exports[`<NoItem /> component should set html from props 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">This is a test string</h6>"`;
|
class="MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom"
|
||||||
|
>
|
||||||
|
test
|
||||||
|
</h6>
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import Box from '@material-ui/core/Box';
|
import styled from '@emotion/styled';
|
||||||
import Typography from '@material-ui/core/Typography';
|
|
||||||
import styled from 'react-emotion';
|
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import Box from '../../muiComponents/Box';
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
import colors from '../../utils/styles/colors';
|
import Heading from '../../muiComponents/Heading';
|
||||||
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(Typography)({
|
const StyledHeading = styled(Heading)<{ theme?: Theme }>(props => ({
|
||||||
color: colors.primary,
|
color: props.theme && props.theme.palette.primary.main,
|
||||||
marginBottom: spacings.sm,
|
marginBottom: spacings.sm,
|
||||||
});
|
}));
|
||||||
|
|
||||||
const NotFound: React.FC = () => {
|
const NotFound: React.FC = () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -32,7 +32,14 @@ const NotFound: React.FC = () => {
|
|||||||
}, [history]);
|
}, [history]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box alignItems="center" data-testid="404" display="flex" flexDirection="column" flexGrow={1} justifyContent="center" p={2}>
|
<Box
|
||||||
|
alignItems="center"
|
||||||
|
data-testid="404"
|
||||||
|
display="flex"
|
||||||
|
flexDirection="column"
|
||||||
|
flexGrow={1}
|
||||||
|
justifyContent="center"
|
||||||
|
p={2}>
|
||||||
<EmptyPackage alt="404 - Page not found" src={PackageImg} />
|
<EmptyPackage alt="404 - Page not found" src={PackageImg} />
|
||||||
<StyledHeading className="not-found-text" variant="h4">
|
<StyledHeading className="not-found-text" variant="h4">
|
||||||
{NOT_FOUND_TEXT}
|
{NOT_FOUND_TEXT}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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,17 +1,27 @@
|
|||||||
// 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="css-17y48z2 emotion-0"
|
class="emotion-0 emotion-1"
|
||||||
src="[object Object]"
|
src="[object Object]"
|
||||||
/>
|
/>
|
||||||
<h4
|
<h4
|
||||||
class="MuiTypography-root not-found-text css-7pe7kh emotion-1 MuiTypography-h4"
|
class="MuiTypography-root not-found-text emotion-2 emotion-3 MuiTypography-h4"
|
||||||
>
|
>
|
||||||
Sorry, we couldn't find it...
|
Sorry, we couldn't find it...
|
||||||
</h4>
|
</h4>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { default as Typography } from '../../muiComponents/Heading';
|
import { default as Typography } from '../../muiComponents/Heading';
|
||||||
import List from '../../muiComponents/List';
|
import List from '../../muiComponents/List';
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -27,7 +27,14 @@ describe('<Package /> component', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<Package author={props.author} description={props.description} license={props.license} name={props.name} time={props.time} version={props.version} />
|
<Package
|
||||||
|
author={props.author}
|
||||||
|
description={props.description}
|
||||||
|
license={props.license}
|
||||||
|
name={props.name}
|
||||||
|
time={props.time}
|
||||||
|
version={props.version}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
// integration expectations
|
// integration expectations
|
||||||
@@ -65,7 +72,14 @@ describe('<Package /> component', () => {
|
|||||||
description: 'Private NPM repository',
|
description: 'Private NPM repository',
|
||||||
};
|
};
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<Package author={props.author} description={props.description} license={props.license} name={props.name} time={props.time} version={props.version} />
|
<Package
|
||||||
|
author={props.author}
|
||||||
|
description={props.description}
|
||||||
|
license={props.license}
|
||||||
|
name={props.name}
|
||||||
|
time={props.time}
|
||||||
|
version={props.version}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
// integration expectations
|
// integration expectations
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import BugReport from '@material-ui/icons/BugReport';
|
import BugReport from '@material-ui/icons/BugReport';
|
||||||
import Grid from '@material-ui/core/Grid';
|
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
||||||
import HomeIcon from '@material-ui/icons/Home';
|
import HomeIcon from '@material-ui/icons/Home';
|
||||||
|
|
||||||
import { PackageMetaInterface, Author as PackageAuthor } from '../../../types/packageMeta';
|
import { PackageMetaInterface, Author as PackageAuthor } from '../../../types/packageMeta';
|
||||||
@@ -9,7 +9,9 @@ import fileSizeSI from '../../utils/file-size';
|
|||||||
import { formatDate, formatDateDistance } from '../../utils/package';
|
import { formatDate, formatDateDistance } from '../../utils/package';
|
||||||
import Tooltip from '../../muiComponents/Tooltip';
|
import Tooltip from '../../muiComponents/Tooltip';
|
||||||
import { isURL } from '../../utils/url';
|
import { isURL } from '../../utils/url';
|
||||||
|
import { downloadHandler } from '../ActionBar/ActionBar';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
import Grid from '../../muiComponents/Grid';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Author,
|
Author,
|
||||||
@@ -34,6 +36,7 @@ interface Bugs {
|
|||||||
}
|
}
|
||||||
interface Dist {
|
interface Dist {
|
||||||
unpackedSize: number;
|
unpackedSize: number;
|
||||||
|
tarball: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PackageInterface {
|
export interface PackageInterface {
|
||||||
@@ -132,18 +135,34 @@ const Package: React.FC<PackageInterface> = ({
|
|||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const renderDownloadLink = (): React.ReactNode =>
|
||||||
|
dist &&
|
||||||
|
dist.tarball &&
|
||||||
|
isURL(dist.tarball) && (
|
||||||
|
// eslint-disable-next-line
|
||||||
|
<a onClick={() => downloadHandler(dist.tarball.replace(`https://registry.npmjs.org/`, window.location.href))} target={'_blank'}>
|
||||||
|
<Tooltip aria-label={'Download the tar file'} title={'Download tarball'}>
|
||||||
|
<IconButton aria-label={'Download'}>
|
||||||
|
{/* eslint-disable-next-line react/jsx-max-depth */}
|
||||||
|
<DownloadIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
const renderPrimaryComponent = (): React.ReactNode => {
|
const renderPrimaryComponent = (): React.ReactNode => {
|
||||||
return (
|
return (
|
||||||
<Grid container={true} item={true} xs={12}>
|
<Grid container={true} item={true} xs={12}>
|
||||||
<Grid item={true} xs={true}>
|
<Grid item={true} xs={true}>
|
||||||
<WrapperLink to={`/-/web/detail/${packageName}`}>
|
<WrapperLink to={`/-/web/detail/${packageName}`}>
|
||||||
{/* eslint-disable-next-line react/jsx-max-depth */}
|
{/* eslint-disable-next-line react/jsx-max-depth */}
|
||||||
<PackageTitle>{packageName}</PackageTitle>
|
<PackageTitle className="package-title">{packageName}</PackageTitle>
|
||||||
</WrapperLink>
|
</WrapperLink>
|
||||||
</Grid>
|
</Grid>
|
||||||
<GridRightAligned item={true} xs={true}>
|
<GridRightAligned item={true} xs={true}>
|
||||||
{renderHomePageLink()}
|
{renderHomePageLink()}
|
||||||
{renderBugsLink()}
|
{renderBugsLink()}
|
||||||
|
{renderDownloadLink()}
|
||||||
</GridRightAligned>
|
</GridRightAligned>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
@@ -160,8 +179,13 @@ const Package: React.FC<PackageInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderPackageListItemText = (): React.ReactNode => (
|
const renderPackageListItemText = (): React.ReactNode => (
|
||||||
// @ts-ignore
|
<PackageListItemText
|
||||||
<PackageListItemText className="package-link" component="div" primary={renderPrimaryComponent()} secondary={renderSecondaryComponent()} />
|
className="package-link"
|
||||||
|
// @ts-ignore
|
||||||
|
component="div"
|
||||||
|
primary={renderPrimaryComponent()}
|
||||||
|
secondary={renderSecondaryComponent()}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,158 +1,125 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import Grid from '@material-ui/core/Grid';
|
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
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';
|
||||||
import List from '../../muiComponents/List';
|
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 ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
import { Theme } from '../../design-tokens/theme';
|
||||||
|
|
||||||
export const OverviewItem = styled('span')`
|
export const OverviewItem = styled('span')<{ theme?: Theme }>(props => ({
|
||||||
&& {
|
display: 'flex',
|
||||||
display: flex;
|
alignItems: 'center',
|
||||||
align-items: center;
|
margin: '0 0 0 16px',
|
||||||
margin: 0 0 0 16px;
|
color: props.theme && props.theme.palette.greyLight2,
|
||||||
color: ${colors.greyLight2};
|
fontSize: 12,
|
||||||
font-size: 12px;
|
[`@media (max-width: ${breakpoints.medium}px)`]: {
|
||||||
@media (max-width: ${breakpoints.medium}px) {
|
':nth-of-type(3)': {
|
||||||
&:nth-child(3) {
|
display: 'none',
|
||||||
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)': {
|
||||||
export const Published = styled('span')({
|
display: 'none',
|
||||||
'&&': {
|
},
|
||||||
color: colors.greyLight2,
|
|
||||||
margin: '0 5px 0 0',
|
|
||||||
},
|
},
|
||||||
});
|
}));
|
||||||
|
|
||||||
export const Text = styled(Label)({
|
export const Icon = styled(Ico)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
margin: '2px 10px 0 0',
|
||||||
fontSize: '12px',
|
fill: props.theme && props.theme.palette.greyLight2,
|
||||||
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',
|
||||||
marginLeft: '5px',
|
lineHeight: 1.5,
|
||||||
lineHeight: 1.5,
|
display: 'flex',
|
||||||
display: 'flex',
|
flexDirection: 'column',
|
||||||
flexDirection: 'column',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Author = styled('div')({
|
export const Author = styled('div')({
|
||||||
'&&': {
|
display: 'flex',
|
||||||
display: 'flex',
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Avatar = styled(Photo)({
|
export const Avatar = styled(Photo)({
|
||||||
'&&': {
|
width: '20px',
|
||||||
width: '20px',
|
height: '20px',
|
||||||
height: '20px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const WrapperLink = styled(Link)({
|
export const WrapperLink = styled(Link)({
|
||||||
'&&': {
|
textDecoration: 'none',
|
||||||
textDecoration: 'none',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PackageTitle = styled('span')`
|
export const PackageTitle = styled('span')<{ theme?: Theme }>(props => ({
|
||||||
&& {
|
fontWeight: 600,
|
||||||
font-weight: 600;
|
fontSize: 20,
|
||||||
font-size: 20px;
|
display: 'block',
|
||||||
display: block;
|
marginBottom: 12,
|
||||||
margin-bottom: 12px;
|
color: props.theme && props.theme.palette.eclipse,
|
||||||
color: ${colors.eclipse};
|
cursor: 'pointer',
|
||||||
cursor: pointer;
|
':hover': {
|
||||||
|
color: props.theme && props.theme.palette.black,
|
||||||
&:hover {
|
},
|
||||||
color: ${colors.black};
|
[`@media (max-width: ${breakpoints.small}px)`]: {
|
||||||
}
|
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)({
|
export const PackageList = styled(List)<{ theme?: Theme }>(props => ({
|
||||||
'&&': {
|
padding: '12px 0 12px 0',
|
||||||
padding: '12px 0 12px 0',
|
':hover': {
|
||||||
|
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,
|
||||||
padding: '6px',
|
svg: {
|
||||||
|
fontSize: 16,
|
||||||
svg: {
|
|
||||||
fontSize: '16px',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TagContainer = styled('span')`
|
export const TagContainer = styled('span')({
|
||||||
&& {
|
marginTop: 8,
|
||||||
margin-top: 8px;
|
marginBottom: 12,
|
||||||
margin-bottom: 12px;
|
display: 'block',
|
||||||
display: block;
|
[`@media (max-width: ${breakpoints.medium}px)`]: {
|
||||||
@media (max-width: ${breakpoints.medium}px) {
|
display: 'none',
|
||||||
display: none;
|
},
|
||||||
}
|
});
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const PackageListItemText = styled(ListItemText)({
|
export const PackageListItemText = styled(ListItemText)({
|
||||||
'&&': {
|
|
||||||
paddingRight: 0,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const Description = styled(Typography)({
|
|
||||||
color: colors.greyDark2,
|
|
||||||
fontSize: '14px',
|
|
||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const Description = styled(Typography)<{ theme?: Theme }>(props => ({
|
||||||
|
color: props.theme && props.theme.palette.greyDark2,
|
||||||
|
fontSize: '14px',
|
||||||
|
paddingRight: 0,
|
||||||
|
}));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as React from 'react';
|
import React, { Fragment, ReactNode } from 'react';
|
||||||
|
|
||||||
import Package from '../Package';
|
import Package from '../Package';
|
||||||
import Help from '../Help';
|
import Help from '../Help';
|
||||||
@@ -12,22 +12,23 @@ interface Props {
|
|||||||
packages: PackageInterface[];
|
packages: PackageInterface[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PackageList: React.FC<Props> = props => {
|
export const PackageList: React.FC<Props> = ({ packages }) => {
|
||||||
const renderPackages: () => React.ReactElement<HTMLElement>[] = () => {
|
const renderPackages: () => ReactNode[] = () => {
|
||||||
return props.packages.map((pkg, i) => {
|
return packages.map(({ name, version, description, time, keywords, dist, homepage, bugs, author, license }, i) => {
|
||||||
const { name, version, description, time, keywords, dist, homepage, bugs, author } = pkg;
|
|
||||||
// TODO: move format license to API side.
|
// TODO: move format license to API side.
|
||||||
const license = formatLicense(pkg.license);
|
const _license = formatLicense(license);
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={i}>
|
<Fragment key={i}>
|
||||||
{i !== 0 && <Divider />}
|
{i !== 0 && <Divider />}
|
||||||
<Package {...{ name, dist, version, author, description, license, time, keywords, homepage, bugs }} />
|
<Package
|
||||||
</React.Fragment>
|
{...{ name, dist, version, author, description, license: _license, time, keywords, homepage, bugs }}
|
||||||
|
/>
|
||||||
|
</Fragment>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasPackages: () => boolean = () => props.packages.length > 0;
|
const hasPackages: () => boolean = () => packages.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'package-list-items'}>
|
<div className={'package-list-items'}>
|
||||||
|
|||||||
@@ -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,5 +1,6 @@
|
|||||||
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';
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'github-markdown-css';
|
|||||||
|
|
||||||
import { Props } from './types';
|
import { Props } from './types';
|
||||||
|
|
||||||
const Readme: React.FC<Props> = ({ description }) => <div className="markdown-body" dangerouslySetInnerHTML={{ __html: description }} />;
|
const Readme: React.FC<Props> = ({ description }) => (
|
||||||
|
<div className="markdown-body" dangerouslySetInnerHTML={{ __html: description }} />
|
||||||
|
);
|
||||||
|
|
||||||
export default Readme;
|
export default Readme;
|
||||||
|
|||||||
@@ -1,23 +1,36 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
|
||||||
|
import { render, cleanup, fireEvent } from '../../utils/test-react-testing-library';
|
||||||
|
|
||||||
import RegistryInfoContent from './RegistryInfoContent';
|
import RegistryInfoContent from './RegistryInfoContent';
|
||||||
|
|
||||||
describe('<RegistryInfoContent /> component', () => {
|
describe('<RegistryInfoContent /> component', () => {
|
||||||
test('should render the component in default state with npm tab', () => {
|
afterEach(() => {
|
||||||
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
|
cleanup();
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render the component in default state with pnpm tab', () => {
|
test('should load the component with no data', () => {
|
||||||
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
|
const { getByTestId } = render(<RegistryInfoContent registryUrl={''} scope={''} />);
|
||||||
wrapper.setState({ tabPosition: 1 });
|
const unorderedListOfTodos = getByTestId('tabs-el');
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(unorderedListOfTodos.children.length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render the component in default state with yarn tab', () => {
|
test('should load the appropiate tab content when the tab is clicked', () => {
|
||||||
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
|
const props = { registryUrl: 'http://localhost:4872', scope: '@' };
|
||||||
wrapper.setState({ tabPosition: 2 });
|
const pnpmTabTextContent = `pnpm adduser --registry ${props.registryUrl}`;
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
|
||||||
|
// Render the component.
|
||||||
|
const { container, getByTestId } = render(
|
||||||
|
<RegistryInfoContent registryUrl={props.registryUrl} scope={props.scope} />
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert the text content for pnpm tab is not present intially
|
||||||
|
expect(container.textContent).not.toContain(pnpmTabTextContent);
|
||||||
|
|
||||||
|
const pnpmTab = getByTestId('pnpm-tab');
|
||||||
|
fireEvent.click(pnpmTab);
|
||||||
|
|
||||||
|
// Assert the text content is correct after clicking on the tab.
|
||||||
|
expect(container.textContent).toContain(pnpmTabTextContent);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,91 +1,87 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { css } from 'emotion';
|
import { css } from '@emotion/core';
|
||||||
import Tabs from '@material-ui/core/Tabs';
|
|
||||||
import Tab from '@material-ui/core/Tab';
|
|
||||||
|
|
||||||
import CopyToClipBoard from '../CopyToClipBoard';
|
import CopyToClipBoard from '../CopyToClipBoard';
|
||||||
import { getCLISetRegistry, getCLIChangePassword, getCLISetConfigRegistry } from '../../utils/cli-utils';
|
import { getCLISetRegistry, getCLIChangePassword, getCLISetConfigRegistry } from '../../utils/cli-utils';
|
||||||
import { NODE_MANAGER } from '../../utils/constants';
|
import { NODE_MANAGER } from '../../utils/constants';
|
||||||
import { default as Typography } from '../../muiComponents/Heading';
|
import { default as Typography } from '../../muiComponents/Heading';
|
||||||
|
import Tabs from '../../muiComponents/Tabs';
|
||||||
|
import Tab from '../../muiComponents/Tab';
|
||||||
|
|
||||||
import { CommandContainer } from './styles';
|
import { CommandContainer } from './styles';
|
||||||
import { Props, State } from './types';
|
import { Props, State } from './types';
|
||||||
|
|
||||||
/* eslint react/prop-types:0 */
|
const RegistryInfoContent: React.FC<Props> = props => {
|
||||||
function TabContainer({ children }): JSX.Element {
|
const [tabPosition, setTabPosition] = useState<State['tabPosition']>(0);
|
||||||
return (
|
const handleChange = (event: React.ChangeEvent<{}>, tabPosition: number): void => {
|
||||||
<CommandContainer>
|
|
||||||
<Typography
|
|
||||||
className={css`
|
|
||||||
padding: 0;
|
|
||||||
min-height: 170;
|
|
||||||
`}
|
|
||||||
component="div">
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
</CommandContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class RegistryInfoContent extends Component<Props, State> {
|
|
||||||
public state = {
|
|
||||||
tabPosition: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
|
||||||
return <div>{this.renderTabs()}</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
private handleChange = (event: React.ChangeEvent<{}>, tabPosition: number) => {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.setState({ tabPosition });
|
setTabPosition(tabPosition);
|
||||||
};
|
};
|
||||||
|
|
||||||
private renderTabs(): JSX.Element {
|
const renderNpmTab = (scope: string, registryUrl: string): JSX.Element => {
|
||||||
const { scope, registryUrl } = this.props;
|
|
||||||
const { tabPosition } = this.state;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<>
|
||||||
<Tabs indicatorColor="primary" onChange={this.handleChange} textColor="primary" value={tabPosition} variant="fullWidth">
|
|
||||||
<Tab label={NODE_MANAGER.npm} />
|
|
||||||
<Tab label={NODE_MANAGER.pnpm} />
|
|
||||||
<Tab label={NODE_MANAGER.yarn} />
|
|
||||||
</Tabs>
|
|
||||||
{tabPosition === 0 && <TabContainer>{this.renderNpmTab(scope, registryUrl)}</TabContainer>}
|
|
||||||
{tabPosition === 1 && <TabContainer>{this.renderPNpmTab(scope, registryUrl)}</TabContainer>}
|
|
||||||
{tabPosition === 2 && <TabContainer>{this.renderYarnTab(scope, registryUrl)}</TabContainer>}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private renderNpmTab(scope: string, registryUrl: string): JSX.Element {
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
<CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.npm} set`, scope, registryUrl)} />
|
<CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.npm} set`, scope, registryUrl)} />
|
||||||
<CopyToClipBoard text={getCLISetRegistry(`${NODE_MANAGER.npm} adduser`, registryUrl)} />
|
<CopyToClipBoard text={getCLISetRegistry(`${NODE_MANAGER.npm} adduser`, registryUrl)} />
|
||||||
<CopyToClipBoard text={getCLIChangePassword(NODE_MANAGER.npm, registryUrl)} />
|
<CopyToClipBoard text={getCLIChangePassword(NODE_MANAGER.npm, registryUrl)} />
|
||||||
</React.Fragment>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
private renderPNpmTab(scope: string, registryUrl: string): JSX.Element {
|
const renderPnpmTab = (scope: string, registryUrl: string): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<>
|
||||||
<CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.pnpm} set`, scope, registryUrl)} />
|
<CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.pnpm} set`, scope, registryUrl)} />
|
||||||
<CopyToClipBoard text={getCLISetRegistry(`${NODE_MANAGER.pnpm} adduser`, registryUrl)} />
|
<CopyToClipBoard text={getCLISetRegistry(`${NODE_MANAGER.pnpm} adduser`, registryUrl)} />
|
||||||
<CopyToClipBoard text={getCLIChangePassword(NODE_MANAGER.pnpm, registryUrl)} />
|
<CopyToClipBoard text={getCLIChangePassword(NODE_MANAGER.pnpm, registryUrl)} />
|
||||||
</React.Fragment>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const renderYarnTab = (scope: string, registryUrl: string): JSX.Element => {
|
||||||
|
return <CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.yarn} config set`, scope, registryUrl)} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderTabs = (): JSX.Element => {
|
||||||
|
const { scope, registryUrl } = props;
|
||||||
|
|
||||||
private renderYarnTab(scope: string, registryUrl: string): JSX.Element {
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<>
|
||||||
<CopyToClipBoard text={getCLISetConfigRegistry(`${NODE_MANAGER.yarn} config set`, scope, registryUrl)} />
|
<Tabs
|
||||||
</React.Fragment>
|
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={'pnpm-tab'} label={NODE_MANAGER.pnpm} />
|
||||||
|
<Tab data-testid={'yarn-tab'} label={NODE_MANAGER.yarn} />
|
||||||
|
</Tabs>
|
||||||
|
{tabPosition === 0 && <TabContainer>{renderNpmTab(scope, registryUrl)}</TabContainer>}
|
||||||
|
{tabPosition === 1 && <TabContainer>{renderPnpmTab(scope, registryUrl)}</TabContainer>}
|
||||||
|
{tabPosition === 2 && <TabContainer>{renderYarnTab(scope, registryUrl)}</TabContainer>}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
/* eslint react/prop-types:0 */
|
||||||
|
const TabContainer = ({ children }): JSX.Element => {
|
||||||
|
return (
|
||||||
|
<CommandContainer>
|
||||||
|
<Typography
|
||||||
|
// className={css`
|
||||||
|
// padding: 0;
|
||||||
|
// min-height: 170;
|
||||||
|
// `}
|
||||||
|
component="div">
|
||||||
|
{children}
|
||||||
|
</Typography>
|
||||||
|
</CommandContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return <div>{renderTabs()}</div>;
|
||||||
|
};
|
||||||
|
|
||||||
export default RegistryInfoContent;
|
export default RegistryInfoContent;
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`<RegistryInfoContent /> component should render the component in default state with npm tab 1`] = `"<div><div class=\\"MuiTabs-root\\"><div class=\\"MuiTabs-scroller MuiTabs-fixed\\" style=\\"overflow: hidden;\\"><div class=\\"MuiTabs-flexContainer\\" role=\\"tablist\\"><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary Mui-selected MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"true\\"><span class=\\"MuiTab-wrapper\\">npm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">pnpm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">yarn</span><span class=\\"MuiTouchRipple-root\\"></span></button></div><span class=\\"PrivateTabIndicator-root-25 PrivateTabIndicator-colorPrimary-26 MuiTabs-indicator\\" style=\\"left: 0px; width: 0px;\\"></span></div></div><div class=\\"css-1qvg11o ehfwshd0\\"><div class=\\"MuiTypography-root css-17iubtz MuiTypography-h6\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">npm set @registry https://registry.verdaccio.org</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><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">npm adduser --registry https://registry.verdaccio.org</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><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">npm profile set password --registry https://registry.verdaccio.org</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></div></div></div>"`;
|
|
||||||
|
|
||||||
exports[`<RegistryInfoContent /> component should render the component in default state with pnpm tab 1`] = `"<div><div class=\\"MuiTabs-root\\"><div class=\\"MuiTabs-scroller MuiTabs-fixed\\" style=\\"overflow: hidden;\\"><div class=\\"MuiTabs-flexContainer\\" role=\\"tablist\\"><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">npm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary Mui-selected MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"true\\"><span class=\\"MuiTab-wrapper\\">pnpm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">yarn</span><span class=\\"MuiTouchRipple-root\\"></span></button></div><span class=\\"PrivateTabIndicator-root-25 PrivateTabIndicator-colorPrimary-26 MuiTabs-indicator\\" style=\\"left: 0px; width: 0px;\\"></span></div></div><div class=\\"css-1qvg11o ehfwshd0\\"><div class=\\"MuiTypography-root css-17iubtz MuiTypography-h6\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">pnpm set @registry https://registry.verdaccio.org</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><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">pnpm adduser --registry https://registry.verdaccio.org</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><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">pnpm profile set password --registry https://registry.verdaccio.org</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></div></div></div>"`;
|
|
||||||
|
|
||||||
exports[`<RegistryInfoContent /> component should render the component in default state with yarn tab 1`] = `"<div><div class=\\"MuiTabs-root\\"><div class=\\"MuiTabs-scroller MuiTabs-fixed\\" style=\\"overflow: hidden;\\"><div class=\\"MuiTabs-flexContainer\\" role=\\"tablist\\"><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">npm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"false\\"><span class=\\"MuiTab-wrapper\\">pnpm</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary Mui-selected MuiTab-fullWidth\\" tabindex=\\"0\\" type=\\"button\\" role=\\"tab\\" aria-selected=\\"true\\"><span class=\\"MuiTab-wrapper\\">yarn</span><span class=\\"MuiTouchRipple-root\\"></span></button></div><span class=\\"PrivateTabIndicator-root-25 PrivateTabIndicator-colorPrimary-26 MuiTabs-indicator\\" style=\\"left: 0px; width: 0px;\\"></span></div></div><div class=\\"css-1qvg11o ehfwshd0\\"><div class=\\"MuiTypography-root css-17iubtz MuiTypography-h6\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\">yarn config set @registry https://registry.verdaccio.org</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></div></div></div>"`;
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const CommandContainer = styled('div')({
|
export const CommandContainer = styled('div')({
|
||||||
'&&': {
|
paddingTop: 20,
|
||||||
paddingTop: '20px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user