///
import { RouteComponentProps } from 'react-router';
interface Conditional {
/** Optional condition under which this item should be used */
readonly condition?: (context: C) => boolean;
}
interface WithIcon {
readonly icon?: React.ComponentType<{
className?: string;
}>;
}
/**
* Configuration for a route.
*
* @template C Context information that is passed to `render` and `condition`
*/
export interface RouteDescriptor extends Conditional {
/** Path of this route (appended to the current match) */
readonly path: string;
readonly exact?: boolean;
readonly render: ((props: C & RouteComponentProps) => React.ReactNode);
}
export interface NavGroupDescriptor extends Conditional {
readonly header?: {
readonly label: string;
readonly icon?: React.ComponentType<{
className?: string;
}>;
};
readonly items: ReadonlyArray>;
}
/**
* Used to customize sidebar items.
* The difference between this and an action button is that nav items get highlighted if their `to` route matches.
*
* @template C Context information that is made available to determine whether the item should be shown (different for each sidebar)
*/
export interface NavItemDescriptor extends Conditional {
/** The text of the item */
readonly label: string;
/** The link destination (appended to the current match) */
readonly to: string;
/** Whether highlighting the item should only be done if `to` matches exactly */
readonly exact?: boolean;
}
export interface NavItemWithIconDescriptor extends NavItemDescriptor, WithIcon {
}
/**
* A descriptor for an action button that should appear somewhere in the UI.
*
* @template C Context information that is made available to determine whether the item should be shown and the link destination
*/
export interface ActionButtonDescriptor extends Conditional, WithIcon {
/** Label for for the button */
readonly label: string;
/** Optional tooltip for the button (if set, should include more information than the label) */
readonly tooltip?: string;
/** Function to return the destination link for the button */
readonly to: (context: C) => string;
}
export {};
//# sourceMappingURL=contributions.d.ts.map