Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/src/Components/SearchSuggest/page.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"type": "page",
"title": "Example page 2",
"description": "Some basic example page 2 with short description.",
"section": "Example section",
"link": "/en/data-visualization/step-by-step/charts/example-2"
},
{
Expand Down
27 changes: 9 additions & 18 deletions src/components/SearchSuggest/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,14 @@ const b = block('dc-search-input');

export const SearchInput = memo(
forwardRef<HTMLElement, SuggestInputProps>((props, ref) => {
const {
id,
text,
size,
autoFocus,
placeholder,
endContent,
onBlur,
onFocus,
onUpdate,
onKeyDown,
className,
controlProps,
} = props;
const {id, text, size, autoFocus, placeholder, endContent, className, controlProps} = props;

const events = {
onUpdate: props.onUpdate,
onKeyDown: props.onKeyDown,
onFocus: props.onFocus,
onBlur: props.onBlur,
};

return (
<TextInput
Expand All @@ -48,10 +42,7 @@ export const SearchInput = memo(
autoComplete={false}
autoFocus={autoFocus}
hasClear={false}
onBlur={onBlur}
onUpdate={onUpdate}
onFocus={onFocus}
onKeyDown={onKeyDown}
{...events}
className={b('input', className)}
id={id}
controlProps={{
Expand Down
5 changes: 4 additions & 1 deletion src/components/SearchSuggest/SuggestItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const SuggestItem: React.FC<SearchSuggestItem> = (item) => {
case SuggestItemType.Page:
return (
<Link className={b('item', {type: item.type})} view={'primary'} href={item.link}>
<HTML className={b('item-title')}>{item.title}</HTML>
<HTML className={b('item-title')}>
{item.section ? item.section : item.title}
</HTML>
{item.section && <HTML className={b('item-subtitle')}>{item.title}</HTML>}
<HTML className={b('item-description')}>{item.description}</HTML>
</Link>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/SearchSuggest/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

&-title,
&-description,
&-subtitle,
&-breadcrumbs > * {
display: block;
overflow: hidden;
Expand Down
1 change: 1 addition & 0 deletions src/components/SearchSuggest/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface SearchSuggestPageItem extends SearchSuggestBaseItem {
title: string;
link: string;
description?: string;
section?: string;
breadcrumbs?: BreadcrumbItem[];
}

Expand Down