Skip to content

Commit 7e1e43c

Browse files
OpenStaxClaudeclaudeCopilot
authored andcommitted
Address Copilot review comments for Modal migration
This commit addresses all three issues raised by Copilot's automated review: 1. Add link styling to modal card (.modal-card a) - Mirrors bodyCopyRegularStyle link behavior with underline and hover states - Uses link color constants from Typography (linkColor, linkHover) - Binds link colors as CSS variables in Card component 2. Fix CloseModalIcon size for pixel-perfect parity - Changed from 2.5rem to 2rem (height and width) - Matches the final size from legacy styled-components implementation 3. Ensure type="button" cannot be overridden in CloseModalIcon - Moved type="button" after {...props} spread - Prevents consumer-provided type from overriding (e.g., submit in forms) - Maintains previous behavior as a non-submitting close button All changes verified with successful build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) snaps Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Co-Authored-By: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent fd88a5f commit 7e1e43c

5 files changed

Lines changed: 28 additions & 4 deletions

File tree

src/app/components/Modal/Modal.css

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@
3636
color: var(--text-color, #424242);
3737
}
3838

39+
/* Link styling inside modal card - mirrors bodyCopyRegularStyle link behavior */
40+
.modal-card a {
41+
color: var(--link-color, #027EB5);
42+
cursor: pointer;
43+
text-decoration: underline;
44+
}
45+
46+
.modal-card a:hover {
47+
color: var(--link-hover-color, #0064A0);
48+
}
49+
3950
/* Modal header */
4051
.modal-header {
4152
display: flex;
@@ -123,9 +134,9 @@
123134

124135
/* Close modal icon button */
125136
.modal-close-icon {
126-
/* toolbarIconStyles - height/width from textRegularLineHeight (2.5rem) */
127-
height: 2.5rem;
128-
width: 2.5rem;
137+
/* Final legacy CloseModalIcon size: 2rem x 2rem */
138+
height: 2rem;
139+
width: 2rem;
129140
padding: 0.4rem;
130141
/* Base button styles */
131142
cursor: pointer;

src/app/components/Modal/Modal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import './Modal.css';
99
import theme from '../../theme';
1010
import Times from '../Times';
1111
import { toolbarIconColor } from '../../content/components/constants';
12+
import { linkColor, linkHover } from '../Typography/Links.constants';
1213

1314
export const modalPadding = 3.0;
1415

@@ -39,6 +40,8 @@ export function Card({ className, style, ...props }: React.HTMLAttributes<HTMLDi
3940
className={classNames('modal-card', className)}
4041
style={{
4142
'--text-color': theme.color.text.default,
43+
'--link-color': linkColor,
44+
'--link-hover-color': linkHover,
4245
...style,
4346
} as React.CSSProperties}
4447
/>
@@ -117,8 +120,8 @@ export const CloseModalIcon = React.forwardRef<HTMLButtonElement, React.ButtonHT
117120
return (
118121
<button
119122
ref={ref}
120-
type="button"
121123
{...props}
124+
type="button"
122125
className={classNames('modal-close-icon', className)}
123126
style={{
124127
'--icon-color-lighter': toolbarIconColor.lighter,

src/app/components/Modal/__snapshots__/Modal.spec.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ exports[`Modal matches snapshot 1`] = `
1616
className="modal-card"
1717
style={
1818
Object {
19+
"--link-color": "#027EB5",
20+
"--link-hover-color": "#0064A0",
1921
"--text-color": "#424242",
2022
}
2123
}
@@ -104,6 +106,8 @@ exports[`Modal matches snapshot with children 1`] = `
104106
className="modal-card"
105107
style={
106108
Object {
109+
"--link-color": "#027EB5",
110+
"--link-hover-color": "#0064A0",
107111
"--text-color": "#424242",
108112
}
109113
}

src/app/content/highlights/components/__snapshots__/ConfirmationModal.spec.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ exports[`ConfirmationModal matches snapshot 1`] = `
106106
className="modal-card"
107107
style={
108108
Object {
109+
"--link-color": "#027EB5",
110+
"--link-hover-color": "#0064A0",
109111
"--text-color": "#424242",
110112
}
111113
}

src/app/errors/components/__snapshots__/ErrorModal.spec.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ exports[`ErrorModal matches snapshot 1`] = `
6565
className="modal-card"
6666
style={
6767
Object {
68+
"--link-color": "#027EB5",
69+
"--link-hover-color": "#0064A0",
6870
"--text-color": "#424242",
6971
}
7072
}
@@ -249,6 +251,8 @@ exports[`ErrorModal matches snapshots with recorded error ids 1`] = `
249251
className="modal-card"
250252
style={
251253
Object {
254+
"--link-color": "#027EB5",
255+
"--link-hover-color": "#0064A0",
252256
"--text-color": "#424242",
253257
}
254258
}

0 commit comments

Comments
 (0)