@verdaccio/ui-components 3.0.0-next.1 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/build/components/ActionBar/ActionBar.js +6 -2
- package/build/components/ActionBar/ActionBarAction.js +15 -7
- package/build/components/Author/Author.js +15 -7
- package/build/components/Author/styles.js +7 -23
- package/build/components/CopyClipboard/CopyToClipBoard.js +11 -10
- package/build/components/Deprecated/Deprecated.js +11 -19
- package/build/components/Engines/Engines.js +7 -7
- package/build/components/Install/Install.js +7 -4
- package/build/components/Install/InstallListItem.js +25 -37
- package/build/components/Package/Package.js +14 -6
- package/build/components/RawViewer/RawViewer.js +0 -1
- package/build/components/Readme/Readme.js +11 -26
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/ReadmeDark.js +46 -0
- package/build/components/Readme/ReadmeLight.js +46 -0
- package/build/components/Readme/github-markdown-dark.css +1015 -0
- package/build/components/Readme/github-markdown-light.css +1014 -0
- package/build/components/SettingsMenu/SettingsMenu.js +16 -3
- package/build/components/SideBarTittle/SideBarTittle.js +5 -4
- package/build/components/Versions/HistoryList.js +32 -4
- package/build/components/Versions/Versions.js +16 -2
- package/build/components/Versions/__partials__/data.json +1 -0
- package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +1 -0
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +2 -1
- package/build/src/__mocks__/react-markdown.d.ts +2 -2
- package/build/src/components/Author/styles.d.ts +0 -4
- package/build/src/components/CopyClipboard/CopyToClipBoard.d.ts +1 -1
- package/build/src/components/Deprecated/Deprecated.d.ts +0 -1
- package/build/src/components/Heading/Heading.d.ts +1 -1
- package/build/src/components/Icons/DevsIcons/CommonJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/ES6Module.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/Git.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/NodeJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/TypeScript.d.ts +2 -2
- package/build/src/components/Icons/Earth.d.ts +2 -2
- package/build/src/components/Icons/FileBinary.d.ts +2 -2
- package/build/src/components/Icons/Law.d.ts +2 -2
- package/build/src/components/Icons/License.d.ts +2 -2
- package/build/src/components/Icons/Managers/Npm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Pnpm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Yarn.d.ts +2 -2
- package/build/src/components/Icons/SvgIcon.d.ts +1 -1
- package/build/src/components/Icons/Time.d.ts +2 -2
- package/build/src/components/Icons/Version.d.ts +2 -2
- package/build/src/components/Install/InstallListItem.d.ts +2 -0
- package/build/src/components/Link/Link.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialog.stories.d.ts +2 -2
- package/build/src/components/LoginDialog/LoginDialogForm.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialogFormError.d.ts +1 -1
- package/build/src/components/MenuItem/MenuItem.d.ts +1 -1
- package/build/src/components/Readme/Readme.d.ts +0 -1
- package/build/src/components/Readme/ReadmeDark.d.ts +5 -0
- package/build/src/components/Readme/ReadmeLight.d.ts +5 -0
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -1
- package/build/src/components/Search/Search.stories.d.ts +2 -2
- package/build/src/components/Search/styles.d.ts +1 -1
- package/build/src/components/TextField/TextField.d.ts +1 -1
- package/build/src/components/Versions/HistoryList.d.ts +1 -0
- package/build/src/sections/Footer/Footer.d.ts +2 -2
- package/build/src/sections/Header/LanguageSwitch.d.ts +2 -2
- package/build/src/sections/Header/styles.d.ts +1 -1
- package/build/src/types/packageMeta.d.ts +1 -0
- package/build/src/utils/loadable.d.ts +2 -2
- package/build/store/models/download.js +0 -1
- package/package.json +13 -11
- package/src/components/ActionBar/ActionBar.stories.tsx +1 -1
- package/src/components/ActionBar/ActionBar.test.tsx +17 -10
- package/src/components/ActionBar/ActionBar.tsx +16 -12
- package/src/components/ActionBar/ActionBarAction.tsx +15 -10
- package/src/components/Author/Author.tsx +13 -4
- package/src/components/Author/styles.ts +0 -6
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +4 -3
- package/src/components/Deprecated/Deprecated.tsx +6 -19
- package/src/components/Engines/Engines.tsx +5 -5
- package/src/components/Install/Install.test.tsx +29 -37
- package/src/components/Install/Install.tsx +15 -4
- package/src/components/Install/InstallListItem.tsx +46 -30
- package/src/components/Package/Package.tsx +10 -1
- package/src/components/RawViewer/RawViewer.tsx +1 -6
- package/src/components/Readme/Readme.tsx +10 -21
- package/src/components/Readme/ReadmeDark.tsx +32 -0
- package/src/components/Readme/ReadmeLight.tsx +32 -0
- package/src/components/Readme/github-markdown-dark.css +1015 -0
- package/src/components/Readme/github-markdown-light.css +1014 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +23 -4
- package/src/components/SideBarTittle/SideBarTittle.tsx +1 -0
- package/src/components/Versions/HistoryList.tsx +29 -1
- package/src/components/Versions/Versions.test.tsx +16 -1
- package/src/components/Versions/Versions.tsx +17 -1
- package/src/components/Versions/__partials__/data.json +1 -0
- package/src/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
- package/src/store/models/download.ts +0 -1
- package/src/types/packageMeta.ts +1 -0
|
@@ -5,6 +5,7 @@ import { PackageManagers } from '@verdaccio/types';
|
|
|
5
5
|
import { useConfig } from '../../providers';
|
|
6
6
|
import { render, screen } from '../../test/test-react-testing-library';
|
|
7
7
|
import Install from './Install';
|
|
8
|
+
import { getGlobalInstall } from './InstallListItem';
|
|
8
9
|
import data from './__partials__/data.json';
|
|
9
10
|
|
|
10
11
|
const ComponentToBeRendered: React.FC<{ pkgManagers?: PackageManagers[] }> = () => {
|
|
@@ -16,12 +17,9 @@ const ComponentToBeRendered: React.FC<{ pkgManagers?: PackageManagers[] }> = ()
|
|
|
16
17
|
describe('<Install />', () => {
|
|
17
18
|
test('renders correctly', () => {
|
|
18
19
|
render(<ComponentToBeRendered />);
|
|
19
|
-
expect(screen.getByText('
|
|
20
|
-
expect(screen.getByText('
|
|
21
|
-
expect(screen.getByText('
|
|
22
|
-
expect(screen.getByText('sidebar.installation.install-using-npm-command')).toBeInTheDocument();
|
|
23
|
-
expect(screen.getByText('sidebar.installation.install-using-yarn-command')).toBeInTheDocument();
|
|
24
|
-
expect(screen.getByText('sidebar.installation.install-using-pnpm-command')).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText('yarn add foo@8.0.0')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('pnpm install foo@8.0.0')).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText('npm install foo@8.0.0')).toBeInTheDocument();
|
|
25
23
|
});
|
|
26
24
|
|
|
27
25
|
test('should have 3 children', () => {
|
|
@@ -38,47 +36,41 @@ describe('<Install />', () => {
|
|
|
38
36
|
render(<ComponentToBeRendered />);
|
|
39
37
|
|
|
40
38
|
expect(screen.getByText('sidebar.installation.title')).toBeTruthy();
|
|
41
|
-
expect(screen.queryByText('
|
|
42
|
-
expect(screen.queryByText('
|
|
43
|
-
expect(screen.getByText('
|
|
44
|
-
expect(screen.getByText('sidebar.installation.install-using-npm-command')).toBeInTheDocument();
|
|
45
|
-
expect(
|
|
46
|
-
screen.queryByText('sidebar.installation.install-using-yarn-command')
|
|
47
|
-
).not.toBeInTheDocument();
|
|
48
|
-
expect(
|
|
49
|
-
screen.queryByText('sidebar.installation.install-using-pnpm-command')
|
|
50
|
-
).not.toBeInTheDocument();
|
|
39
|
+
expect(screen.queryByText('pnpm')).not.toBeInTheDocument();
|
|
40
|
+
expect(screen.queryByText('yarn')).not.toBeInTheDocument();
|
|
41
|
+
expect(screen.getByText('npm install foo@8.0.0')).toBeInTheDocument();
|
|
51
42
|
});
|
|
52
43
|
|
|
53
44
|
test('should have the element YARN', () => {
|
|
54
45
|
window.__VERDACCIO_BASENAME_UI_OPTIONS.pkgManagers = ['yarn'];
|
|
55
46
|
render(<ComponentToBeRendered />);
|
|
56
47
|
expect(screen.getByText('sidebar.installation.title')).toBeTruthy();
|
|
57
|
-
expect(screen.queryByText('
|
|
58
|
-
expect(screen.
|
|
59
|
-
expect(screen.
|
|
60
|
-
expect(
|
|
61
|
-
screen.queryByText('sidebar.installation.install-using-npm-command')
|
|
62
|
-
).not.toBeInTheDocument();
|
|
63
|
-
expect(screen.getByText('sidebar.installation.install-using-yarn-command')).toBeInTheDocument();
|
|
64
|
-
expect(
|
|
65
|
-
screen.queryByText('sidebar.installation.install-using-pnpm-command')
|
|
66
|
-
).not.toBeInTheDocument();
|
|
48
|
+
expect(screen.queryByText('pnpm')).not.toBeInTheDocument();
|
|
49
|
+
expect(screen.queryByText('npm')).not.toBeInTheDocument();
|
|
50
|
+
expect(screen.getByText('yarn add foo@8.0.0')).toBeInTheDocument();
|
|
67
51
|
});
|
|
68
52
|
|
|
69
53
|
test('should have the element PNPM', () => {
|
|
70
54
|
window.__VERDACCIO_BASENAME_UI_OPTIONS.pkgManagers = ['pnpm'];
|
|
71
55
|
render(<ComponentToBeRendered />);
|
|
72
|
-
expect(screen.
|
|
73
|
-
expect(screen.
|
|
74
|
-
expect(screen.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
expect(screen.queryByText('pnpm')).not.toBeInTheDocument();
|
|
57
|
+
expect(screen.queryByText('yarn')).not.toBeInTheDocument();
|
|
58
|
+
expect(screen.getByText('pnpm install foo@8.0.0')).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('getGlobalInstall', () => {
|
|
63
|
+
test('no global', () => {
|
|
64
|
+
expect(getGlobalInstall(false, 'foo', '1.0.0')).toEqual('1.0.0@foo');
|
|
65
|
+
});
|
|
66
|
+
test('global', () => {
|
|
67
|
+
expect(getGlobalInstall(true, 'foo', '1.0.0')).toEqual('-g 1.0.0@foo');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('yarn no global', () => {
|
|
71
|
+
expect(getGlobalInstall(false, 'foo', '1.0.0', true)).toEqual('1.0.0@foo');
|
|
72
|
+
});
|
|
73
|
+
test('yarn global', () => {
|
|
74
|
+
expect(getGlobalInstall(true, 'foo', '1.0.0', true)).toEqual('1.0.0@foo');
|
|
83
75
|
});
|
|
84
76
|
});
|
|
@@ -27,7 +27,6 @@ export type Props = {
|
|
|
27
27
|
const Install: React.FC<Props> = ({ packageMeta, packageName, configOptions }) => {
|
|
28
28
|
const { t } = useTranslation();
|
|
29
29
|
const theme = useTheme();
|
|
30
|
-
|
|
31
30
|
if (!packageMeta || !packageName) {
|
|
32
31
|
return null;
|
|
33
32
|
}
|
|
@@ -51,13 +50,25 @@ const Install: React.FC<Props> = ({ packageMeta, packageName, configOptions }) =
|
|
|
51
50
|
subheader={<StyledText variant={'subtitle1'}>{t('sidebar.installation.title')}</StyledText>}
|
|
52
51
|
>
|
|
53
52
|
{hasNpm && (
|
|
54
|
-
<InstallListItem
|
|
53
|
+
<InstallListItem
|
|
54
|
+
dependencyManager={DependencyManager.NPM}
|
|
55
|
+
packageName={packageName}
|
|
56
|
+
packageVersion={packageMeta.latest.version}
|
|
57
|
+
/>
|
|
55
58
|
)}
|
|
56
59
|
{hasYarn && (
|
|
57
|
-
<InstallListItem
|
|
60
|
+
<InstallListItem
|
|
61
|
+
dependencyManager={DependencyManager.YARN}
|
|
62
|
+
packageName={packageName}
|
|
63
|
+
packageVersion={packageMeta.latest.version}
|
|
64
|
+
/>
|
|
58
65
|
)}
|
|
59
66
|
{hasPnpm && (
|
|
60
|
-
<InstallListItem
|
|
67
|
+
<InstallListItem
|
|
68
|
+
dependencyManager={DependencyManager.PNPM}
|
|
69
|
+
packageName={packageName}
|
|
70
|
+
packageVersion={packageMeta.latest.version}
|
|
71
|
+
/>
|
|
61
72
|
)}
|
|
62
73
|
</List>
|
|
63
74
|
</>
|
|
@@ -2,8 +2,8 @@ import styled from '@emotion/styled';
|
|
|
2
2
|
import Avatar from '@mui/material/Avatar';
|
|
3
3
|
import ListItem from '@mui/material/ListItem';
|
|
4
4
|
import ListItemText from '@mui/material/ListItemText';
|
|
5
|
+
import { useTheme } from '@mui/styles';
|
|
5
6
|
import React from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
7
|
|
|
8
8
|
import { useSettings } from '../../providers/PersistenceSettingProvider';
|
|
9
9
|
import CopyToClipBoard from '../CopyClipboard';
|
|
@@ -35,78 +35,94 @@ export enum DependencyManager {
|
|
|
35
35
|
interface Interface {
|
|
36
36
|
packageName: string;
|
|
37
37
|
dependencyManager: DependencyManager;
|
|
38
|
+
packageVersion?: string;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
const
|
|
41
|
+
export function getGlobalInstall(isGlobal, packageVersion, packageName, isYarn = false) {
|
|
42
|
+
const name = isGlobal
|
|
43
|
+
? `${isYarn ? '' : '-g'} ${packageVersion ? `${packageName}@${packageVersion}` : packageName}`
|
|
44
|
+
: packageVersion
|
|
45
|
+
? `${packageName}@${packageVersion}`
|
|
46
|
+
: packageName;
|
|
47
|
+
|
|
48
|
+
return name.trim();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const InstallListItem: React.FC<Interface> = ({
|
|
52
|
+
packageName,
|
|
53
|
+
dependencyManager,
|
|
54
|
+
packageVersion,
|
|
55
|
+
}) => {
|
|
42
56
|
const { localSettings } = useSettings();
|
|
57
|
+
const theme = useTheme();
|
|
43
58
|
const isGlobal = localSettings[packageName]?.global ?? false;
|
|
44
|
-
const pkgName = isGlobal ? `-g ${packageName}` : packageName;
|
|
45
|
-
|
|
46
59
|
switch (dependencyManager) {
|
|
47
60
|
case DependencyManager.NPM:
|
|
48
61
|
return (
|
|
49
62
|
<InstallItem data-testid={'installListItem-npm'}>
|
|
50
|
-
<PackageMangerAvatar alt="npm" sx={{ bgcolor:
|
|
63
|
+
<PackageMangerAvatar alt="npm" sx={{ bgcolor: theme.palette.white }}>
|
|
51
64
|
<Npm />
|
|
52
65
|
</PackageMangerAvatar>
|
|
53
66
|
<InstallListItemText
|
|
54
67
|
primary={
|
|
55
68
|
<CopyToClipBoard
|
|
56
|
-
dataTestId="
|
|
57
|
-
text={
|
|
58
|
-
|
|
59
|
-
})}
|
|
60
|
-
title={t('sidebar.installation.install-using-npm-command', {
|
|
61
|
-
packageName: pkgName,
|
|
62
|
-
})}
|
|
69
|
+
dataTestId="instalNpm"
|
|
70
|
+
text={`npm install ${getGlobalInstall(isGlobal, packageVersion, packageName)}`}
|
|
71
|
+
title={`npm install ${getGlobalInstall(isGlobal, packageVersion, packageName)}`}
|
|
63
72
|
/>
|
|
64
73
|
}
|
|
65
|
-
secondary={t('sidebar.installation.install-using-npm')}
|
|
66
74
|
/>
|
|
67
75
|
</InstallItem>
|
|
68
76
|
);
|
|
69
77
|
case DependencyManager.YARN:
|
|
70
78
|
return (
|
|
71
79
|
<InstallItem data-testid={'installListItem-yarn'}>
|
|
72
|
-
<PackageMangerAvatar alt="yarn" sx={{ bgcolor:
|
|
80
|
+
<PackageMangerAvatar alt="yarn" sx={{ bgcolor: theme.palette.white }}>
|
|
73
81
|
<Yarn />
|
|
74
82
|
</PackageMangerAvatar>
|
|
75
83
|
<InstallListItemText
|
|
76
84
|
primary={
|
|
77
85
|
<CopyToClipBoard
|
|
78
86
|
dataTestId="installYarn"
|
|
79
|
-
text={
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
text={
|
|
88
|
+
isGlobal
|
|
89
|
+
? `yarn ${localSettings.yarnModern ? '' : 'global'} add ${getGlobalInstall(
|
|
90
|
+
isGlobal,
|
|
91
|
+
packageVersion,
|
|
92
|
+
packageName,
|
|
93
|
+
true
|
|
94
|
+
)}`
|
|
95
|
+
: `yarn add ${getGlobalInstall(isGlobal, packageVersion, packageName, true)}`
|
|
96
|
+
}
|
|
97
|
+
title={
|
|
98
|
+
isGlobal
|
|
99
|
+
? `yarn global add ${getGlobalInstall(
|
|
100
|
+
isGlobal,
|
|
101
|
+
packageVersion,
|
|
102
|
+
packageName,
|
|
103
|
+
true
|
|
104
|
+
)}`
|
|
105
|
+
: `yarn add ${getGlobalInstall(isGlobal, packageVersion, packageName, true)}`
|
|
106
|
+
}
|
|
85
107
|
/>
|
|
86
108
|
}
|
|
87
|
-
secondary={t('sidebar.installation.install-using-yarn')}
|
|
88
109
|
/>
|
|
89
110
|
</InstallItem>
|
|
90
111
|
);
|
|
91
112
|
case DependencyManager.PNPM:
|
|
92
113
|
return (
|
|
93
114
|
<InstallItem data-testid={'installListItem-pnpm'}>
|
|
94
|
-
<PackageMangerAvatar alt={'pnpm'} sx={{ bgcolor:
|
|
115
|
+
<PackageMangerAvatar alt={'pnpm'} sx={{ bgcolor: theme.palette.white }}>
|
|
95
116
|
<Pnpm />
|
|
96
117
|
</PackageMangerAvatar>
|
|
97
118
|
<InstallListItemText
|
|
98
119
|
primary={
|
|
99
120
|
<CopyToClipBoard
|
|
100
121
|
dataTestId="installPnpm"
|
|
101
|
-
text={
|
|
102
|
-
|
|
103
|
-
})}
|
|
104
|
-
title={t('sidebar.installation.install-using-pnpm-command', {
|
|
105
|
-
packageName: pkgName,
|
|
106
|
-
})}
|
|
122
|
+
text={`pnpm install ${getGlobalInstall(isGlobal, packageVersion, packageName)}`}
|
|
123
|
+
title={`pnpm install ${getGlobalInstall(isGlobal, packageVersion, packageName)}`}
|
|
107
124
|
/>
|
|
108
125
|
}
|
|
109
|
-
secondary={t('sidebar.installation.install-using-pnpm')}
|
|
110
126
|
/>
|
|
111
127
|
</InstallItem>
|
|
112
128
|
);
|
|
@@ -4,6 +4,7 @@ import BugReport from '@mui/icons-material/BugReport';
|
|
|
4
4
|
import DownloadIcon from '@mui/icons-material/CloudDownload';
|
|
5
5
|
import HomeIcon from '@mui/icons-material/Home';
|
|
6
6
|
import { useTheme } from '@mui/material';
|
|
7
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
7
8
|
import Grid from '@mui/material/Grid';
|
|
8
9
|
import ListItem from '@mui/material/ListItem';
|
|
9
10
|
import Tooltip from '@mui/material/Tooltip';
|
|
@@ -71,6 +72,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
71
72
|
const dispatch = useDispatch<Dispatch>();
|
|
72
73
|
const { t } = useTranslation();
|
|
73
74
|
const theme = useTheme();
|
|
75
|
+
const isLoading = useSelector((state: RootState) => state?.loading?.models.download);
|
|
74
76
|
|
|
75
77
|
const handleDownload = useCallback(
|
|
76
78
|
async (tarballDist: string) => {
|
|
@@ -173,7 +175,13 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
173
175
|
title={t('package.tarball')}
|
|
174
176
|
>
|
|
175
177
|
<IconButton aria-label={t('package.download')} size="large">
|
|
176
|
-
|
|
178
|
+
{isLoading ? (
|
|
179
|
+
<CircularProgress size={13}>
|
|
180
|
+
<DownloadIcon />
|
|
181
|
+
</CircularProgress>
|
|
182
|
+
) : (
|
|
183
|
+
<DownloadIcon />
|
|
184
|
+
)}
|
|
177
185
|
</IconButton>
|
|
178
186
|
</Tooltip>
|
|
179
187
|
</Link>
|
|
@@ -194,6 +202,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
194
202
|
container={true}
|
|
195
203
|
item={true}
|
|
196
204
|
justify="flex-end"
|
|
205
|
+
spacing={3}
|
|
197
206
|
xs={true}
|
|
198
207
|
>
|
|
199
208
|
{renderHomePageLink()}
|
|
@@ -47,12 +47,7 @@ type Props = {
|
|
|
47
47
|
const RawViewer: React.FC<Props> = ({ isOpen = false, onClose, packageMeta }) => {
|
|
48
48
|
const { t } = useTranslation();
|
|
49
49
|
return (
|
|
50
|
-
<Dialog
|
|
51
|
-
data-testid={'rawViewer--dialog'}
|
|
52
|
-
fullScreen={true}
|
|
53
|
-
id="raw-viewer--dialog-container"
|
|
54
|
-
open={isOpen}
|
|
55
|
-
>
|
|
50
|
+
<Dialog data-testid={'rawViewer--dialog'} fullScreen={true} open={isOpen}>
|
|
56
51
|
<ViewerTitle id="viewer-title" onClose={onClose}>
|
|
57
52
|
{t('action-bar-action.raw')}
|
|
58
53
|
</ViewerTitle>
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import 'github-markdown-css';
|
|
3
1
|
import 'highlight.js/styles/default.css';
|
|
4
2
|
import React from 'react';
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import { useCustomTheme } from '../../';
|
|
5
|
+
import ReadmeDark from './ReadmeDark';
|
|
6
|
+
import ReadmeLight from './ReadmeLight';
|
|
7
7
|
import { Props } from './types';
|
|
8
|
-
import { parseReadme } from './utils';
|
|
9
8
|
|
|
10
9
|
const Readme: React.FC<Props> = ({ description }) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/>
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
const { isDarkMode } = useCustomTheme();
|
|
12
|
+
|
|
13
|
+
return isDarkMode ? (
|
|
14
|
+
<ReadmeDark description={description} />
|
|
15
|
+
) : (
|
|
16
|
+
<ReadmeLight description={description} />
|
|
16
17
|
);
|
|
17
18
|
};
|
|
18
19
|
export default Readme;
|
|
19
|
-
|
|
20
|
-
const Wrapper = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
21
|
-
background: theme?.palette.white,
|
|
22
|
-
color: theme?.palette.black,
|
|
23
|
-
padding: theme?.spacing(2, 3),
|
|
24
|
-
ul: {
|
|
25
|
-
listStyle: 'disc',
|
|
26
|
-
},
|
|
27
|
-
img: {
|
|
28
|
-
maxWidth: '100%',
|
|
29
|
-
},
|
|
30
|
-
}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import 'highlight.js/styles/default.css';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { Theme } from '../../Theme';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import styles from './github-markdown-dark.css';
|
|
9
|
+
import { Props } from './types';
|
|
10
|
+
import { parseReadme } from './utils';
|
|
11
|
+
|
|
12
|
+
const Readme: React.FC<Props> = ({ description }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Wrapper
|
|
15
|
+
className={cx('markdown-body', styles['markdown-body'])}
|
|
16
|
+
dangerouslySetInnerHTML={{ __html: parseReadme(description) as string }}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export default Readme;
|
|
21
|
+
|
|
22
|
+
const Wrapper = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
23
|
+
background: theme?.palette.white,
|
|
24
|
+
color: theme?.palette.black,
|
|
25
|
+
padding: theme?.spacing(2, 3),
|
|
26
|
+
ul: {
|
|
27
|
+
listStyle: 'disc',
|
|
28
|
+
},
|
|
29
|
+
img: {
|
|
30
|
+
maxWidth: '100%',
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import 'highlight.js/styles/default.css';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { Theme } from '../../Theme';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import styles from './github-markdown-light.css';
|
|
9
|
+
import { Props } from './types';
|
|
10
|
+
import { parseReadme } from './utils';
|
|
11
|
+
|
|
12
|
+
const Readme: React.FC<Props> = ({ description }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Wrapper
|
|
15
|
+
className={cx('markdown-body', styles['markdown-body'])}
|
|
16
|
+
dangerouslySetInnerHTML={{ __html: parseReadme(description) as string }}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export default Readme;
|
|
21
|
+
|
|
22
|
+
const Wrapper = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
23
|
+
background: theme?.palette.white,
|
|
24
|
+
color: theme?.palette.black,
|
|
25
|
+
padding: theme?.spacing(2, 3),
|
|
26
|
+
ul: {
|
|
27
|
+
listStyle: 'disc',
|
|
28
|
+
},
|
|
29
|
+
img: {
|
|
30
|
+
maxWidth: '100%',
|
|
31
|
+
},
|
|
32
|
+
}));
|