Skip to content

Commit

Permalink
feat: make icons consistent with the rest of Course-Authoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Apr 17, 2024
1 parent 8e0e5a7 commit 996fd2d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/search-modal/SearchResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}>}
Expand Down Expand Up @@ -124,7 +124,7 @@ const SearchResult = ({ hit }) => {
tabIndex={redirectUrl ? 0 : undefined}
role="button"
>
<Icon className="text-muted" src={ItemIcon[hit.blockType] || Article} />
<Icon className="text-muted" src={getItemIcon(hit.blockType)} />
<Stack>
<div className="hit-name small">
<Highlight text={hit.formatted.displayName} />
Expand Down

0 comments on commit 996fd2d

Please sign in to comment.