@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
50 lines (49 loc) • 1.66 kB
TypeScript
export type NavigateParams = {
/** A view slug to navigate to. */
view?: string;
/** A task slug to navigate to. */
task?: string;
/** A runID to navigate to. */
runID?: string;
/** Optional params to pass through to the navigated route. */
params?: Record<string, string | undefined>;
};
type PeekParamsBase = {
/** Optional params to pass through to the peek. */
params?: Record<string, string | undefined>;
/**
* Way of opening the peek.
* @default "side_peek"
*/
as?: "center_peek" | "side_peek";
};
type TaskPeekParams = {
/** A task slug to open in a peek. **/
task: string;
} & PeekParamsBase;
type ViewPeekParams = {
/** A view slug to open in a peek. **/
view: string;
} & PeekParamsBase;
type RunbookPeekParams = {
/** A runbook slug to open in a peek. **/
runbook: string;
} & PeekParamsBase;
type PagePeekParams = {
/** A page path to open in a peek. **/
page: string;
} & PeekParamsBase;
type PeekParams = TaskPeekParams | ViewPeekParams | RunbookPeekParams | PagePeekParams;
export type Router = {
/** The parameters passed to this view. */
params: Record<string, string | undefined>;
/** Navigate to another task or view */
navigate: (params: NavigateParams) => Promise<void>;
/** Get a href string that navigates to another task or view */
getHref: (params: NavigateParams) => Promise<string>;
peek: (params: PeekParams) => void;
};
export declare const useRouter: () => Router;
export declare const isLocalDevRunID: (runID: string) => boolean;
export declare const isRemoteRunID: (runID: string) => boolean;
export {};