From 91e5497ddfe68f1b3cde339442ca31d73fcf4bbd Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 10 Oct 2021 18:34:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Add=20option=20to=20disable=20co?= =?UTF-8?q?nsole=20logging=20of=20todos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/panels/Box.tsx | 4 ++-- src/components/panels/Dialog.tsx | 4 ++-- src/components/panels/Panel.tsx | 5 +++-- src/components/panels/Parenthesis.tsx | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/panels/Box.tsx b/src/components/panels/Box.tsx index dd11b1c..758bbc3 100644 --- a/src/components/panels/Box.tsx +++ b/src/components/panels/Box.tsx @@ -8,8 +8,8 @@ import mergeClassNames from "classnames" export interface BoxProps extends PanelProps {} -export function Box({todo, ...props}: BoxProps): JSX.Element { - if(todo) { +export function Box({todo, warn = true, ...props}: BoxProps): JSX.Element { + if(todo && warn) { console.warn(`TODO: ${props.children}`) } diff --git a/src/components/panels/Dialog.tsx b/src/components/panels/Dialog.tsx index e8a279b..072dbf0 100644 --- a/src/components/panels/Dialog.tsx +++ b/src/components/panels/Dialog.tsx @@ -8,8 +8,8 @@ import mergeClassNames from "classnames" export interface DialogProps extends PanelProps {} -export function Dialog({todo, ...props}: DialogProps): JSX.Element { - if(todo) { +export function Dialog({todo, warn = true, ...props}: DialogProps): JSX.Element { + if(todo && warn) { console.warn(`TODO: ${props.children}`) } diff --git a/src/components/panels/Panel.tsx b/src/components/panels/Panel.tsx index 1e026db..6c3c99c 100644 --- a/src/components/panels/Panel.tsx +++ b/src/components/panels/Panel.tsx @@ -7,11 +7,12 @@ import mergeClassNames from "classnames" export interface PanelProps extends Types.BluelibHTMLProps { todo?: boolean, + warn?: boolean, } -export function Panel({todo, ...props}: PanelProps): JSX.Element { - if(todo) { +export function Panel({todo, warn = true, ...props}: PanelProps): JSX.Element { + if(todo && warn) { console.warn(`TODO: ${props.children}`) } diff --git a/src/components/panels/Parenthesis.tsx b/src/components/panels/Parenthesis.tsx index 3185062..5031dd8 100644 --- a/src/components/panels/Parenthesis.tsx +++ b/src/components/panels/Parenthesis.tsx @@ -8,8 +8,8 @@ import mergeClassNames from "classnames" export interface ParenthesisProps extends PanelProps {} -export function Parenthesis({todo, ...props}: ParenthesisProps): JSX.Element { - if(todo) { +export function Parenthesis({todo, warn = true, ...props}: ParenthesisProps): JSX.Element { + if(todo && warn) { console.warn(`TODO: ${props.children}`) }