Skip to content

Commit 3634213

Browse files
committed
add className prop to HadronDocument
1 parent 2b2cc7d commit 3634213

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

packages/compass-collection/src/components/mock-data-generator-modal/raw-schema-confirmation-screen.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ interface RawSchemaConfirmationScreenProps {
2323
fakerSchemaGenerationStatus: MockDataGeneratorState['status'];
2424
}
2525

26-
// note: the "> div" selector works around the lack of a className prop on HadronDocument
27-
const documentContainerStyles = css`
28-
background-color: ${palette.gray.light3};
29-
border: 1px solid ${palette.gray.light2};
30-
border-radius: ${spacing[400]}px;
26+
const documentContainerStyles = css({
27+
backgroundColor: palette.gray.light3,
28+
border: `1px solid ${palette.gray.light2}`,
29+
borderRadius: spacing[400],
30+
});
3131

32-
> div {
33-
padding: ${spacing[400]}px ${spacing[900]}px;
34-
}
35-
`;
32+
const documentStyles = css({
33+
padding: `${spacing[400]}px ${spacing[900]}px`,
34+
});
3635

3736
const descriptionStyles = css({
3837
marginBottom: spacing[200],
@@ -72,6 +71,7 @@ const RawSchemaConfirmationScreen = ({
7271
<Body className={descriptionStyles}>{descriptionText}</Body>
7372
<div className={documentContainerStyles}>
7473
<DocumentList.Document
74+
className={documentStyles}
7575
editable={false}
7676
value={
7777
new HadronDocument(

packages/compass-components/src/components/document-list/document.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const HadronDocument: React.FunctionComponent<{
8888
extraGutterWidth?: number;
8989
onUpdateQuery?: (field: string, value: unknown) => void;
9090
query?: Record<string, unknown>;
91+
className?: string;
9192
}> = ({
9293
value: document,
9394
editable = false,
@@ -96,6 +97,7 @@ const HadronDocument: React.FunctionComponent<{
9697
extraGutterWidth,
9798
onUpdateQuery,
9899
query,
100+
className = '',
99101
}) => {
100102
const { elements, visibleElements } = useHadronDocument(document);
101103
const [autoFocus, setAutoFocus] = useState<{
@@ -130,7 +132,7 @@ const HadronDocument: React.FunctionComponent<{
130132
);
131133

132134
return (
133-
<div>
135+
<div className={className}>
134136
<div
135137
className={hadronDocument}
136138
data-testid="hadron-document"

0 commit comments

Comments
 (0)