File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
packages/plus/src/components/CodeEditor Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @ultraviolet/plus " : patch
3+ ---
4+
5+ Add error message on Code editor
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ const EditorContainer = styled.div`
8080
8181 .cm-editor.cm-focused {
8282 box-shadow: none;
83- border: 1px solid transparent;
83+ border: 1px solid transparent;
8484 }
8585 }
8686`
@@ -125,6 +125,7 @@ type CodeEditorProps = {
125125 'aria-label' ?: string
126126 'data-testid' ?: string
127127 className ?: string
128+ error ?: string
128129}
129130
130131export const CodeEditor = ( {
@@ -144,6 +145,7 @@ export const CodeEditor = ({
144145 'aria-label' : ariaLabel ,
145146 'data-testid' : dataTestId ,
146147 className,
148+ error,
147149} : CodeEditorProps ) => (
148150 < StyledStack data-disabled = { disabled } gap = { 0.5 } >
149151 { label ? < Label labelDescription = { labelDescription } > { label } </ Label > : null }
@@ -185,7 +187,12 @@ export const CodeEditor = ({
185187 </ StyledCopyButton >
186188 ) : null }
187189 </ EditorContainer >
188- { helper ? (
190+ { error && typeof error !== 'boolean' ? (
191+ < Text as = "span" sentiment = "danger" variant = "caption" >
192+ { error }
193+ </ Text >
194+ ) : null }
195+ { ! error && helper ? (
189196 < Text as = "span" prominence = "weak" sentiment = "neutral" variant = "caption" >
190197 { helper }
191198 </ Text >
You can’t perform that action at this time.
0 commit comments