From 236488d48de503a1c9054d71d5e4c1ee6a61b52a Mon Sep 17 00:00:00 2001 From: Tianyu Gao Date: Thu, 25 Jul 2024 13:53:17 +0800 Subject: [PATCH] fix: update recent items icon from SVG to react component (#7478) * update recent items icon from svg to react component Signed-off-by: tygao * Changeset file for PR #7478 created/updated --------- Signed-off-by: tygao Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/7478.yml | 2 ++ .../__snapshots__/recent_items.test.tsx.snap | 2 +- .../chrome/ui/header/assets/recent_items.svg | 3 --- .../public/chrome/ui/header/recent_items.tsx | 6 +++--- .../chrome/ui/header/recent_items_icon.tsx | 17 +++++++++++++++++ src/core/typings.ts | 7 ------- 6 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/7478.yml delete mode 100644 src/core/public/chrome/ui/header/assets/recent_items.svg create mode 100644 src/core/public/chrome/ui/header/recent_items_icon.tsx diff --git a/changelogs/fragments/7478.yml b/changelogs/fragments/7478.yml new file mode 100644 index 000000000000..67e39be073c4 --- /dev/null +++ b/changelogs/fragments/7478.yml @@ -0,0 +1,2 @@ +fix: +- Update recent items icon from SVG to react component ([#7478](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7478)) \ No newline at end of file diff --git a/src/core/public/chrome/ui/header/__snapshots__/recent_items.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/recent_items.test.tsx.snap index 70db9b11a08c..d6255095c0bb 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/recent_items.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/recent_items.test.tsx.snap @@ -24,7 +24,7 @@ exports[`Recent items should render base element normally 1`] = ` class="euiHeaderSectionItemButton__content" > diff --git a/src/core/public/chrome/ui/header/assets/recent_items.svg b/src/core/public/chrome/ui/header/assets/recent_items.svg deleted file mode 100644 index b6427c5e59e4..000000000000 --- a/src/core/public/chrome/ui/header/assets/recent_items.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/core/public/chrome/ui/header/recent_items.tsx b/src/core/public/chrome/ui/header/recent_items.tsx index 1d91ac286a91..f39260056c5c 100644 --- a/src/core/public/chrome/ui/header/recent_items.tsx +++ b/src/core/public/chrome/ui/header/recent_items.tsx @@ -20,8 +20,8 @@ import { WorkspaceObject } from '../../../workspace'; import { createRecentNavLink } from './nav_link'; import { HttpStart } from '../../../http'; import { ChromeNavLink } from '../../../'; -// TODO: replace this icon once added to OUI -import recent_items from './assets/recent_items.svg'; +// TODO: replace this icon once added to OUI https://github.com/opensearch-project/OpenSearch-Dashboards/issues/7354 +import { RecentItemsIcon } from './recent_items_icon'; export interface Props { recentlyAccessed$: Rx.Observable; @@ -71,7 +71,7 @@ export const RecentItems = ({ }} data-test-subj="recentItemsSectionButton" > - + } isOpen={isPopoverOpen} diff --git a/src/core/public/chrome/ui/header/recent_items_icon.tsx b/src/core/public/chrome/ui/header/recent_items_icon.tsx new file mode 100644 index 000000000000..0d9857b182c5 --- /dev/null +++ b/src/core/public/chrome/ui/header/recent_items_icon.tsx @@ -0,0 +1,17 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ +import React from 'react'; + +// TODO: remove this icon once added to OUI https://github.com/opensearch-project/OpenSearch-Dashboards/issues/7354 +export const RecentItemsIcon = () => { + return ( + + + + ); +}; diff --git a/src/core/typings.ts b/src/core/typings.ts index c5e97e2b1d7c..97b83c91e031 100644 --- a/src/core/typings.ts +++ b/src/core/typings.ts @@ -36,10 +36,3 @@ type DeeplyMockedKeys = { T; type MockedKeys = { [P in keyof T]: jest.Mocked }; - -// Need to declare like typings/index.d.ts otherwise would be overwritten -declare module '*.svg' { - const content: string; - // eslint-disable-next-line import/no-default-export - export default content; -}