added initial docs
This commit is contained in:
@@ -49,12 +49,12 @@ export interface TechRadarAdditionalOptions {
|
||||
svgProps?: object;
|
||||
}
|
||||
|
||||
export type TechRadarApi = {
|
||||
export interface TechRadarApi {
|
||||
width: number;
|
||||
height: number;
|
||||
load: () => Promise<TechRadarLoaderResponse>;
|
||||
additionalOpts: TechRadarAdditionalOptions;
|
||||
};
|
||||
}
|
||||
|
||||
export const techRadarApiRef = new ApiRef<TechRadarApi>({
|
||||
id: 'plugin.techradar',
|
||||
|
||||
@@ -27,9 +27,9 @@ import {
|
||||
ErrorApi,
|
||||
} from '@backstage/core';
|
||||
import Radar from '../components/Radar';
|
||||
import { techRadarApiRef, TechRadar, TechRadarLoaderResponse } from '../api';
|
||||
import { techRadarApiRef, TechRadarApi, TechRadarLoaderResponse } from '../api';
|
||||
|
||||
const useTechRadarLoader = (techRadarApi: TechRadar) => {
|
||||
const useTechRadarLoader = (techRadarApi: TechRadarApi) => {
|
||||
const [state, setState] = useState<{
|
||||
loading: boolean;
|
||||
error?: Error;
|
||||
@@ -60,7 +60,7 @@ const useTechRadarLoader = (techRadarApi: TechRadar) => {
|
||||
|
||||
const RadarPage: FC<{}> = () => {
|
||||
const errorApi = useApi<ErrorApi>(errorApiRef);
|
||||
const techRadarApi = useApi<TechRadar>(techRadarApiRef);
|
||||
const techRadarApi = useApi<TechRadarApi>(techRadarApiRef);
|
||||
const { loading, error, data } = useTechRadarLoader(techRadarApi);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user