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 lineNumbers ?: boolean
129130}
130131
@@ -145,6 +146,7 @@ export const CodeEditor = ({
145146 'aria-label' : ariaLabel ,
146147 'data-testid' : dataTestId ,
147148 className,
149+ error,
148150 lineNumbers = true ,
149151} : CodeEditorProps ) => (
150152 < StyledStack data-disabled = { disabled } gap = { 0.5 } >
@@ -188,7 +190,12 @@ export const CodeEditor = ({
188190 </ StyledCopyButton >
189191 ) : null }
190192 </ EditorContainer >
191- { helper ? (
193+ { error && typeof error !== 'boolean' ? (
194+ < Text as = "span" sentiment = "danger" variant = "caption" >
195+ { error }
196+ </ Text >
197+ ) : null }
198+ { ! error && helper ? (
192199 < Text as = "span" prominence = "weak" sentiment = "neutral" variant = "caption" >
193200 { helper }
194201 </ Text >
You can’t perform that action at this time.
0 commit comments