Skip to content

Commit

Permalink
chore: added description to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszjedrasik committed Feb 25, 2021
1 parent b0f7074 commit 4f75b0a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ module.exports = {
['/general/error-handling', 'Error Handling'],
['/general/logging', 'Logging'],
['/general/performance', 'Performance'],
['/general/context', 'Application Context']
['/general/context', 'Application Context'],
['/general/notifications', 'In-app Notifications']
]
},
{
Expand Down
36 changes: 36 additions & 0 deletions packages/core/docs/general/notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# In-app Notifications

In Vue Storefront we're providing Notifications system based on composable `useUiNotification`.

Shows notifications after some actions being performed in the shop. There are three types of notifications: danger, success and info.

There is a dedicated interface for `useUiNotification`:

```ts
interface UseUiNotification {
message: string;
type: 'danger' | 'success' | 'info';
action?: { text: string; onClick: Function };
icon?: string;
persist?: boolean;
id?: symbol;
dismiss?: () => void;
}
```

### How to send notification?

To send a new notification you need to only import `useUiNotification` from composables and pass `type` and `message` to `send` function. Rest parameters are optional.

```js
import { useUiNotification } from '~/composables';

setup() {
const { send } = useUiNotification();

send({
type: 'success',
message: 'Successfully added product to the cart'
})
}
```

0 comments on commit 4f75b0a

Please sign in to comment.