From 13ef6251c688e3139a4f8a7c94ff5dab90719420 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 6 Sep 2022 00:20:27 +0200 Subject: refactor(frontend): toolbar sm breakpoint Improve toolbar appearance on small screens --- subprojects/frontend/src/editor/GenerateButton.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'subprojects/frontend/src/editor/GenerateButton.tsx') diff --git a/subprojects/frontend/src/editor/GenerateButton.tsx b/subprojects/frontend/src/editor/GenerateButton.tsx index 2ffb1a94..485989b5 100644 --- a/subprojects/frontend/src/editor/GenerateButton.tsx +++ b/subprojects/frontend/src/editor/GenerateButton.tsx @@ -7,10 +7,12 @@ import type EditorStore from './EditorStore'; const GENERATE_LABEL = 'Generate'; -export default observer(function GenerateButton({ +const GenerateButton = observer(function GenerateButton({ editorStore, + hideWarnings, }: { editorStore: EditorStore | undefined; + hideWarnings?: boolean | undefined; }): JSX.Element { if (editorStore === undefined) { return ( @@ -26,7 +28,7 @@ export default observer(function GenerateButton({ if (errorCount > 0) { diagnostics.push(`${errorCount} error${errorCount === 1 ? '' : 's'}`); } - if (warningCount > 0) { + if (!(hideWarnings ?? false) && warningCount > 0) { diagnostics.push(`${warningCount} warning${warningCount === 1 ? '' : 's'}`); } const summary = diagnostics.join(' and '); @@ -55,3 +57,9 @@ export default observer(function GenerateButton({ ); }); + +GenerateButton.defaultProps = { + hideWarnings: false, +}; + +export default GenerateButton; -- cgit v1.2.3-54-g00ecf