@rarcifa/cronos-design-system
Version:
A typescript react component library following the Cronos branding standards
45 lines (44 loc) • 1.47 kB
TypeScript
export interface SearchResult {
/**
* The navigation URL for the search result item, used as the `to` property in a Link component.
*/
to: string;
/**
* The display title for the search result, shown to the user.
*/
title: string;
}
export interface SearchProps {
/**
* A function to fetch search results based on the user's query.
* This function should accept an object containing a `query` string and
* return a promise that resolves to an object with a `data` property,
* where `data` is an array of SearchResult objects.
*
*/
getData: (params: {
query: string;
}) => Promise<{
data: SearchResult[];
}>;
/**
* Specifies the variant of the serchbar, with available options 'primary',
* 'and secondary' to be used different scenarios.
*/
variant?: 'primary' | 'secondary';
/**
* Specifies the size of the search bar, with available options
* 'md' (medium), and 'lg' (large) to fit different spaces and design needs.
*/
size?: 'md' | 'lg';
/**
* If true, applies rounded corners to the search bar, enhancing the visual
* style with a softer, more rounded appearance.
*/
rounded?: boolean;
/**
* A placeholder text that can be used for the searchbar, providing a text
* representation for the search bar input.
*/
placeholder?: string;
}