@@ -15,6 +15,8 @@ import {
1515 Label ,
1616 CancelLoader ,
1717 SpinLoader ,
18+ palette ,
19+ Link ,
1820} from '@mongodb-js/compass-components' ;
1921import { CodemirrorMultilineEditor } from '@mongodb-js/compass-editor' ;
2022
@@ -29,6 +31,10 @@ import {
2931 downloadSchema ,
3032} from '../stores/schema-export-reducer' ;
3133
34+ const modalStyles = css ( {
35+ width : '610px' ,
36+ } ) ;
37+
3238const loaderStyles = css ( {
3339 marginTop : spacing [ 400 ] ,
3440} ) ;
@@ -54,23 +60,58 @@ const footerStyles = css({
5460 gap : spacing [ 200 ] ,
5561} ) ;
5662
57- const exportSchemaFormatOptions : {
58- title : string ;
59- id : SchemaFormat ;
60- } [ ] = [
63+ const labelStyles = css ( {
64+ color : palette . gray . dark1 ,
65+ } ) ;
66+
67+ const formatDescriptionStyles = css ( {
68+ marginTop : spacing [ 200 ] ,
69+ color : palette . gray . dark1 ,
70+ } ) ;
71+
72+ type SupportedFormat = Exclude < SchemaFormat , 'legacyJSON' > ;
73+
74+ const exportSchemaFormatOptions : SupportedFormat [ ] = [
75+ 'standardJSON' ,
76+ 'mongoDBJSON' ,
77+ 'extendedJSON' ,
78+ ] ;
79+
80+ const exportSchemaFormatOptionDetails : Record <
81+ SupportedFormat ,
6182 {
83+ title : string ;
84+ description : JSX . Element ;
85+ }
86+ > = {
87+ standardJSON : {
6288 title : 'Standard' ,
63- id : 'standardJSON' ,
89+ description : (
90+ < div >
91+ For broad compatibility with tools and systems that rely on
92+ standard
93+ < Link href = "https://json-schema.org/specification" > JSON Schema</ Link >
94+ </ div >
95+ ) ,
6496 } ,
65- {
97+ mongoDBJSON : {
6698 title : 'MongoDB' ,
67- id : 'mongoDBJSON' ,
99+ description : (
100+ < div >
101+ For MongoDB-specific data validation at the database level (includes
102+ BSON data types)
103+ </ div >
104+ ) ,
68105 } ,
69- {
70- title : 'Extended' ,
71- id : 'extendedJSON' ,
106+ extendedJSON : {
107+ title : 'Expanded' ,
108+ description : (
109+ < div >
110+ For schema analysis to help with understanding and documenting your data
111+ </ div >
112+ ) ,
72113 } ,
73- ] ;
114+ } ;
74115
75116const formatTypeRadioBoxGroupId = 'export-schema-format-type-box-group' ;
76117const formatTypeRadioBoxGroupLabelId = `${ formatTypeRadioBoxGroupId } -label` ;
@@ -110,14 +151,15 @@ const ExportSchemaModal: React.FunctionComponent<{
110151 ) ;
111152
112153 return (
113- < Modal open = { isOpen } setOpen = { onClose } >
114- < ModalHeader title = "Export Schema" />
154+ < Modal open = { isOpen } setOpen = { onClose } contentClassName = { modalStyles } >
155+ < ModalHeader title = "Export JSON Schema" />
115156 < ModalBody >
116157 < Label
117158 htmlFor = { formatTypeRadioBoxGroupId }
118159 id = { formatTypeRadioBoxGroupLabelId }
160+ className = { labelStyles }
119161 >
120- Schema Format
162+ Select format:
121163 </ Label >
122164 < RadioBoxGroup
123165 aria-labelledby = { formatTypeRadioBoxGroupLabelId }
@@ -127,7 +169,7 @@ const ExportSchemaModal: React.FunctionComponent<{
127169 value = { exportFormat }
128170 size = "compact"
129171 >
130- { exportSchemaFormatOptions . map ( ( { title , id } ) => {
172+ { exportSchemaFormatOptions . map ( ( id ) => {
131173 return (
132174 < RadioBox
133175 id = { `export-schema-format-${ id } -button` }
@@ -136,11 +178,16 @@ const ExportSchemaModal: React.FunctionComponent<{
136178 value = { id }
137179 key = { id }
138180 >
139- { title }
181+ { exportSchemaFormatOptionDetails [ id ] . title }
140182 </ RadioBox >
141183 ) ;
142184 } ) }
143185 </ RadioBoxGroup >
186+ { exportFormat !== 'legacyJSON' && (
187+ < div className = { formatDescriptionStyles } >
188+ { exportSchemaFormatOptionDetails [ exportFormat ] . description }
189+ </ div >
190+ ) }
144191 < div className = { contentContainerStyles } >
145192 { exportStatus === 'inprogress' && (
146193 < CancelLoader
0 commit comments