Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-2753: Add hover effect to request details #495

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions client/src/components/RequestDetailModal/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CopyButton from '~/components/_common/CopyButton';

import { formatBodyIfJSON } from './helpers';
import useStyles from './styles';
import lightTheme from '~/styles/theme';

export interface CodeBlockProps {
body?: string | null;
Expand All @@ -27,17 +28,21 @@ const CodeBlock: FC<CodeBlockProps> = ({ body, headers, title }) => {

if (body && body.length > 0) {
return (
<Card variant="outlined" className={classes.codeblock} data-testid="code-block">
<Card variant="outlined" className={classes.codeBlock} data-testid="code-block">
<CardHeader
title={title || 'Code'}
titleTypographyProps={{ sx: { fontSize: 20, cursor: 'pointer' } }}
titleTypographyProps={{ sx: { fontSize: 20 } }}
action={
<Box display="flex">
<CopyButton copyText={jsonBody} />
<CollapseButton setCollapsed={setCollapsed} collapsed={collapsed} />
</Box>
}
onClick={() => setCollapsed(!collapsed)}
className={classes.codeBlockHeader}
sx={{
backgroundColor: collapsed ? 'unset' : lightTheme.palette.common.blueLightest,
}}
/>
<Collapse in={!collapsed}>
<Divider />
Expand Down
9 changes: 8 additions & 1 deletion client/src/components/RequestDetailModal/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Theme } from '@mui/material/styles';
import { makeStyles } from 'tss-react/mui';
import lightTheme from '~/styles/theme';

export default makeStyles()((_theme: Theme) => ({
modalTitle: {
Expand All @@ -17,11 +18,17 @@ export default makeStyles()((_theme: Theme) => ({
headerName: {
fontWeight: 600,
},
codeblock: {
codeBlock: {
overflow: 'auto',
fontSize: 'small',
marginTop: '16px',
},
codeBlockHeader: {
cursor: 'pointer',
':hover': {
backgroundColor: lightTheme.palette.common.blueLightest,
},
},
code: {
textWrap: 'wrap',
},
Expand Down
Loading