From 0d3b6ccf04f514c26bf3eeca085f286bd85b8800 Mon Sep 17 00:00:00 2001 From: Willie Hung Date: Thu, 7 Dec 2023 20:06:47 -0600 Subject: [PATCH 1/2] [Enhance] Implement Validation for Icon Input Source & Set Default Icon to `Beaker` (#1137) * Revise the logic to handle default icon Signed-off-by: Willie Hung * Categorize different input icon types Signed-off-by: Willie Hung * Remove unused code Signed-off-by: Willie Hung * Update CHANGELOG.md Signed-off-by: Willie Hung * Use readable parameter name Signed-off-by: Willie Hung * Handle different input cases and add tests Signed-off-by: Willie Hung --------- Signed-off-by: Willie Hung Co-authored-by: Josh Romero --- CHANGELOG.md | 1 + .../icon/__snapshots__/icon.test.tsx.snap | 52 +++++++++++++++++- src/components/icon/icon.test.tsx | 55 ++++++++++++++----- src/components/icon/icon.tsx | 52 ++++++++++-------- 4 files changed, 122 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d845121844..9707fcfe2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Add slugs to markdown headers ([#1051](https://github.com/opensearch-project/oui/pull/1051)) - Add `crossInCircleEmpty` and `power` icons ([#1044](https://github.com/opensearch-project/oui/pull/1044)) - Add `Figma` icon and link to OUI Figma resources ([#1064](https://github.com/opensearch-project/oui/pull/1064)) +- Implement validation for icon input source & set default icon to `Beaker` ([#1137](https://github.com/opensearch-project/oui/pull/1137)) ### 🐛 Bug Fixes diff --git a/src/components/icon/__snapshots__/icon.test.tsx.snap b/src/components/icon/__snapshots__/icon.test.tsx.snap index 8ae3b0f871..2480d0d500 100644 --- a/src/components/icon/__snapshots__/icon.test.tsx.snap +++ b/src/components/icon/__snapshots__/icon.test.tsx.snap @@ -10184,7 +10184,7 @@ exports[`OuiIcon props type wrench is rendered 1`] = ` `; -exports[`OuiIcon renders custom components 1`] = ` +exports[`OuiIcon render different types of icons renders custom components 1`] = `