docs: general fixes for docs workspace (#5184)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2023-09-22 12:25:48 +03:00
1 parent c1b8f089e3
commit 123b3787d5
15 files changed
+97 -23

No files matched your search

@@ -5,7 +5,8 @@ import { IconProps } from "@medusajs/icons/dist/types"
export type BorderedIconProps = {
icon?: string
IconComponent?: React.FC<IconProps> | null
IconComponent?: ((props: IconProps) => React.JSX.Element) | null
// IconComponent?: React.FC<IconProps> | null
wrapperClassName?: string
iconWrapperClassName?: string
iconClassName?: string
@@ -126,7 +126,11 @@ export const SearchHits = ({
return (
Object.keys(item.hierarchy)
.reverse()
.find((key) => item.hierarchy[key as Hierarchy] !== null) || ""
.find(
(key) =>
item.hierarchy[key as Hierarchy] !== null &&
item.hierarchy[key as Hierarchy] !== item.content
) || ""
)
}
@@ -138,7 +142,13 @@ export const SearchHits = ({
}
return (
<div className="overflow-auto">
<div
className={clsx(
"overflow-auto",
"[&_mark]:bg-medusa-bg-highlight dark:[&_mark]:bg-medusa-bg-highlight-dark",
"[&_mark]:text-medusa-fg-interactive dark:[&_mark]:text-medusa-fg-interactive-dark"
)}
>
{Object.keys(grouped).map((groupName, index) => (
<Fragment key={index}>
<SearchHitGroupName name={groupName} />
@@ -172,11 +182,12 @@ export const SearchHits = ({
"hierarchy",
item.type && item.type !== "content"
? item.type
: item.hierarchy.lvl1
? "lvl1"
: getLastAvailableHeirarchy(item),
: getLastAvailableHeirarchy(item) ||
item.hierarchy.lvl1 ||
"",
]}
hit={item}
separator="."
/>
</span>
{item.type !== "lvl1" && (
@@ -257,11 +257,13 @@ export const SearchModal = ({
"content",
"hierarchy.lvl1",
"hierarchy.lvl2",
"hierarchy.lvl3",
],
attributesToHighlight: [
"content",
"hierarchy.lvl1",
"hierarchy.lvl2",
"hierarchy.lvl3",
],
}}
indices={algolia.indices}