README update - adding example of apiRef definition and fixed component name
Signed-off-by: Alexandr Puzeyev <1099257+Tirex@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-microsoft-calendar': patch
|
||||
---
|
||||
|
||||
README update - example of apiRef definition and fixed component name
|
||||
@@ -32,15 +32,38 @@ yarn add --cwd packages/app @backstage/plugin-microsoft-calendar
|
||||
3. You can then use the provided React component `MicrosoftCalendar` in the backstage frontend where ever you want
|
||||
|
||||
```tsx
|
||||
import { MicrosoftCalendar } from '@backstage/plugin-microsoft-calendar';
|
||||
import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar';
|
||||
|
||||
// ...
|
||||
<Grid item xs={12} md={4}>
|
||||
<MicrosoftCalendar />
|
||||
<MicrosoftCalendarCard />
|
||||
</Grid>;
|
||||
// ...
|
||||
```
|
||||
|
||||
If your homepage is not static JSX add `microsoftCalendarApiRef` to the App's `apis.ts`:
|
||||
|
||||
```ts
|
||||
import {
|
||||
MicrosoftCalendarApiClient,
|
||||
microsoftCalendarApiRef,
|
||||
} from '@backstage/plugin-microsoft-calendar';
|
||||
import {
|
||||
// ...
|
||||
fetchApiRef,
|
||||
// ...
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
export const apis = [
|
||||
// ...
|
||||
createApiFactory({
|
||||
api: microsoftCalendarApiRef,
|
||||
deps: { authApi: microsoftAuthApiRef, fetchApi: fetchApiRef },
|
||||
factory: deps => new MicrosoftCalendarApiClient(deps),
|
||||
}),
|
||||
];
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Reference in New Issue
Block a user