mirror of
https://github.com/SomboChea/ui
synced 2026-01-19 01:25:51 +07:00
Compare commits
51 Commits
v0.3.4
...
refactor/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9076d0a2 | ||
|
|
ea19a2bb47 | ||
|
|
042571e72f | ||
|
|
dd6ba2cbe9 | ||
|
|
bf613231f4 | ||
|
|
7074eddf27 | ||
|
|
d3ddd439d1 | ||
|
|
26724bb20e | ||
|
|
cba41ceead | ||
|
|
2688b59f5b | ||
|
|
d9f463688d | ||
|
|
4d285dbb00 | ||
|
|
739333b1f1 | ||
|
|
5809a9f7cb | ||
|
|
e1c5e30b4c | ||
|
|
5a3ea02449 | ||
|
|
535d8f9c85 | ||
|
|
8a46678698 | ||
|
|
3265ed561d | ||
|
|
3a6c6f7fb9 | ||
|
|
09fe1db850 | ||
|
|
f265b6ba33 | ||
|
|
185b2016d3 | ||
|
|
3751acef1c | ||
|
|
50fa39f7d6 | ||
|
|
cd2e36513e | ||
|
|
b20fe3f44a | ||
|
|
be30cbdd14 | ||
|
|
c6e3fd0b92 | ||
|
|
f27254ca6b | ||
|
|
571d9c3fa7 | ||
|
|
f4dd8b01b4 | ||
|
|
a94485e614 | ||
|
|
ce4b13d3b5 | ||
|
|
fcd471ef6f | ||
|
|
9915fb6193 | ||
|
|
886684817b | ||
|
|
76d11d4674 | ||
|
|
322197dc70 | ||
|
|
d2e9d68c6d | ||
|
|
f1971edf6d | ||
|
|
c9f6bf43ae | ||
|
|
bdef686914 | ||
|
|
84257e1a84 | ||
|
|
b74ca2285e | ||
|
|
803da1c532 | ||
|
|
5cb47ed49e | ||
|
|
b56e43846b | ||
|
|
a4cdd145d2 | ||
|
|
0eb0566cde | ||
|
|
e6b53c0479 |
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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 = {
|
||||||
|
|||||||
81
package.json
81
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,28 @@
|
|||||||
"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",
|
"@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.147",
|
||||||
"@types/node": "12.11.7",
|
"@types/node": "12.12.7",
|
||||||
"@types/react": "16.9.11",
|
"@types/react": "16.9.11",
|
||||||
"@types/react-autosuggest": "9.3.13",
|
"@types/react-autosuggest": "9.3.13",
|
||||||
"@types/react-dom": "16.9.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": "10.11.3",
|
||||||
"@types/webpack-env": "1.14.1",
|
"@types/webpack-env": "1.14.1",
|
||||||
"@typescript-eslint/parser": "2.4.0",
|
"@typescript-eslint/parser": "2.7.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,20 +45,20 @@
|
|||||||
"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.7.0",
|
||||||
"detect-secrets": "1.0.4",
|
"detect-secrets": "1.0.5",
|
||||||
"emotion": "9.2.12",
|
"emotion": "10.0.23",
|
||||||
"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.1.0",
|
||||||
"eslint-plugin-import": "2.18.2",
|
"eslint-plugin-import": "2.18.2",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
"eslint-plugin-prettier": "3.1.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.2.0",
|
||||||
"friendly-errors-webpack-plugin": "1.7.0",
|
"friendly-errors-webpack-plugin": "1.7.0",
|
||||||
"get-stdin": "7.0.0",
|
"get-stdin": "7.0.0",
|
||||||
@@ -75,26 +75,25 @@
|
|||||||
"jest-fetch-mock": "2.1.2",
|
"jest-fetch-mock": "2.1.2",
|
||||||
"js-base64": "2.5.1",
|
"js-base64": "2.5.1",
|
||||||
"js-yaml": "3.13.1",
|
"js-yaml": "3.13.1",
|
||||||
"lint-staged": "8.2.1",
|
"lint-staged": "9.4.3",
|
||||||
"localstorage-memory": "1.0.3",
|
"localstorage-memory": "1.0.3",
|
||||||
"lockfile-lint": "2.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.17",
|
||||||
"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.0",
|
||||||
@@ -103,21 +102,21 @@
|
|||||||
"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.0.4",
|
||||||
"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.2.0",
|
||||||
"validator": "11.1.0",
|
"validator": "12.0.0",
|
||||||
"verdaccio": "4.3.4",
|
"verdaccio": "4.3.4",
|
||||||
"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 +170,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 +191,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 +213,10 @@
|
|||||||
"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": {
|
||||||
|
"@emotion/core": "10.0.22",
|
||||||
|
"@emotion/styled": "10.0.23",
|
||||||
|
"@material-ui/lab": "4.0.0-alpha.31"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,8 +8,8 @@ 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 StyleBaseline from '../design-tokens/StyleBaseline';
|
||||||
|
|
||||||
import AppRoute from './AppRoute';
|
import AppRoute from './AppRoute';
|
||||||
import { AppProps, AppContextProvider } from './AppContext';
|
import { AppProps, AppContextProvider } from './AppContext';
|
||||||
@@ -46,10 +44,13 @@ export default class App extends Component<{}, AppProps> {
|
|||||||
const context = { isUserLoggedIn, packages, logoUrl, user, scope };
|
const context = { isUserLoggedIn, packages, logoUrl, user, scope };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container isLoading={isLoading}>
|
<>
|
||||||
{isLoading ? <Loading /> : <AppContextProvider value={context}>{this.renderContent()}</AppContextProvider>}
|
<StyleBaseline />
|
||||||
{this.renderLoginModal()}
|
<Container isLoading={isLoading}>
|
||||||
</Container>
|
{isLoading ? <Loading /> : <AppContextProvider value={context}>{this.renderContent()}</AppContextProvider>}
|
||||||
|
{this.renderLoginModal()}
|
||||||
|
</Container>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +147,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 +175,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}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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-1br2q5z eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><button class=\\"MuiButtonBase-root MuiFab-root css-z6z5me eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Download tarball\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<ActionBar /> component when there is a button to open an issue 1`] = `"<ul class=\\"MuiList-root MuiList-padding\\"><div class=\\"MuiButtonBase-root MuiListItem-root css-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-1br2q5z eux6shq0 MuiListItem-gutters MuiListItem-button MuiListItem-alignItemsFlexStart\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"https://verdaccio.tld/bugs\\" target=\\"_blank\\"><button class=\\"MuiButtonBase-root MuiFab-root css-z6z5me eux6shq1 MuiFab-sizeSmall\\" tabindex=\\"0\\" type=\\"button\\"><span class=\\"MuiFab-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></a><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiFab } from '@material-ui/core/Fab';
|
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
import FloatingActionButton from '../../muiComponents/FloatingActionButton';
|
||||||
|
|
||||||
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)({
|
||||||
'&&': {
|
backgroundColor: colors.primary,
|
||||||
backgroundColor: colors.primary,
|
color: colors.white,
|
||||||
color: colors.white,
|
marginRight: '10px',
|
||||||
marginRight: '10px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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-b8upko e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-zw46c6 e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><a href=\\"mailto:verdaccio.user@verdaccio.org?subject=verdaccio@4.0.0\\" target=\\"_top\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div></a><div class=\\"MuiListItemText-root css-fipixf e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Author /> component should render the component when there is no author email 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-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-b8upko e1xuehjw0 MuiTypography-subtitle1\\">Author</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-zw46c6 e1xuehjw1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img\\"></div><div class=\\"MuiListItemText-root css-fipixf e1xuehjw2\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">verdaccio user</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,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,11 +1,10 @@
|
|||||||
import React, { KeyboardEvent } from 'react';
|
import React, { KeyboardEvent } from 'react';
|
||||||
import { css } from 'emotion';
|
|
||||||
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';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
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 { css } from '@emotion/core';
|
||||||
|
|
||||||
import TextField from '../../muiComponents/TextField';
|
import TextField from '../../muiComponents/TextField';
|
||||||
|
import Paper from '../../muiComponents/Paper';
|
||||||
|
|
||||||
export interface InputFieldProps {
|
export interface InputFieldProps {
|
||||||
color: string;
|
color: string;
|
||||||
|
|||||||
@@ -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,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import IconButton from '../../muiComponents/IconButton';
|
import IconButton from '../../muiComponents/IconButton';
|
||||||
|
|
||||||
|
|||||||
@@ -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,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,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',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -122,15 +122,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 +149,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>
|
||||||
}
|
}
|
||||||
@@ -218,15 +221,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 +248,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>
|
||||||
}
|
}
|
||||||
@@ -385,15 +391,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 +418,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>
|
||||||
}
|
}
|
||||||
@@ -481,15 +490,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 +517,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>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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';
|
||||||
|
|
||||||
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)({
|
||||||
'&&': {
|
backgroundColor: colors.primary,
|
||||||
backgroundColor: colors.primary,
|
color: colors.white,
|
||||||
color: colors.white,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Dist /> component should render the component with license as object 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-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-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|
||||||
exports[`<Dist /> component should render the component with license as string 1`] = `"<ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-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-b8upko estxrtg0 MuiTypography-subtitle1\\">Latest Distribution</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-1huthg8 estxrtg1 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>file count</b>: 7</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>size</b>: 10.00 Bytes</span></div><div class=\\"MuiChip-root css-42zb18 estxrtg2\\"><span class=\\"MuiChip-label\\"><b>license</b>: MIT</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,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 colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
|
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: '5px',
|
||||||
marginRight: '5px',
|
textTransform: 'capitalize',
|
||||||
textTransform: 'capitalize',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const DownloadButton = styled(MuiFab)({
|
export const DownloadButton = styled(FloatingActionButton)({
|
||||||
'&&': {
|
backgroundColor: colors.primary,
|
||||||
backgroundColor: colors.primary,
|
color: colors.white,
|
||||||
color: colors.white,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,71 +1,61 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from '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-b8upko et66bt70 MuiTypography-subtitle1\\">node JS</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-131yq1t et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>= 0.1.98</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div><div class=\\"MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6\\"><ul class=\\"MuiList-root MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko et66bt70 MuiTypography-subtitle1\\">NPM version</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-131yq1t et66bt71 MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">>3</span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul></div></div>"`;
|
||||||
|
|||||||
@@ -1,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,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Footer /> component should load the initial state of Footer component 1`] = `"<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`] = `"<div class=\\"css-i0nj2g ezbsl480\\"><div class=\\"css-hzfs9b ezbsl481\\"><div class=\\"css-d8nsp7 ezbsl482\\"> Made with<span class=\\"css-1so4oe0 ezbsl487\\">♥</span>on<span class=\\"css-1ie354y ezbsl484\\"><svg class=\\"ezbsl485 css-151fgib ek145dl0\\"><title>Earth</title><use xlink:href=\\"[object Object]#earth\\"></use></svg><span class=\\"css-8631ip ezbsl486\\"><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Spain</title><use xlink:href=\\"[object Object]#spain\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Nicaragua</title><use xlink:href=\\"[object Object]#nicaragua\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>India</title><use xlink:href=\\"[object Object]#india\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Brazil</title><use xlink:href=\\"[object Object]#brazil\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>China</title><use xlink:href=\\"[object Object]#china\\"></use></svg><svg class=\\"ezbsl488 css-1ah96gu ek145dl0\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg></span></span></div><div class=\\"css-1wbzdyy ezbsl483\\">Powered by<span class=\\"ezbsl488 css-ommwhu ek145dl1\\" name=\\"verdaccio\\" title=\\"Verdaccio\\"><img alt=\\"Verdaccio\\" src=\\"[object Object]\\" class=\\"css-1ncdhax ek145dl2\\"></span>/ v.1.0.0</div></div></div>"`;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import { css } from '@emotion/core';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import mq from '../../utils/styles/media';
|
import mq from '../../utils/styles/media';
|
||||||
import Icon from '../Icon/Icon';
|
import Icon from '../Icon/Icon';
|
||||||
|
|||||||
@@ -17,7 +17,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 +50,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 +139,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,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;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1pwdmmq emotion-8 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1bjere7 emotion-8 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1vacr9s emotion-4 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-i5xjw9 emotion-4 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="css-1dk30lc"
|
class="css-1dk30lc"
|
||||||
@@ -19,7 +19,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="css-13zpdre emotion-3"
|
class="css-12prohx emotion-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1crzyyo emotion-2"
|
class="css-1crzyyo emotion-2"
|
||||||
@@ -40,7 +40,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root css-16qv2i2 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -74,10 +74,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-m61s5i emotion-7 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1qii1b7 emotion-7 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-1y1xi9f emotion-5 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root css-13o7eu2 emotion-5 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -101,35 +101,40 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="css-1aacqdd emotion-6"
|
class="css-kbn7if emotion-6"
|
||||||
data-testid="header--tooltip-documentation"
|
data-testid="header--tooltip-documentation"
|
||||||
href="https://verdaccio.org/docs/en/installation"
|
href="https://verdaccio.org/docs/en/installation"
|
||||||
|
rel="noopener noreferrer"
|
||||||
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"
|
||||||
@@ -193,10 +198,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
class="MuiPaper-root MuiPaper-elevation4 MuiAppBar-root MuiAppBar-positionStatic css-rfunvc emotion-9 MuiAppBar-colorPrimary"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1pwdmmq emotion-8 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1bjere7 emotion-8 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-1vacr9s emotion-4 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-i5xjw9 emotion-4 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="css-1dk30lc"
|
class="css-1dk30lc"
|
||||||
@@ -207,7 +212,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div
|
||||||
class="css-13zpdre emotion-3"
|
class="css-12prohx emotion-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1crzyyo emotion-2"
|
class="css-1crzyyo emotion-2"
|
||||||
@@ -228,7 +233,7 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
class="MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiInputAdornment-root css-16qv2i2 MuiInputAdornment-positionStart"
|
class="MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@@ -262,10 +267,10 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="MuiToolbar-root MuiToolbar-regular css-m61s5i emotion-7 MuiToolbar-gutters"
|
class="MuiToolbar-root MuiToolbar-regular css-1qii1b7 emotion-7 MuiToolbar-gutters"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiIconButton-root css-1y1xi9f emotion-5 MuiIconButton-colorInherit"
|
class="MuiButtonBase-root MuiIconButton-root css-13o7eu2 emotion-5 MuiIconButton-colorInherit"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@@ -289,35 +294,40 @@ exports[`<Header /> component with logged in state should load the component in
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
class="css-1aacqdd emotion-6"
|
class="css-kbn7if emotion-6"
|
||||||
data-testid="header--tooltip-documentation"
|
data-testid="header--tooltip-documentation"
|
||||||
href="https://verdaccio.org/docs/en/installation"
|
href="https://verdaccio.org/docs/en/installation"
|
||||||
|
rel="noopener noreferrer"
|
||||||
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,72 +1,57 @@
|
|||||||
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 colors from '../../utils/styles/colors';
|
||||||
import mq from '../../utils/styles/media';
|
import mq 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')({
|
||||||
'&&': {
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
display: 'flex',
|
||||||
display: 'flex',
|
borderBottom: `1px solid ${colors.greyLight}`,
|
||||||
borderBottom: `1px solid ${colors.greyLight}`,
|
padding: '8px',
|
||||||
padding: '8px',
|
position: 'relative',
|
||||||
position: 'relative',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const InnerMobileNavBar = styled('div')({
|
export const InnerMobileNavBar = styled('div')({
|
||||||
'&&': {
|
borderRadius: '4px',
|
||||||
borderRadius: '4px',
|
backgroundColor: colors.greyLight,
|
||||||
backgroundColor: colors.greyLight,
|
color: colors.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)`
|
||||||
@@ -104,8 +89,6 @@ export const NavBar = styled(AppBar)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledExternalLink = styled(ExternalLink)({
|
export const StyledLink = styled(Link)({
|
||||||
'&&': {
|
color: 'white',
|
||||||
color: 'white',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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,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 Card from '../../muiComponents/Card';
|
import Card from '../../muiComponents/Card';
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Icon /> component should render the component in default state 1`] = `"<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`] = `"<svg class=\\"css-j2zgvv ek145dl0\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg>"`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import { css } from '@emotion/core';
|
||||||
|
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';
|
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
||||||
|
|
||||||
const getSize = (size: Breakpoint): string => {
|
const getSize = (size: Breakpoint): string => {
|
||||||
@@ -18,7 +18,7 @@ const getSize = (size: Breakpoint): string => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }): string => css`
|
const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }) => css`
|
||||||
&& {
|
&& {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
cursor: ${pointer ? 'pointer' : 'Developers'};
|
cursor: ${pointer ? 'pointer' : 'Developers'};
|
||||||
@@ -28,24 +28,13 @@ const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }):
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const Svg = styled('svg')`
|
export const Svg = styled('svg')`
|
||||||
&& {
|
${commonStyle};
|
||||||
${commonStyle};
|
box-sizing: initial;
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ImgWrapper: StyledOtherComponent<
|
export const ImgWrapper = styled('span')`
|
||||||
{
|
${commonStyle};
|
||||||
size?: Breakpoint;
|
box-sizing: initial;
|
||||||
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')({
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="npm"
|
alt="npm"
|
||||||
@@ -85,7 +85,7 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="yarn"
|
alt="yarn"
|
||||||
@@ -152,7 +152,7 @@ exports[`<Install /> renders correctly 1`] = `
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="MuiAvatar-root css-19top7x emotion-1"
|
class="MuiAvatar-root MuiAvatar-circle css-19top7x emotion-1"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="pnpm"
|
alt="pnpm"
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|
||||||
@@ -15,7 +15,6 @@ interface WrapperProps {
|
|||||||
weight: string;
|
weight: string;
|
||||||
modifiers?: null;
|
modifiers?: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wrapper = styled('div')`
|
const Wrapper = styled('div')`
|
||||||
font-weight: ${({ weight }: WrapperProps) => fontWeight[weight]};
|
font-weight: ${({ weight }: WrapperProps) => fontWeight[weight]};
|
||||||
text-transform: ${({ capitalize }: WrapperProps) => (capitalize ? 'capitalize' : 'none')};
|
text-transform: ${({ capitalize }: WrapperProps) => (capitalize ? 'capitalize' : 'none')};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import { css } from '@emotion/core';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
|
|
||||||
|
|||||||
@@ -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,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled('div')`
|
export const Wrapper = styled('div')`
|
||||||
&& {
|
&& {
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
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 { css } from 'emotion';
|
||||||
|
|
||||||
import Button from '../../muiComponents/Button';
|
import Button from '../../muiComponents/Button';
|
||||||
@@ -12,6 +7,11 @@ 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 +172,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 +186,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>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -201,8 +212,16 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
|
|||||||
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 +236,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 css-164r41r MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
||||||
|
|
||||||
exports[`<LoginModal /> should load the component with props 1`] = `"<div role=\\"presentation\\" class=\\"MuiDialog-root\\" id=\\"login--form-container\\" style=\\"position: fixed; z-index: 1300; right: 0px; bottom: 0px; top: 0px; left: 0px;\\"><div class=\\"MuiBackdrop-root\\" aria-hidden=\\"true\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\"></div><div tabindex=\\"0\\" data-test=\\"sentinelStart\\"></div><div class=\\"MuiDialog-container MuiDialog-scrollPaper\\" style=\\"opacity: 1; webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\" role=\\"none presentation\\" tabindex=\\"-1\\"><div class=\\"MuiPaper-root MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthXs MuiDialog-paperFullWidth MuiPaper-rounded\\" role=\\"dialog\\"><form novalidate=\\"\\"><div class=\\"MuiDialogTitle-root\\"><h2 class=\\"MuiTypography-root MuiTypography-h6\\">Login</h2></div><div class=\\"MuiDialogContent-root\\"><div class=\\"MuiTypography-root MuiPaper-root MuiPaper-elevation6 MuiSnackbarContent-root css-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-11e09xf MuiTypography-body2\\" role=\\"alert\\"><div class=\\"MuiSnackbarContent-message\\"><div class=\\"css-70qvj9\\" id=\\"client-snackbar\\"><svg class=\\"MuiSvgIcon-root css-1mbwbu9\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\\"></path></svg><span><div><strong>Error Title</strong></div><div>Error Description</div></span></div></div></div><div class=\\"MuiFormControl-root MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"username\\">Username<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-username\\" placeholder=\\"Your username\\" required=\\"\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div><div class=\\"MuiFormControl-root css-164r41r MuiFormControl-fullWidth\\"><label class=\\"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated Mui-required Mui-required\\" data-shrink=\\"false\\" for=\\"password\\">Password<span class=\\"MuiFormLabel-asterisk MuiInputLabel-asterisk\\"> *</span></label><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" id=\\"login--form-password\\" placeholder=\\"Your strong password\\" required=\\"\\" type=\\"password\\" class=\\"MuiInputBase-input MuiInput-input\\" value=\\"\\"></div></div></div><div class=\\"MuiDialogActions-root dialog-footer MuiDialogActions-spacing\\"><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit\\" tabindex=\\"0\\" type=\\"button\\" id=\\"login--form-cancel\\"><span class=\\"MuiButton-label\\">Cancel</span><span class=\\"MuiTouchRipple-root\\"></span></button><button class=\\"MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-colorInherit Mui-disabled Mui-disabled\\" tabindex=\\"-1\\" type=\\"submit\\" disabled=\\"\\" id=\\"login--form-submit\\"><span class=\\"MuiButton-label\\">Login</span></button></div></form></div></div><div tabindex=\\"0\\" data-test=\\"sentinelEnd\\"></div></div>"`;
|
||||||
|
|||||||
@@ -1,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';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
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 Heading from '../../muiComponents/Heading';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { spacings } from '../../utils/styles/spacings';
|
import { spacings } from '../../utils/styles/spacings';
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ const EmptyPackage = styled('img')({
|
|||||||
margin: '0 auto',
|
margin: '0 auto',
|
||||||
});
|
});
|
||||||
|
|
||||||
const StyledHeading = styled(Typography)({
|
const StyledHeading = styled(Heading)({
|
||||||
color: colors.primary,
|
color: colors.primary,
|
||||||
marginBottom: spacings.sm,
|
marginBottom: spacings.sm,
|
||||||
});
|
});
|
||||||
@@ -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,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';
|
||||||
|
|||||||
@@ -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,7 +1,5 @@
|
|||||||
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';
|
||||||
@@ -12,6 +10,8 @@ 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';
|
||||||
|
|
||||||
export const OverviewItem = styled('span')`
|
export const OverviewItem = styled('span')`
|
||||||
&& {
|
&& {
|
||||||
|
|||||||
@@ -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,4 +1,4 @@
|
|||||||
import { css } from 'emotion';
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
import { fontWeight, fontSize } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
|
|||||||
@@ -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,35 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { render, cleanup, fireEvent } from '@testing-library/react';
|
||||||
|
|
||||||
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,81 @@
|
|||||||
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 data-testid={'tabs-el'} indicatorColor="primary" onChange={handleChange} textColor="primary" value={tabPosition} variant="fullWidth">
|
||||||
</React.Fragment>
|
<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,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const CommandContainer = styled('div')({
|
export const CommandContainer = styled('div')({
|
||||||
'&&': {
|
'&&': {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontSize } from '../../utils/styles/sizes';
|
import { fontSize } from '../../utils/styles/sizes';
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Repository /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-dense MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko e1wmjxnh0 MuiTypography-subtitle1\\">Repository</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-xugzlj e1wmjxnh4 MuiListItem-dense MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root css-1vhg3jx e1wmjxnh5 MuiListItemText-dense\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body2\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\"><a href=\\"git+https://github.com/verdaccio/ui.git\\" target=\\"_blank\\" class=\\"css-15gl0ho e1wmjxnh2\\">git+https://github.com/verdaccio/ui.git</a></span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div></span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
exports[`<Repository /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root MuiList-dense MuiList-padding MuiList-subheader\\"><h6 class=\\"MuiTypography-root css-b8upko e1wmjxnh0 MuiTypography-subtitle1\\">Repository</h6><div class=\\"MuiButtonBase-root MuiListItem-root css-xugzlj e1wmjxnh4 MuiListItem-dense MuiListItem-gutters MuiListItem-button\\" tabindex=\\"0\\" role=\\"button\\" aria-disabled=\\"false\\"><div class=\\"MuiAvatar-root MuiAvatar-circle MuiAvatar-colorDefault\\"></div><div class=\\"MuiListItemText-root css-1vhg3jx e1wmjxnh5 MuiListItemText-dense\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body2\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-lh0wgu eb8w2fo1\\"><a href=\\"git+https://github.com/verdaccio/ui.git\\" target=\\"_blank\\" class=\\"css-15gl0ho e1wmjxnh2\\">git+https://github.com/verdaccio/ui.git</a></span><button class=\\"MuiButtonBase-root MuiIconButton-root css-0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span><span class=\\"MuiTouchRipple-root\\"></span></button></div></span></div><span class=\\"MuiTouchRipple-root\\"></span></div></ul>"`;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import Grid from '@material-ui/core/Grid';
|
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import Github from '../../icons/GitHub';
|
import Github from '../../icons/GitHub';
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
import ListItemText from '../../muiComponents/ListItemText';
|
||||||
|
import Grid from '../../muiComponents/Grid';
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
@@ -14,9 +14,7 @@ export const StyledText = styled(Text)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const GridRepo = styled(Grid)({
|
export const GridRepo = styled(Grid)({
|
||||||
'&&': {
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GithubLink = styled('a')({
|
export const GithubLink = styled('a')({
|
||||||
|
|||||||
@@ -1,199 +1,80 @@
|
|||||||
import React, { KeyboardEvent, Component, ReactElement } from 'react';
|
import React from 'react';
|
||||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
|
||||||
import { SuggestionSelectedEventData, ChangeEvent } from 'react-autosuggest';
|
|
||||||
import { css } from 'emotion';
|
|
||||||
import { default as IconSearch } from '@material-ui/icons/Search';
|
|
||||||
import InputAdornment from '@material-ui/core/InputAdornment';
|
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
|
||||||
import AutoComplete from '../AutoComplete';
|
import AutoComplete from '../../muiComponents/AutoComplete';
|
||||||
import colors from '../../utils/styles/colors';
|
|
||||||
import { callSearch } from '../../utils/calls';
|
import { callSearch } from '../../utils/calls';
|
||||||
|
|
||||||
export interface State {
|
|
||||||
search: string;
|
|
||||||
suggestions: unknown[];
|
|
||||||
loading: boolean;
|
|
||||||
loaded: boolean;
|
|
||||||
error: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type cancelAllSearchRequests = () => void;
|
|
||||||
export type handlePackagesClearRequested = () => void;
|
|
||||||
export type handleSearch = (event: React.FormEvent<HTMLInputElement>, { newValue, method }: ChangeEvent) => void;
|
|
||||||
export type handleClickSearch = (event: KeyboardEvent<HTMLInputElement>, { suggestionValue, method }: { suggestionValue: object[]; method: string }) => void;
|
|
||||||
export type handleFetchPackages = ({ value: string }) => Promise<void>;
|
|
||||||
export type onBlur = (event: React.FormEvent<HTMLInputElement>) => void;
|
|
||||||
|
|
||||||
const CONSTANTS = {
|
const CONSTANTS = {
|
||||||
API_DELAY: 300,
|
API_DELAY: 300,
|
||||||
PLACEHOLDER_TEXT: 'Search Packages',
|
PLACEHOLDER_TEXT: 'Search Packages',
|
||||||
ABORT_ERROR: 'AbortError',
|
ABORT_ERROR: 'AbortError',
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Search extends Component<RouteComponentProps<{}>, State> {
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
constructor(props: RouteComponentProps<{}>) {
|
const Search: React.FC = () => {
|
||||||
super(props);
|
const [suggestions, setSuggestions] = React.useState([]);
|
||||||
this.state = {
|
const [isLoading, setIsLoading] = React.useState();
|
||||||
search: '',
|
const [hasBeenLoaded, setHasBeenLoaded] = React.useState();
|
||||||
suggestions: [],
|
const [error, setError] = React.useState();
|
||||||
// loading: A boolean value to indicate that request is in pending state.
|
|
||||||
loading: false,
|
|
||||||
// loaded: A boolean value to indicate that result has been loaded.
|
|
||||||
loaded: false,
|
|
||||||
// error: A boolean value to indicate API error.
|
|
||||||
error: false,
|
|
||||||
};
|
|
||||||
this.requestList = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): ReactElement<HTMLElement> {
|
const handleFetchPackages = debounce(async (value: string) => {
|
||||||
const { suggestions, search, loaded, loading, error } = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AutoComplete
|
|
||||||
color={colors.white}
|
|
||||||
onBlur={this.handleOnBlur}
|
|
||||||
onChange={this.handleSearch}
|
|
||||||
onCleanSuggestions={this.handlePackagesClearRequested}
|
|
||||||
onClick={this.handleClickSearch}
|
|
||||||
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
|
|
||||||
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
|
|
||||||
startAdornment={this.getAdorment()}
|
|
||||||
suggestions={suggestions}
|
|
||||||
suggestionsError={error}
|
|
||||||
suggestionsLoaded={loaded}
|
|
||||||
suggestionsLoading={loading}
|
|
||||||
value={search}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel all the requests which are in pending state.
|
|
||||||
*/
|
|
||||||
private cancelAllSearchRequests: cancelAllSearchRequests = () => {
|
|
||||||
this.requestList.forEach(request => request.abort());
|
|
||||||
this.requestList = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel all the request from list and make request list empty.
|
|
||||||
*/
|
|
||||||
private handlePackagesClearRequested: handlePackagesClearRequested = () => {
|
|
||||||
this.setState({
|
|
||||||
suggestions: [],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onChange method for the input element.
|
|
||||||
*/
|
|
||||||
private handleSearch: handleSearch = (event, { newValue, method }) => {
|
|
||||||
// stops event bubbling
|
|
||||||
event.stopPropagation();
|
|
||||||
if (method === 'type') {
|
|
||||||
const value = newValue.trim();
|
|
||||||
this.setState(
|
|
||||||
{
|
|
||||||
search: value,
|
|
||||||
loading: true,
|
|
||||||
loaded: false,
|
|
||||||
error: false,
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
/**
|
|
||||||
* A use case where User keeps adding and removing value in input field,
|
|
||||||
* so we cancel all the existing requests when input is empty.
|
|
||||||
*/
|
|
||||||
if (value.length === 0) {
|
|
||||||
this.cancelAllSearchRequests();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When an user select any package by clicking or pressing return key.
|
|
||||||
*/
|
|
||||||
private handleClickSearch = (
|
|
||||||
event: React.FormEvent<HTMLInputElement>,
|
|
||||||
{ suggestionValue, method }: SuggestionSelectedEventData<unknown>
|
|
||||||
): void | undefined => {
|
|
||||||
const { history } = this.props;
|
|
||||||
// stops event bubbling
|
|
||||||
event.stopPropagation();
|
|
||||||
switch (method) {
|
|
||||||
case 'click':
|
|
||||||
case 'enter':
|
|
||||||
this.setState({ search: '' });
|
|
||||||
history.push(`/-/web/detail/${suggestionValue}`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch packages from API.
|
|
||||||
* For AbortController see: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
||||||
*/
|
|
||||||
private handleFetchPackages: handleFetchPackages = async ({ value }) => {
|
|
||||||
try {
|
try {
|
||||||
const controller = new window.AbortController();
|
const controller = new window.AbortController();
|
||||||
const signal = controller.signal;
|
const signal = controller.signal;
|
||||||
// Keep track of search requests.
|
// Keep track of search requests.
|
||||||
this.requestList.push(controller);
|
// this.requestList.push(controller);
|
||||||
const suggestions = await callSearch(value, signal);
|
const suggestions = await callSearch(value, signal);
|
||||||
// @ts-ignore
|
setSuggestions(
|
||||||
this.setState({
|
// @ts-ignore
|
||||||
suggestions,
|
suggestions.map(suggestion => ({
|
||||||
loaded: true,
|
...suggestion,
|
||||||
});
|
id: suggestion._id,
|
||||||
|
label: suggestion.name,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
setHasBeenLoaded(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
/**
|
/**
|
||||||
* AbortError is not the API error.
|
* AbortError is not the API error.
|
||||||
* It means browser has cancelled the API request.
|
* It means browser has cancelled the API request.
|
||||||
*/
|
*/
|
||||||
if (error.name === CONSTANTS.ABORT_ERROR) {
|
if (error.name === CONSTANTS.ABORT_ERROR) {
|
||||||
this.setState({ error: false, loaded: false });
|
setError(false);
|
||||||
|
setHasBeenLoaded(false);
|
||||||
} else {
|
} else {
|
||||||
this.setState({ error: true, loaded: false });
|
setError(true);
|
||||||
|
setHasBeenLoaded(false);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ loading: false });
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}, CONSTANTS.API_DELAY);
|
||||||
|
|
||||||
private requestList: AbortController[];
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
public getAdorment(): JSX.Element {
|
|
||||||
return (
|
|
||||||
<InputAdornment
|
|
||||||
className={css`
|
|
||||||
color: ${colors.white};
|
|
||||||
`}
|
|
||||||
position={'start'}>
|
|
||||||
<IconSearch />
|
|
||||||
</InputAdornment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* As user focuses out from input, we cancel all the request from requestList
|
|
||||||
* and set the API state parameters to default boolean values.
|
|
||||||
*/
|
|
||||||
private handleOnBlur: onBlur = event => {
|
|
||||||
// stops event bubbling
|
// stops event bubbling
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.setState(
|
setIsLoading(true);
|
||||||
{
|
setHasBeenLoaded(false);
|
||||||
loaded: false,
|
setError(undefined);
|
||||||
loading: false,
|
handleFetchPackages(event.target.value);
|
||||||
error: false,
|
|
||||||
},
|
|
||||||
() => this.cancelAllSearchRequests()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export default withRouter(Search);
|
return (
|
||||||
|
<AutoComplete
|
||||||
|
// onBlur={this.handleOnBlur}
|
||||||
|
onChange={handleChange}
|
||||||
|
// onCleanSuggestions={this.handlePackagesClearRequested}
|
||||||
|
// onClick={this.handleClickSearch}
|
||||||
|
// onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
|
||||||
|
options={suggestions}
|
||||||
|
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
|
||||||
|
// startAdornment={this.getAdorment()}
|
||||||
|
// suggestionsError={error}
|
||||||
|
// suggestionsLoaded={loaded}
|
||||||
|
// suggestionsLoading={loading}
|
||||||
|
// value={search}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Search;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Search /> component test should load the component in default state 1`] = `"<div class=\\"css-1crzyyo e1rflf270\\"><div role=\\"combobox\\" aria-haspopup=\\"listbox\\" aria-owns=\\"react-autowhatever-1\\" aria-expanded=\\"false\\" class=\\"react-autosuggest__container\\"><div class=\\"MuiFormControl-root MuiTextField-root react-autosuggest__input MuiFormControl-fullWidth\\" aria-autocomplete=\\"list\\" aria-controls=\\"react-autowhatever-1\\"><div class=\\"MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart\\"><div class=\\"MuiInputAdornment-root css-16qv2i2 MuiInputAdornment-positionStart\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\\"></path></svg></div><input aria-invalid=\\"false\\" autocomplete=\\"off\\" class=\\"MuiInputBase-input MuiInput-input css-hodoyq MuiInputBase-inputAdornedStart\\" placeholder=\\"Search Packages\\" type=\\"text\\" value=\\"\\"></div></div><div class=\\"MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-cfo6a e1rflf271\\" id=\\"react-autowhatever-1\\" role=\\"listbox\\"></div></div></div>"`;
|
exports[`<Search /> component test should load the component in default state 1`] = `"<div class=\\"css-1crzyyo e1rflf270\\"><div role=\\"combobox\\" aria-haspopup=\\"listbox\\" aria-owns=\\"react-autowhatever-1\\" aria-expanded=\\"false\\" class=\\"react-autosuggest__container\\"><div class=\\"MuiFormControl-root MuiTextField-root react-autosuggest__input MuiFormControl-fullWidth\\" aria-autocomplete=\\"list\\" aria-controls=\\"react-autowhatever-1\\"><div class=\\"MuiInputBase-root MuiInput-root css-n9ojyg MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl MuiInputBase-adornedStart\\"><div class=\\"MuiInputAdornment-root css-fvu7gn MuiInputAdornment-positionStart\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\\"></path></svg></div><input aria-invalid=\\"false\\" autocomplete=\\"off\\" placeholder=\\"Search Packages\\" type=\\"text\\" class=\\"MuiInputBase-input MuiInput-input css-hodoyq MuiInputBase-inputAdornedStart\\" value=\\"\\"></div></div><div class=\\"MuiPaper-root MuiPaper-elevation1 react-autosuggest__suggestions-container css-cfo6a e1rflf271\\" id=\\"react-autowhatever-1\\" role=\\"listbox\\"></div></div></div>"`;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import styled, { css } from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
import { css } from '@emotion/core';
|
||||||
|
|
||||||
import colors from '../../utils/styles/colors';
|
import colors from '../../utils/styles/colors';
|
||||||
import CircularProgress from '../../muiComponents/CircularProgress';
|
import CircularProgress from '../../muiComponents/CircularProgress';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled('span')({
|
export const Wrapper = styled('span')({
|
||||||
'&&': {
|
'&&': {
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">verdaccio has no uplinks.</h6>"`;
|
exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">verdaccio has no uplinks.</h6>"`;
|
||||||
|
|
||||||
exports[`<UpLinks /> component should render the component with uplinks 1`] = `"<h6 class=\\"MuiTypography-root css-1vg6q84 e14i1sy10 MuiTypography-subtitle1\\">Uplinks</h6><ul class=\\"MuiList-root MuiList-padding\\"><li class=\\"MuiListItem-root MuiListItem-gutters\\"><div class=\\"MuiListItemText-root css-5tz9yo e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">npmjs</span></div><div class=\\"css-1l1cv61 e14i1sy11\\"></div><div class=\\"MuiListItemText-root css-5tz9yo e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">over 1 year ago</span></div></li></ul>"`;
|
exports[`<UpLinks /> component should render the component with uplinks 1`] = `"<h6 class=\\"MuiTypography-root css-1vg6q84 e14i1sy10 MuiTypography-subtitle1\\">Uplinks</h6><ul class=\\"MuiList-root MuiList-padding\\"><li class=\\"MuiListItem-root MuiListItem-gutters\\"><div class=\\"MuiListItemText-root css-o655gb e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">npmjs</span></div><div class=\\"css-1l1cv61 e14i1sy11\\"></div><div class=\\"MuiListItemText-root css-o655gb e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">over 1 year ago</span></div></li></ul>"`;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
|
import { default as MuiListItemText } from '../../muiComponents/ListItemText';
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
@@ -16,9 +16,7 @@ export const Spacer = styled('div')({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const ListItemText = styled(MuiListItemText)({
|
export const ListItemText = styled(MuiListItemText)({
|
||||||
'&&': {
|
flex: 'none',
|
||||||
flex: 'none',
|
color: 'black',
|
||||||
color: 'black',
|
opacity: 0.6,
|
||||||
opacity: 0.6,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ describe('<Version /> component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should not render versions', () => {
|
test('should not render versions', () => {
|
||||||
const { queryByText } = render(<ComponentToBeRendered contextValue={{ packageName: detailContextValue.packageName }} />);
|
const { queryByText } = render(
|
||||||
|
<ComponentToBeRendered contextValue={{ packageName: detailContextValue.packageName }} />
|
||||||
|
);
|
||||||
|
|
||||||
expect(queryByText(LABEL_VERSION_HISTORY)).toBeFalsy();
|
expect(queryByText(LABEL_VERSION_HISTORY)).toBeFalsy();
|
||||||
expect(queryByText(LABEL_CURRENT_TAGS)).toBeFalsy();
|
expect(queryByText(LABEL_CURRENT_TAGS)).toBeFalsy();
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Link from '@material-ui/core/Link';
|
|
||||||
import { Link as RouterLink } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { Versions, Time } from '../../../types/packageMeta';
|
import { Versions, Time } from '../../../types/packageMeta';
|
||||||
import { formatDateDistance } from '../../utils/package';
|
import { formatDateDistance } from '../../utils/package';
|
||||||
import List from '../../muiComponents/List';
|
import List from '../../muiComponents/List';
|
||||||
import ListItem from '../../muiComponents/ListItem';
|
import ListItem from '../../muiComponents/ListItem';
|
||||||
|
|
||||||
import { Spacer, ListItemText } from './styles';
|
import { Spacer, ListItemText, StyledLink } from './styles';
|
||||||
|
|
||||||
export const NOT_AVAILABLE = 'Not available';
|
export const NOT_AVAILABLE = 'Not available';
|
||||||
|
|
||||||
@@ -23,9 +21,9 @@ const VersionsHistoryList: React.FC<Props> = ({ versions, packageName, time }) =
|
|||||||
.reverse()
|
.reverse()
|
||||||
.map(version => (
|
.map(version => (
|
||||||
<ListItem className="version-item" key={version}>
|
<ListItem className="version-item" key={version}>
|
||||||
<Link component={RouterLink} to={`/-/web/detail/${packageName}/v/${version}`}>
|
<StyledLink to={`/-/web/detail/${packageName}/v/${version}`}>
|
||||||
<ListItemText>{version}</ListItemText>
|
<ListItemText>{version}</ListItemText>
|
||||||
</Link>
|
</StyledLink>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<ListItemText>{time[version] ? `${formatDateDistance(time[version])} ago` : NOT_AVAILABLE}</ListItemText>
|
<ListItemText>{time[version] ? `${formatDateDistance(time[version])} ago` : NOT_AVAILABLE}</ListItemText>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import styled from 'react-emotion';
|
import styled from '@emotion/styled';
|
||||||
import { default as MuiListItemText } from '@material-ui/core/ListItemText';
|
|
||||||
|
|
||||||
import { fontWeight } from '../../utils/styles/sizes';
|
import { fontWeight } from '../../utils/styles/sizes';
|
||||||
import Text from '../../muiComponents/Text';
|
import Text from '../../muiComponents/Text';
|
||||||
|
import { default as MuiListItemText } from '../../muiComponents/ListItemText';
|
||||||
|
import Link from '../Link';
|
||||||
|
|
||||||
export const StyledText = styled(Text)({
|
export const StyledText = styled(Text)({
|
||||||
fontWeight: fontWeight.bold,
|
fontWeight: fontWeight.bold,
|
||||||
@@ -17,9 +18,11 @@ export const Spacer = styled('div')({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const ListItemText = styled(MuiListItemText)({
|
export const ListItemText = styled(MuiListItemText)({
|
||||||
'&&': {
|
flex: 'none',
|
||||||
flex: 'none',
|
color: 'black',
|
||||||
color: 'black',
|
opacity: 0.6,
|
||||||
opacity: 0.6,
|
});
|
||||||
},
|
|
||||||
|
export const StyledLink = styled(Link)({
|
||||||
|
textDecoration: 'none',
|
||||||
});
|
});
|
||||||
|
|||||||
38
src/design-tokens/ResetStyles.tsx
Normal file
38
src/design-tokens/ResetStyles.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { makeStyles } from '@material-ui/styles';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { fontWeight } from '../utils/styles/sizes';
|
||||||
|
import { breakpoints } from '../utils/styles/media';
|
||||||
|
|
||||||
|
const resetStyles = makeStyles(() => ({
|
||||||
|
'@global': {
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
'html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video': {
|
||||||
|
fontFamily: '"Roboto", Helvetica Neue, Arial, sans-serif',
|
||||||
|
},
|
||||||
|
strong: {
|
||||||
|
fontWeight: fontWeight.semiBold,
|
||||||
|
},
|
||||||
|
'html, body, #root': {
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
'.container': {
|
||||||
|
padding: 15,
|
||||||
|
flex: 1,
|
||||||
|
|
||||||
|
[`@media screen and (min-width: ${breakpoints.container}px)`]: {
|
||||||
|
maxWidth: breakpoints.container,
|
||||||
|
width: '100%',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const ResetStyles: React.FC = ({ children }) => {
|
||||||
|
resetStyles();
|
||||||
|
return <>{children}</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ResetStyles;
|
||||||
15
src/design-tokens/StyleBaseline.tsx
Normal file
15
src/design-tokens/StyleBaseline.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||||
|
import React from 'react';
|
||||||
|
import 'normalize.css';
|
||||||
|
import 'typeface-roboto/index.css';
|
||||||
|
|
||||||
|
import ResetCSS from './ResetStyles';
|
||||||
|
|
||||||
|
const StyleBaseline: React.FC = () => (
|
||||||
|
<>
|
||||||
|
<CssBaseline />
|
||||||
|
<ResetCSS />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default StyleBaseline;
|
||||||
10
src/muiComponents/AppBar/AppBar.tsx
Normal file
10
src/muiComponents/AppBar/AppBar.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUIAppBar, AppBarProps } from '@material-ui/core/AppBar';
|
||||||
|
|
||||||
|
type AppBarRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
||||||
|
|
||||||
|
const AppBar = forwardRef<AppBarRef, AppBarProps>(function AppBar(props, ref) {
|
||||||
|
return <MaterialUIAppBar {...props} ref={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AppBar;
|
||||||
1
src/muiComponents/AppBar/index.ts
Normal file
1
src/muiComponents/AppBar/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './AppBar';
|
||||||
93
src/muiComponents/AutoComplete/AutoComplete.tsx
Normal file
93
src/muiComponents/AutoComplete/AutoComplete.tsx
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import React, { forwardRef, ChangeEvent, useState } from 'react';
|
||||||
|
import { default as MuiAutoComplete, AutocompleteProps } from '@material-ui/lab/Autocomplete';
|
||||||
|
import TextField from '@material-ui/core/TextField';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import Search from '@material-ui/icons/Search';
|
||||||
|
|
||||||
|
import CircularProgress from '../CircularProgress';
|
||||||
|
|
||||||
|
import AutoCompleteTextField from './AutoCompleteTextField';
|
||||||
|
|
||||||
|
const StyledAutoComplete = styled(MuiAutoComplete)({
|
||||||
|
width: '100%',
|
||||||
|
color: 'white',
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledSearch = styled(Search)({
|
||||||
|
color: 'white',
|
||||||
|
marginRight: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledTextField = styled(TextField)({
|
||||||
|
'& .MuiInputBase-root': {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
'& .MuiInput-underline': {
|
||||||
|
':before': {
|
||||||
|
content: "''",
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
':after': {
|
||||||
|
borderColor: 'white',
|
||||||
|
},
|
||||||
|
':hover:before': {
|
||||||
|
content: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
placeholder?: string;
|
||||||
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
options: Array<Option>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type AutoCompleteRef = HTMLDivElement;
|
||||||
|
|
||||||
|
/* eslint-disable react/jsx-no-bind */
|
||||||
|
|
||||||
|
const AutoComplete = forwardRef<AutoCompleteRef, Props>(function AutoComplete({ placeholder, options = [], onChange }, ref) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const isLoading = open && options.length === 0;
|
||||||
|
|
||||||
|
console.log('options', options);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledAutoComplete
|
||||||
|
autoHighlight={true}
|
||||||
|
freeSolo={true}
|
||||||
|
options={options}
|
||||||
|
loading={isLoading}
|
||||||
|
innerRef={ref}
|
||||||
|
open={open}
|
||||||
|
onOpen={() => {
|
||||||
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
getOptionLabel={option => option.label}
|
||||||
|
renderInput={params => (
|
||||||
|
<StyledTextField
|
||||||
|
{...params}
|
||||||
|
onChange={onChange}
|
||||||
|
fullWidth={true}
|
||||||
|
variant="standard"
|
||||||
|
placeholder={placeholder}
|
||||||
|
InputProps={{
|
||||||
|
...params.InputProps,
|
||||||
|
startAdornment: <StyledSearch />,
|
||||||
|
endAdornment: isLoading ? <CircularProgress color="inherit" size={20} /> : null,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AutoComplete;
|
||||||
35
src/muiComponents/AutoComplete/AutoCompleteTextField.tsx
Normal file
35
src/muiComponents/AutoComplete/AutoCompleteTextField.tsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
import Search from '@material-ui/icons/Search';
|
||||||
|
|
||||||
|
import TextField, { TextFieldProps } from '../TextField';
|
||||||
|
|
||||||
|
const StyledTextField = styled(TextField)({
|
||||||
|
'& .MuiInputBase-root': {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
'& .MuiInput-underline': {
|
||||||
|
':before': {
|
||||||
|
content: "''",
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
':after': {
|
||||||
|
borderColor: 'white',
|
||||||
|
},
|
||||||
|
':hover:before': {
|
||||||
|
content: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const StyledSearch = styled(Search)({
|
||||||
|
color: 'white',
|
||||||
|
marginRight: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const AutoCompleteTextField: React.FC<TextFieldProps> = props => {
|
||||||
|
// @ts-ignore: Types of property 'ref' are incompatible.
|
||||||
|
return <StyledTextField {...props} InputProps={{ startAdornment: <StyledSearch /> }} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AutoCompleteTextField;
|
||||||
1
src/muiComponents/AutoComplete/index.ts
Normal file
1
src/muiComponents/AutoComplete/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './AutoComplete';
|
||||||
6
src/muiComponents/Box/Box.tsx
Normal file
6
src/muiComponents/Box/Box.tsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { default as MaterialUIBox, BoxProps } from '@material-ui/core/Box';
|
||||||
|
|
||||||
|
const Box: React.FC<BoxProps> = props => <MaterialUIBox {...props} />;
|
||||||
|
|
||||||
|
export default Box;
|
||||||
1
src/muiComponents/Box/index.ts
Normal file
1
src/muiComponents/Box/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './Box';
|
||||||
10
src/muiComponents/CardActions/CardActions.tsx
Normal file
10
src/muiComponents/CardActions/CardActions.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUICardActions, CardActionsProps } from '@material-ui/core/CardActions';
|
||||||
|
|
||||||
|
type CardActionsRef = HTMLDivElement;
|
||||||
|
|
||||||
|
const CardActions = forwardRef<CardActionsRef, CardActionsProps>(function CardContentActions(props, ref) {
|
||||||
|
return <MaterialUICardActions {...props} innerRef={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default CardActions;
|
||||||
1
src/muiComponents/CardActions/index.ts
Normal file
1
src/muiComponents/CardActions/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './CardActions';
|
||||||
10
src/muiComponents/CardContent/CardContent.tsx
Normal file
10
src/muiComponents/CardContent/CardContent.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUICardContent, CardContentProps } from '@material-ui/core/CardContent';
|
||||||
|
|
||||||
|
type CardContentRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
||||||
|
|
||||||
|
const CardContent = forwardRef<CardContentRef, CardContentProps>(function CardContent(props, ref) {
|
||||||
|
return <MaterialUICardContent {...props} innerRef={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default CardContent;
|
||||||
1
src/muiComponents/CardContent/index.ts
Normal file
1
src/muiComponents/CardContent/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './CardContent';
|
||||||
10
src/muiComponents/Chip/Chip.tsx
Normal file
10
src/muiComponents/Chip/Chip.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUIChip, ChipProps } from '@material-ui/core/Chip';
|
||||||
|
|
||||||
|
type ChipRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
||||||
|
|
||||||
|
const Chip = forwardRef<ChipRef, ChipProps>(function Chip(props, ref) {
|
||||||
|
return <MaterialUIChip {...props} innerRef={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Chip;
|
||||||
1
src/muiComponents/Chip/index.ts
Normal file
1
src/muiComponents/Chip/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './Chip';
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { forwardRef } from 'react';
|
import React, { forwardRef } from 'react';
|
||||||
import { default as MaterialUIDivider, DividerProps } from '@material-ui/core/Divider';
|
import { default as MaterialUIDivider, DividerProps } from '@material-ui/core/Divider';
|
||||||
|
|
||||||
type DividerRef = keyof HTMLElementTagNameMap;
|
type DividerRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
||||||
|
|
||||||
const Divider = forwardRef<DividerRef, DividerProps>(function Divider(props, ref) {
|
const Divider = forwardRef<DividerRef, DividerProps>(function Divider(props, ref) {
|
||||||
return <MaterialUIDivider {...props} innerRef={ref} />;
|
return <MaterialUIDivider {...props} innerRef={ref} />;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUIFab, FabProps } from '@material-ui/core/Fab';
|
||||||
|
|
||||||
|
type FloatingActionButtonRef = HTMLButtonElement;
|
||||||
|
|
||||||
|
const FloatingActionButton = forwardRef<FloatingActionButtonRef, FabProps>(function FloatingActionButton(props, ref) {
|
||||||
|
return <MaterialUIFab {...props} ref={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default FloatingActionButton;
|
||||||
1
src/muiComponents/FloatingActionButton/index.ts
Normal file
1
src/muiComponents/FloatingActionButton/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './FloatingActionButton';
|
||||||
10
src/muiComponents/FormControl/FormControl.tsx
Normal file
10
src/muiComponents/FormControl/FormControl.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUIFormControl, FormControlProps } from '@material-ui/core/FormControl';
|
||||||
|
|
||||||
|
type FormControlRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
||||||
|
|
||||||
|
const FormControl = forwardRef<FormControlRef, FormControlProps>(function FormControl(props, ref) {
|
||||||
|
return <MaterialUIFormControl {...props} innerRef={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default FormControl;
|
||||||
1
src/muiComponents/FormControl/index.ts
Normal file
1
src/muiComponents/FormControl/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './FormControl';
|
||||||
10
src/muiComponents/FormHelperText/FormHelperText.tsx
Normal file
10
src/muiComponents/FormHelperText/FormHelperText.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
|
import { default as MaterialUIFormHelperText, FormHelperTextProps } from '@material-ui/core/FormHelperText';
|
||||||
|
|
||||||
|
type FormHelperTextRef = HTMLButtonElement;
|
||||||
|
|
||||||
|
const FormHelperText = forwardRef<FormHelperTextRef, FormHelperTextProps>(function FormHelperText(props, ref) {
|
||||||
|
return <MaterialUIFormHelperText {...props} ref={ref} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default FormHelperText;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user