From 2e2cdf793dd6140b69683efd8be79f44894ad2c7 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Wed, 17 Apr 2024 11:52:19 -0700 Subject: [PATCH] feat: make icons consistent with the rest of Course-Authoring --- src/search-modal/SearchResult.jsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/search-modal/SearchResult.jsx b/src/search-modal/SearchResult.jsx index e647d93813..a22aed4581 100644 --- a/src/search-modal/SearchResult.jsx +++ b/src/search-modal/SearchResult.jsx @@ -12,27 +12,27 @@ import { Article, Folder, OpenInNew, - Question, - TextFields, - Videocam, } from '@openedx/paragon/icons'; import { useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; -import { getStudioHomeData } from '../studio-home/data/selectors'; -import messages from './messages'; -import Highlight from './Highlight'; +import { COMPONENT_TYPE_ICON_MAP, TYPE_ICONS_MAP } from '../course-unit/constants'; +import { getStudioHomeData } from '../studio-home/data/selectors'; import { useSearchContext } from './manager/SearchManager'; +import Highlight from './Highlight'; +import messages from './messages'; -const ItemIcon = { - vertical: Folder, +const STRUCTURAL_TYPE_ICONS = { + vertical: TYPE_ICONS_MAP.vertical, sequential: Folder, chapter: Folder, - problem: Question, - video: Videocam, - html: TextFields, }; +/** @param {string} blockType */ +function getItemIcon(blockType) { + return STRUCTURAL_TYPE_ICONS[blockType] ?? COMPONENT_TYPE_ICON_MAP[blockType] ?? Article; +} + /** * A single search result (row), usually represents an XBlock/Component * @type {React.FC<{hit: import('./data/api').ContentHit}>} @@ -124,7 +124,7 @@ const SearchResult = ({ hit }) => { tabIndex={redirectUrl ? 0 : undefined} role="button" > - +