Skip to content

Commit 0f66f7b

Browse files
committed
set up border and covered queries button
1 parent 63d7a66 commit 0f66f7b

File tree

1 file changed

+50
-13
lines changed

1 file changed

+50
-13
lines changed

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

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import React, { useMemo } from 'react';
2-
import { css, spacing, Accordion, Body } from '@mongodb-js/compass-components';
2+
import {
3+
css,
4+
spacing,
5+
Accordion,
6+
Body,
7+
palette,
8+
Button,
9+
} from '@mongodb-js/compass-components';
310
import type { Field } from '../../modules/create-index';
411
import { useAutocompleteFields } from '@mongodb-js/compass-field-store';
512
import { CreateIndexFields } from '../create-index-fields';
@@ -24,6 +31,19 @@ const createIndexModalOptionStyles = css({
2431
paddingLeft: spacing[100] + 2,
2532
});
2633

34+
const plainBorderedCalloutStyles = css({
35+
border: `1px solid ${palette.gray.light2}`,
36+
borderRadius: '12px',
37+
padding: spacing[600],
38+
minHeight: '132px',
39+
});
40+
41+
const coveredQueriesButtonStyles = css({
42+
height: spacing[600] + 4,
43+
float: 'right',
44+
marginTop: spacing[400],
45+
});
46+
2747
type CreateIndexFormProps = {
2848
namespace: string;
2949
fields: Field[];
@@ -62,6 +82,7 @@ function CreateIndexForm({
6282
});
6383
}, [schemaFields]);
6484

85+
const showIndexesGuidanceVariant = true;
6586
return (
6687
<>
6788
<div
@@ -71,19 +92,35 @@ function CreateIndexForm({
7192
<Body weight="medium" className={indexFieldsHeaderStyles}>
7293
Index fields
7394
</Body>
74-
{fields.length > 0 ? (
75-
<CreateIndexFields
76-
schemaFields={schemaFieldNames}
77-
fields={fields}
78-
serverVersion={serverVersion}
79-
isRemovable={!(fields.length > 1)}
80-
onSelectFieldNameClick={onSelectFieldNameClick}
81-
onSelectFieldTypeClick={onSelectFieldTypeClick}
82-
onAddFieldClick={onAddFieldClick}
83-
onRemoveFieldClick={onRemoveFieldClick}
84-
/>
85-
) : null}
95+
<div
96+
className={
97+
showIndexesGuidanceVariant ? plainBorderedCalloutStyles : ''
98+
}
99+
>
100+
{fields.length > 0 ? (
101+
<CreateIndexFields
102+
schemaFields={schemaFieldNames}
103+
fields={fields}
104+
serverVersion={serverVersion}
105+
isRemovable={!(fields.length > 1)}
106+
onSelectFieldNameClick={onSelectFieldNameClick}
107+
onSelectFieldTypeClick={onSelectFieldTypeClick}
108+
onAddFieldClick={onAddFieldClick}
109+
onRemoveFieldClick={onRemoveFieldClick}
110+
/>
111+
) : null}
112+
<Button
113+
className={coveredQueriesButtonStyles}
114+
onClick={() => {
115+
// TODO in CLOUDP-311782
116+
// TODO in CLOUDP-311783
117+
}}
118+
>
119+
Show me covered queries
120+
</Button>
121+
</div>
86122
</div>
123+
87124
<Accordion data-testid="create-index-modal-toggle-options" text="Options">
88125
<div
89126
data-testid="create-index-modal-options"

0 commit comments

Comments
 (0)