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:
Alexandr Puzeyev
2023-07-31 10:48:27 +06:00
parent dcd7e1622c
commit eea2922e74
2 changed files with 30 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-microsoft-calendar': patch
---
README update - example of apiRef definition and fixed component name
+25 -2
View File
@@ -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),
}),
];
```
![Microsoft Calendar plugin demo](https://user-images.githubusercontent.com/23618736/215717491-25db5fa6-b237-487f-8c00-28f572e8da05.mp4)
![Sample](./docs/microsoft-calendar-plugin.png)