Skip to content

Commit 71fbc35

Browse files
authored
Merge pull request #3846 from relative-ci/enhance-entry-info
Enhance entry info
2 parents ae42bd7 + aef63fc commit 71fbc35

File tree

5 files changed

+52
-23
lines changed

5 files changed

+52
-23
lines changed

packages/ui/src/components/asset-info/asset-info.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Asset, MetaChunk } from '@bundle-stats/utils/types/webpack';
1414
import { FlexStack } from '../../layout/flex-stack';
1515
import { Tag } from '../../ui/tag';
1616
import { ComponentLink } from '../component-link';
17-
import { EntryInfo } from '../entry-info';
17+
import { EntryInfo, EntryInfoMetaLink } from '../entry-info';
1818
import css from './asset-info.module.css';
1919

2020
interface ChunkModulesLinkProps {
@@ -134,12 +134,13 @@ export const AssetInfo = (props: AssetInfoProps & React.ComponentProps<'div'>) =
134134
>
135135
{item.fileType && (
136136
<EntryInfo.Meta label="File type">
137-
<CustomComponentLink
137+
<EntryInfoMetaLink
138+
as={CustomComponentLink}
138139
{...getBundleAssetsFileTypeComponentLink(item.fileType, fileTypeLabel)}
139140
onClick={onClick}
140141
>
141142
{fileTypeLabel}
142-
</CustomComponentLink>
143+
</EntryInfoMetaLink>
143144
</EntryInfo.Meta>
144145
)}
145146

packages/ui/src/components/entry-info/entry-info.module.css

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,33 @@
8484
}
8585

8686
.metaLabel {
87+
padding: 2px 0;
8788
display: inline-block;
8889
margin-right: var(--space-xxxsmall);
89-
min-width: 5em;
90+
min-width: 6em;
91+
color: var(--color-text-light);
92+
}
93+
94+
.metaLink {
95+
padding: 2px var(--space-xxxsmall);
96+
border-radius: var(--radius-small);
97+
background: var(--color-highlight);
98+
transition: var(--transition-out);
99+
100+
overflow-wrap: break-word;
101+
text-decoration: none;
102+
text-transform: none;
103+
font-weight: normal;
104+
}
105+
106+
.metaLink + .metaLink {
107+
margin-left: var(--space-xxsmall);
108+
}
109+
110+
.metaLink:hover,
111+
.metaLink:active,
112+
.metaLink:focus {
113+
transition: var(--transition-in);
114+
background: var(--color-outline);
115+
color: var(--color-primary-dark);
90116
}

packages/ui/src/components/entry-info/entry-info.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import { Table } from '../../ui/table';
1111
import { RunInfo } from '../run-info';
1212
import css from './entry-info.module.css';
1313

14+
interface EntryInfoMetaLinkProps {
15+
as?: React.ElementType;
16+
}
17+
18+
export const EntryInfoMetaLink = (props: EntryInfoMetaLinkProps & React.ComponentProps<'a'>) => {
19+
const { as: BaseComponent = 'a', className = '', ...restProps } = props;
20+
return <BaseComponent className={cx(css.metaLink, className)} {...restProps} />;
21+
};
22+
1423
interface EntryInfoMetaProps {
1524
label: string;
1625
}
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
.chunksItems {
22
display: inline;
33
}
4-
5-
.chunksItem {
6-
overflow-wrap: break-word;
7-
text-decoration: none;
8-
text-transform: none;
9-
font-weight: normal;
10-
font-size: 1em;
11-
}
12-
13-
.chunksItem + .chunksItem {
14-
margin-left: var(--space-xxxsmall);
15-
}

packages/ui/src/components/module-info/module-info.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Module, MetaChunk } from '@bundle-stats/utils/types/webpack';
1616
import { Stack } from '../../layout/stack';
1717
import { Tag } from '../../ui/tag';
1818
import { ComponentLink } from '../component-link';
19-
import { EntryInfo } from '../entry-info';
19+
import { EntryInfo, EntryInfoMetaLink } from '../entry-info';
2020
import css from './module-info.module.css';
2121

2222
interface ModuleInfoProps {
@@ -83,32 +83,37 @@ export const ModuleInfo = (props: ModuleInfoProps & React.ComponentProps<'div'>)
8383
}
8484

8585
return (
86-
<CustomComponentLink
86+
<EntryInfoMetaLink
87+
as={CustomComponentLink}
8788
{...getBundleModulesByChunk(chunkIds, chunkId)}
8889
className={css.chunksItem}
8990
>
9091
{chunk.name}
91-
</CustomComponentLink>
92+
</EntryInfoMetaLink>
9293
);
9394
})}
9495
</EntryInfo.Meta>
9596
)}
9697

9798
{item?.fileType && (
9899
<EntryInfo.Meta label="File type">
99-
<CustomComponentLink {...getBundleModulesByFileTpe(item.fileType, fileTypeLabel)}>
100+
<EntryInfoMetaLink
101+
as={CustomComponentLink}
102+
{...getBundleModulesByFileTpe(item.fileType, fileTypeLabel)}
103+
>
100104
{fileTypeLabel}
101-
</CustomComponentLink>
105+
</EntryInfoMetaLink>
102106
</EntryInfo.Meta>
103107
)}
104108

105109
<EntryInfo.Meta label="Source">
106-
<CustomComponentLink
110+
<EntryInfoMetaLink
111+
as={CustomComponentLink}
107112
{...getBundleModulesBySource(item.thirdParty || false, sourceTypeLabel)}
108113
onClick={onClick}
109114
>
110115
{sourceTypeLabel}
111-
</CustomComponentLink>
116+
</EntryInfoMetaLink>
112117
</EntryInfo.Meta>
113118
</Stack>
114119
</EntryInfo>

0 commit comments

Comments
 (0)