From ec9756d741c7cb52a9c7e5724896ee225af52388 Mon Sep 17 00:00:00 2001 From: Jared Malcolm Date: Fri, 26 Oct 2018 16:27:41 -0700 Subject: [PATCH 1/2] Updates the PropsTable to render '[Empty String]' instead of nothing. --- packages/docz/src/components/PropsTable.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/docz/src/components/PropsTable.tsx b/packages/docz/src/components/PropsTable.tsx index 66ad616b3..583888b8a 100644 --- a/packages/docz/src/components/PropsTable.tsx +++ b/packages/docz/src/components/PropsTable.tsx @@ -139,8 +139,12 @@ const BasePropsTable: SFC = ({ of: component, components }) => { {getPropType(prop, Tooltip)} {String(prop.required)} - {prop.defaultValue && - prop.defaultValue.value.replace(/\'/g, '')} + {prop.defaultValue && prop.defaultValue.value === "''" ? ( + [Empty String] + ) : ( + prop.defaultValue && + prop.defaultValue.value.replace(/\'/g, '') + )} {prop.description && prop.description} From fcafed763ade0e305eab16be03f7475c7cb33625 Mon Sep 17 00:00:00 2001 From: Jared Malcolm Date: Fri, 26 Oct 2018 16:54:07 -0700 Subject: [PATCH 2/2] Add the code to print [No Default] --- packages/docz/src/components/PropsTable.tsx | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/docz/src/components/PropsTable.tsx b/packages/docz/src/components/PropsTable.tsx index 583888b8a..f349cd436 100644 --- a/packages/docz/src/components/PropsTable.tsx +++ b/packages/docz/src/components/PropsTable.tsx @@ -138,14 +138,20 @@ const BasePropsTable: SFC = ({ of: component, components }) => { {name} {getPropType(prop, Tooltip)} {String(prop.required)} - - {prop.defaultValue && prop.defaultValue.value === "''" ? ( - [Empty String] - ) : ( - prop.defaultValue && - prop.defaultValue.value.replace(/\'/g, '') - )} - + {!prop.defaultValue ? ( + + [No Default] + + ) : ( + + {prop.defaultValue.value === "''" ? ( + [Empty String] + ) : ( + prop.defaultValue && + prop.defaultValue.value.replace(/\'/g, '') + )} + + )} {prop.description && prop.description} )