chore: network panel ui polish (#26722)

This commit is contained in:
Pavel Feldman 2023-08-25 19:20:36 -07:00 committed by GitHub
parent 8348f66107
commit ee86b9bc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -93,5 +93,5 @@
}
.network-request .cm-wrapper {
max-height: 300px;
height: 300px;
}

View File

@ -51,7 +51,7 @@ export const NetworkResource: React.FunctionComponent<{
}, [contentType, resource, resourceName, routeStatus]);
return <div className='network-request'>
<Expandable expanded={expanded} setExpanded={setExpanded} title={renderTitle()}>
<Expandable expanded={expanded} setExpanded={setExpanded} title={renderTitle()} expandOnTitleClick={true}>
{expanded && <NetworkResourceDetails resource={resource} />}
</Expandable>
</div>;
@ -78,7 +78,6 @@ const NetworkResourceDetails: React.FunctionComponent<{
}
}
if (resource.response.content._sha1) {
const useBase64 = resource.response.content.mimeType.includes('image');
const response = await fetch(`sha1/${resource.response.content._sha1}`);

View File

@ -21,13 +21,14 @@ export const Expandable: React.FunctionComponent<React.PropsWithChildren<{
title: JSX.Element | string,
setExpanded: Function,
expanded: boolean,
}>> = ({ title, children, setExpanded, expanded }) => {
expandOnTitleClick?: boolean,
}>> = ({ title, children, setExpanded, expanded, expandOnTitleClick }) => {
return <div className={'expandable' + (expanded ? ' expanded' : '')}>
<div className='expandable-title'>
<div className='expandable-title' onClick={() => expandOnTitleClick && setExpanded(!expanded)}>
<div
className={'codicon codicon-' + (expanded ? 'chevron-down' : 'chevron-right')}
style={{ cursor: 'pointer', color: 'var(--vscode-foreground)', marginLeft: '5px' }}
onClick={() => setExpanded(!expanded)} />
onClick={() => !expandOnTitleClick && setExpanded(!expanded)} />
{title}
</div>
{ expanded && <div style={{ marginLeft: 25 }}>{children}</div> }