Skip to content

Commit 4a08032

Browse files
committed
update modal title, size, and description
1 parent 61384ae commit 4a08032

File tree

3 files changed

+48
-32
lines changed

3 files changed

+48
-32
lines changed

packages/compass-components/src/components/modals/modal-header.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { spacing } from '@leafygreen-ui/tokens';
55
import { Variant as ButtonVariant } from '@leafygreen-ui/button';
66

77
import { useDarkMode } from '../../hooks/use-theme';
8-
import { Body, Icon } from '../leafygreen';
8+
import { Body, H3, Icon } from '../leafygreen';
99

1010
export const Variant = {
1111
Default: ButtonVariant.Primary,
@@ -65,12 +65,14 @@ type ModalHeaderProps = {
6565
title: React.ReactNode;
6666
subtitle?: React.ReactNode;
6767
variant?: Variant;
68+
useLeafyGreenStyling?: boolean;
6869
};
6970

7071
function ModalHeader({
7172
title,
7273
subtitle,
7374
variant = Variant.Default,
75+
useLeafyGreenStyling = false,
7476
}: ModalHeaderProps) {
7577
const darkMode = useDarkMode();
7678

@@ -87,13 +89,20 @@ function ModalHeader({
8789
/>
8890
</div>
8991
)}
90-
<h1
91-
className={cx(titleStyle, darkMode && titleStyleDark)}
92-
data-testid="modal-title"
93-
id="modal-title"
94-
>
95-
{title}
96-
</h1>
92+
93+
{useLeafyGreenStyling ? (
94+
<H3 data-testid="modal-title" id="modal-title">
95+
{title}
96+
</H3>
97+
) : (
98+
<h1
99+
className={cx(titleStyle, darkMode && titleStyleDark)}
100+
data-testid="modal-title"
101+
id="modal-title"
102+
>
103+
{title}
104+
</h1>
105+
)}
97106
{subtitle && <Body>{subtitle}</Body>}
98107
</div>
99108
);

packages/compass-indexes/src/components/create-index-form/create-index-form.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ type CreateIndexFormProps = {
3232
onSelectFieldTypeClick: (idx: number, fType: string) => void;
3333
onAddFieldClick: () => void; // Plus icon.
3434
onRemoveFieldClick: (idx: number) => void; // Minus icon.
35-
showIndexesGuidanceVariant: boolean;
3635
};
3736

3837
function CreateIndexForm({
@@ -43,7 +42,6 @@ function CreateIndexForm({
4342
onSelectFieldTypeClick,
4443
onAddFieldClick,
4544
onRemoveFieldClick,
46-
showIndexesGuidanceVariant,
4745
}: CreateIndexFormProps) {
4846
const { id: connectionId } = useConnectionInfo();
4947
const rollingIndexesFeatureEnabled = !!usePreference('enableRollingIndexes');
@@ -70,22 +68,6 @@ function CreateIndexForm({
7068
className={createIndexModalFieldsStyles}
7169
data-testid="create-index-form"
7270
>
73-
{/* @experiment Early Journey Indexes Guidance & Awareness | Jira Epic: CLOUDP-239367 */}
74-
{showIndexesGuidanceVariant && (
75-
<Body>
76-
The best indexes for your application should consider a number of
77-
factors, such as your data model, and the queries you use most
78-
often. To learn more about indexing best practices, read the{' '}
79-
<a
80-
href="https://docs.mongodb.com/manual/applications/indexes/"
81-
target="_blank"
82-
rel="noopener noreferrer"
83-
>
84-
Index Strategies Documentation.
85-
</a>
86-
</Body>
87-
)}
88-
8971
<Body weight="medium" className={indexFieldsHeaderStyles}>
9072
Index fields
9173
</Body>

packages/compass-indexes/src/components/create-index-modal/create-index-modal.tsx

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
ModalFooter,
66
ModalHeader,
77
ModalBody,
8+
Link,
9+
palette,
810
} from '@mongodb-js/compass-components';
911
import {
1012
fieldAdded,
@@ -33,7 +35,6 @@ type CreateIndexModalProps = React.ComponentProps<typeof CreateIndexForm> & {
3335
onErrorBannerCloseClick: () => void;
3436
onCreateIndexClick: () => void;
3537
onCancelCreateIndexClick: () => void;
36-
showIndexesGuidanceVariant: boolean;
3738
};
3839

3940
function CreateIndexModal({
@@ -43,6 +44,7 @@ function CreateIndexModal({
4344
onErrorBannerCloseClick,
4445
onCreateIndexClick,
4546
onCancelCreateIndexClick,
47+
...props
4648
}: CreateIndexModalProps) {
4749
const connectionInfoRef = useConnectionInfoRef();
4850
const onSetOpen = useCallback(
@@ -73,10 +75,10 @@ function CreateIndexModal({
7375
);
7476

7577
// @experiment Early Journey Indexes Guidance & Awareness | Jira Epic: CLOUDP-239367
76-
const enableInIndexesGuidanceExp =
77-
usePreference('enableIndexesGuidanceExp') || true;
78-
// const showIndexesGuidanceVariant =
79-
// usePreference('showIndexesGuidanceVariant') || true;
78+
const enableInIndexesGuidanceExp = usePreference('enableIndexesGuidanceExp');
79+
const showIndexesGuidanceVariant = usePreference(
80+
'showIndexesGuidanceVariant'
81+
);
8082

8183
useTrackOnChange(
8284
(track: TrackFunction) => {
@@ -95,8 +97,31 @@ function CreateIndexModal({
9597
open={isVisible}
9698
setOpen={onSetOpen}
9799
data-testid="create-index-modal"
100+
size={showIndexesGuidanceVariant ? 'large' : 'default'}
98101
>
99-
<ModalHeader title="Create Index" subtitle={namespace} />
102+
{showIndexesGuidanceVariant ? (
103+
<ModalHeader
104+
title="Create Index"
105+
subtitle={
106+
<span style={{ color: palette.gray.dark1 }}>
107+
The best indexes for your application should consider a number of
108+
factors, such as your data model, and the queries you use most
109+
often. To learn more about indexing best practices, read the{' '}
110+
<Link
111+
href="https://docs.mongodb.com/manual/applications/indexes/"
112+
target="_blank"
113+
rel="noopener noreferrer"
114+
>
115+
Index Strategies Documentation
116+
</Link>
117+
.
118+
</span>
119+
}
120+
useLeafyGreenStyling={true}
121+
/>
122+
) : (
123+
<ModalHeader title="Create Index" subtitle={namespace} />
124+
)}
100125

101126
<ModalBody>
102127
<CreateIndexForm namespace={namespace} {...props} />

0 commit comments

Comments
 (0)