Skip to content

Commit 3f634a6

Browse files
committed
move border
1 parent 95e406e commit 3f634a6

File tree

1 file changed

+51
-42
lines changed

1 file changed

+51
-42
lines changed

packages/compass-schema-validation/src/components/sample-documents.tsx

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ const sampleDocumentsSectionStyles = css({
2626
display: 'flex',
2727
flexDirection: 'column',
2828
gap: spacing[200],
29+
border: `1px solid ${palette.gray.light2}`,
30+
borderRadius: spacing[400],
31+
padding: spacing[400],
32+
});
33+
34+
const sampleDocumentsSectionDarkModeStyles = css({
35+
border: `1px solid ${palette.gray.dark2}`,
2936
});
3037

3138
const sampleDocumentsStyles = css({
@@ -70,21 +77,15 @@ const initialStateContainerStyles = css({
7077
display: 'flex',
7178
flexDirection: 'column',
7279
alignItems: 'center',
73-
gap: spacing[200],
74-
padding: spacing[400],
80+
gap: spacing[300],
7581
marginTop: spacing[400],
76-
border: `1px solid ${palette.gray.light2}`,
77-
borderRadius: spacing[400],
78-
});
79-
80-
const initialStateContainerDarkModeStyles = css({
81-
border: `1px solid ${palette.gray.dark2}`,
8282
});
8383

8484
const previewHeaderStyles = css({
8585
fontSize: spacing[400],
8686
fontWeight: 'bold',
8787
color: palette.green.dark2,
88+
marginTop: spacing[200],
8889
});
8990

9091
const previewHeaderDarkModeStyles = css({
@@ -142,12 +143,7 @@ const InitialState: React.FC<{
142143
}> = ({ onPreviewClick }) => {
143144
const darkMode = useDarkMode();
144145
return (
145-
<div
146-
className={cx(
147-
initialStateContainerStyles,
148-
darkMode && initialStateContainerDarkModeStyles
149-
)}
150-
>
146+
<div className={initialStateContainerStyles}>
151147
<DocumentGraphic />
152148
<div
153149
className={cx(
@@ -183,43 +179,56 @@ function SampleDocuments({
183179
}) {
184180
const darkMode = useDarkMode();
185181

186-
if (isInitialState)
187-
return <InitialState onPreviewClick={fetchSampleDocuments} />;
188-
189182
return (
190-
<div className={sampleDocumentsSectionStyles}>
191-
<div className={sampleDocumentsStyles}>
192-
{/* Documents that match the validation */}
193-
<div className={sampleDocumentStyles} data-testid="matching-documents">
183+
<div
184+
className={cx(
185+
sampleDocumentsSectionStyles,
186+
darkMode && sampleDocumentsSectionDarkModeStyles
187+
)}
188+
>
189+
{isInitialState ? (
190+
<InitialState onPreviewClick={fetchSampleDocuments} />
191+
) : (
192+
<div className={sampleDocumentsStyles}>
193+
{/* Documents that match the validation */}
194194
<div
195-
className={cx(
196-
documentHeadingStyles,
197-
darkMode ? matchingStylesDark : matchingStylesLight
198-
)}
195+
className={sampleDocumentStyles}
196+
data-testid="matching-documents"
199197
>
200-
<Icon glyph="CheckmarkWithCircle" size="small" />
201-
<Body className={documentHeadingTextStyles}>Passed validation</Body>
198+
<div
199+
className={cx(
200+
documentHeadingStyles,
201+
darkMode ? matchingStylesDark : matchingStylesLight
202+
)}
203+
>
204+
<Icon glyph="CheckmarkWithCircle" size="small" />
205+
<Body className={documentHeadingTextStyles}>
206+
Passed validation
207+
</Body>
208+
</div>
209+
<DocumentPreview document={validDocument} />
202210
</div>
203-
<DocumentPreview document={validDocument} />
204-
</div>
205211

206-
{/* Documents that do not match the validation */}
207-
<div
208-
className={sampleDocumentStyles}
209-
data-testid="notmatching-documents"
210-
>
212+
{/* Documents that do not match the validation */}
211213
<div
212-
className={cx(
213-
documentHeadingStyles,
214-
darkMode ? notMatchingStylesDark : notMatchingStylesLight
215-
)}
214+
className={sampleDocumentStyles}
215+
data-testid="notmatching-documents"
216216
>
217-
<Icon glyph="XWithCircle" size="small" />
218-
<Body className={documentHeadingTextStyles}>Failed validation</Body>
217+
<div
218+
className={cx(
219+
documentHeadingStyles,
220+
darkMode ? notMatchingStylesDark : notMatchingStylesLight
221+
)}
222+
>
223+
<Icon glyph="XWithCircle" size="small" />
224+
<Body className={documentHeadingTextStyles}>
225+
Failed validation
226+
</Body>
227+
</div>
228+
<DocumentPreview document={invalidDocument} />
219229
</div>
220-
<DocumentPreview document={invalidDocument} />
221230
</div>
222-
</div>
231+
)}
223232
</div>
224233
);
225234
}

0 commit comments

Comments
 (0)