From a5d497dfc354ff8884fd1a10a6df77784df2f1ed Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Fri, 26 Jan 2024 13:28:08 +0000 Subject: [PATCH 01/13] Revert allowing label to be false --- packages/components/src/checkbox-control/README.md | 3 +-- packages/components/src/checkbox-control/index.tsx | 14 ++++++-------- .../test/__snapshots__/index.tsx.snap | 11 ++++++++--- .../components/src/checkbox-control/test/index.tsx | 7 ------- packages/components/src/checkbox-control/types.ts | 5 ++--- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/packages/components/src/checkbox-control/README.md b/packages/components/src/checkbox-control/README.md index 8044cef0535ea..e89ee489feca9 100644 --- a/packages/components/src/checkbox-control/README.md +++ b/packages/components/src/checkbox-control/README.md @@ -69,12 +69,11 @@ const MyCheckboxControl = () => { The set of props accepted by the component will be specified below. Props not included in this set will be applied to the input element. -#### `label`: `string|false` +#### `label`: `string` A label for the input field, that appears at the side of the checkbox. The prop will be rendered as content a label element. If no prop is passed an empty label is rendered. -If the prop is set to false no label is rendered. - Required: No diff --git a/packages/components/src/checkbox-control/index.tsx b/packages/components/src/checkbox-control/index.tsx index 54a9952d19949..cd70bb8485ac7 100644 --- a/packages/components/src/checkbox-control/index.tsx +++ b/packages/components/src/checkbox-control/index.tsx @@ -125,14 +125,12 @@ export function CheckboxControl( /> ) : null } - { label && ( - - ) } + ); } diff --git a/packages/components/src/checkbox-control/test/__snapshots__/index.tsx.snap b/packages/components/src/checkbox-control/test/__snapshots__/index.tsx.snap index f3bdccc1ccff6..408f18d8c7e77 100644 --- a/packages/components/src/checkbox-control/test/__snapshots__/index.tsx.snap +++ b/packages/components/src/checkbox-control/test/__snapshots__/index.tsx.snap @@ -5,14 +5,14 @@ Snapshot Diff: - First value + Second value -@@ -8,13 +8,27 @@ +@@ -8,17 +8,31 @@ @@ -31,6 +31,11 @@ Snapshot Diff: /> + +