Skip to content

Commit 8c9ec1e

Browse files
Copilothartra344ccastrotrejoCopilot
authored
fix(designer-ui): Migrate ConnectorSummaryCard from LESS to Fluent UI v9 makeStyles for dark theme (#8674)
* Initial plan * Fix dark theme connector title visibility by increasing CSS specificity Co-authored-by: hartra344 <13208452+hartra344@users.noreply.github.com> * fix(designer-ui): fix ConnectorSummaryCard dark theme in portal-rendered panels Migrate theme-sensitive styles from LESS to Fluent UI v9 makeStyles with design tokens. The previous LESS-based dark theme (.msla-theme-dark cascade) broke when the card rendered inside overlay Drawer portals (e.g., MCP connector selector), since portal content is outside the themed DOM tree. Using tokens (colorNeutralBackground1, colorNeutralForeground1, etc.) resolves this because FluentProvider context works through React portals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: hartra344 <13208452+hartra344@users.noreply.github.com> Co-authored-by: Carlos Castro <ccastrotrejo@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9891b96 commit 8c9ec1e

File tree

3 files changed

+44
-25
lines changed

3 files changed

+44
-25
lines changed

libs/designer-ui/src/lib/connectorsummarycard/connectorsummarycard.less

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.msla-connector-summary-card {
22
position: relative;
3-
background-color: #fff;
43
border-radius: 2px;
54
border: none;
65
outline: none;
@@ -22,11 +21,6 @@
2221
border: 2px solid #ffffff00;
2322
&:focus {
2423
outline: 0;
25-
border: 2px solid rgba(96, 94, 92, 1);
26-
}
27-
28-
&:active {
29-
border: 2px solid rgba(0, 120, 212, 1);
3024
}
3125
}
3226

@@ -96,20 +90,3 @@
9690
}
9791
}
9892

99-
.msla-theme-dark {
100-
.msla-connector-summary-card {
101-
background: @ms-color-primaryBackground;
102-
103-
&:focus {
104-
outline: 1px solid #fff;
105-
}
106-
107-
&:hover {
108-
background: @ms-color-primaryBackgroundHover;
109-
}
110-
}
111-
112-
.msla-connector-summary-title {
113-
color: @ms-color-black;
114-
}
115-
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { makeStyles, shorthands, tokens } from '@fluentui/react-components';
2+
3+
export const useConnectorSummaryCardStyles = makeStyles({
4+
card: {
5+
position: 'relative',
6+
backgroundColor: tokens.colorNeutralBackground1,
7+
borderRadius: '2px',
8+
...shorthands.border('2px', 'solid', 'transparent'),
9+
outline: 'none',
10+
boxShadow: '0px 0.3px 4px 0px rgba(0, 0, 0, 0.1), 0px 1.6px 4px 0px rgba(0, 0, 0, 0.14)',
11+
cursor: 'pointer',
12+
alignItems: 'center',
13+
padding: '8px',
14+
width: '100%',
15+
overflow: 'hidden',
16+
boxSizing: 'border-box',
17+
color: tokens.colorNeutralForeground1,
18+
19+
'&:focus, &:hover': {
20+
boxShadow: '0 1.2px 3.6px rgba(0, 0, 0, 0.1), 0 6.4px 14.4px rgba(0, 0, 0, 0.13)',
21+
},
22+
23+
'&:hover': {
24+
backgroundColor: tokens.colorNeutralBackground1Hover,
25+
},
26+
27+
'&:focus': {
28+
outline: '0',
29+
...shorthands.borderColor(tokens.colorNeutralStroke1),
30+
},
31+
32+
'&:active': {
33+
...shorthands.borderColor(tokens.colorBrandStroke1),
34+
},
35+
},
36+
37+
title: {
38+
color: tokens.colorNeutralForeground1,
39+
},
40+
});

libs/designer-ui/src/lib/connectorsummarycard/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { OperationRuntimeBadges } from './operationRuntimeBadges';
88
import { useCallback } from 'react';
99
import { ChevronRight12Regular } from '@fluentui/react-icons';
1010
import { FavoriteButton } from '../panel';
11+
import { useConnectorSummaryCardStyles } from './connectorsummarycard.styles';
1112

1213
export interface ConnectorSummaryCardProps {
1314
connector: Connector | OperationApi;
@@ -20,6 +21,7 @@ export interface ConnectorSummaryCardProps {
2021
export const ConnectorSummaryCard = (props: ConnectorSummaryCardProps) => {
2122
const { connector, onClick, isCard = true, displayRuntimeInfo, hideFavorites } = props;
2223
const { id } = connector;
24+
const styles = useConnectorSummaryCardStyles();
2325

2426
const connectorName = getDisplayNameFromConnector(connector);
2527
const description = getDescriptionFromConnector(connector);
@@ -37,7 +39,7 @@ export const ConnectorSummaryCard = (props: ConnectorSummaryCardProps) => {
3739
<>
3840
<div className="msla-connector-summary-header">
3941
{isCard ? <ConnectorImage /> : null}
40-
<Text className="msla-connector-summary-title">{connectorName}</Text>
42+
<Text className={mergeClasses('msla-connector-summary-title', styles.title)}>{connectorName}</Text>
4143
<InfoDot
4244
title={connectorName}
4345
description={description}
@@ -66,7 +68,7 @@ export const ConnectorSummaryCard = (props: ConnectorSummaryCardProps) => {
6668
if (isCard) {
6769
return (
6870
<div
69-
className="msla-connector-summary-card"
71+
className={mergeClasses('msla-connector-summary-card', styles.card)}
7072
onClick={handleClick}
7173
onKeyDown={(e) => {
7274
if (e.key === 'Enter' || e.key === ' ') {

0 commit comments

Comments
 (0)