Skip to content

Commit 078cd63

Browse files
committed
v0.1.1
1 parent b2825b8 commit 078cd63

20 files changed

+1056
-339
lines changed

README.md

Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,76 @@
1-
![@dafcoe/vue-swappable-card sample](https://github.com/dafcoe/vue-swappable-card/blob/main/src/assets/images/sample.gif?raw=true)
1+
![@dafcoe/vue-notification sample](https://github.com/dafcoe/vue-notification/blob/main/src/assets/images/sample.gif?raw=true)
22

3-
![npm bundle size](https://img.shields.io/bundlephobia/minzip/@dafcoe/vue-swappable-card)
4-
![npm](https://img.shields.io/npm/dt/@dafcoe/vue-swappable-card?style=flat-square)
5-
![GitHub package.json version](https://img.shields.io/github/package-json/v/dafcoe/vue-swappable-card?style=flat-square)
3+
![npm bundle size](https://img.shields.io/bundlephobia/minzip/@dafcoe/vue-notification?style=flat-square)
4+
![npm](https://img.shields.io/npm/dt/@dafcoe/vue-notification?style=flat-square)
5+
![GitHub package.json version](https://img.shields.io/github/package-json/v/dafcoe/vue-notification?style=flat-square)
66

7-
# @dafcoe/vue-swappable-card
8-
Easy to use, customisable swappable card library built using Vue3.
7+
# @dafcoe/vue-notification
8+
Easy to use, customisable notification/toast library built using Vue3.
99

1010
## Installation
1111
Install the package as a project dependency using `yarn` or `npm`:
1212
```
13-
$ yarn add @dafcoe/vue-swappable-card
13+
$ yarn add @dafcoe/vue-notification
1414
1515
--- or ---
1616
17-
$ npm install --save @dafcoe/vue-swappable-card
17+
$ npm install --save @dafcoe/vue-notification
1818
```
1919

2020
## Usage
21-
Import `VueSwappableCard` component, either globally (on your main.js / main.ts file) or locally (on your component):
21+
Import `VueNotificationList` component, either globally (on your main.js / main.ts file) or locally (on your component):
2222
```js
2323
// Globally
24-
import VueSwappableCard from '@dafcoe/vue-swappable-card'
24+
import VueNotificationList from '@dafcoe/vue-notification'
2525
const app = createApp(App)
26-
app.use(VueSwappableCard).mount('#app')
26+
app.use(VueNotificationList).mount('#app')
2727

2828
// Locally
29-
import {
30-
VueSwappableCard,
31-
} from '@dafcoe/vue-swappable-card'
29+
import { VueNotificationList } from '@dafcoe/vue-notification'
3230
```
3331

3432
Import default styles (optional - you can define your own styling):
3533
```js
36-
import '@dafcoe/vue-swappable-card/dist/vue-swappable-card.css'
34+
import '@dafcoe/vue-notification/dist/vue-notification.css'
3735
```
3836

3937
Use it in the template as follows:
4038
```html
41-
<vue-swappable-card>
42-
<template #content-primary>
43-
<h1>Face A</h1>
44-
<div>
45-
<p>Lorem ipsum dolor sit amet...</p>
46-
</div>
47-
</template>
48-
<template #content-secondary>
49-
<h1>Face B</h1>
50-
<div>
51-
<p>Lorem ipsum dolor sit amet...</p>
52-
</div>
53-
</template>
54-
</vue-swappable-card>
39+
<vue-notification-list></vue-notification-list>
5540
```
5641

5742
## Options
58-
#### Direction
59-
By default, the swap direction is from bottom to top. You can use "from-top", "from-bottom", "from-left" or "from-right" on `direction` prop:
43+
#### Position
44+
By default, the notification list is displayed on bottom right corner of the screen. You can customize this using "top-left", "top-right", "bottom-left" or "bottom-right" on `position` prop:
6045
```html
61-
<vue-swappable-card direction="from-top|from-bottom|from-left|from-right">
62-
...
63-
</vue-wappable-card>
46+
<vue-notification-list position="top-left|top-right|bottom-left|bottom-right"></vue-notification-list>
6447
```
6548

66-
#### Event
67-
By default, the card swaps when overing it. You can use "over" or "click" on `event` prop:
68-
```html
69-
<vue-swappable-card direction="over|click">
70-
...
71-
</vue-wappable-card>
49+
## Pushing Notifications
50+
To push a notification, you have call `setNotification` from `vue-notification.store`, passing a notification object:
51+
```javascript
52+
import { useNotificationStore } from '@dafcoe/vue-notification/vue-notification.store'
53+
...
54+
const { setNotification } = useNotificationStore()
55+
setNotification(notificationA)
56+
setNotification(notificationB)
7257
```
73-
74-
#### Swapped
75-
By default, the primary content / front face is shown as main content/face. You can change this using `swapped` prop:
76-
```html
77-
<vue-swappable-card swapped>
78-
...
79-
</vue-wappable-card>
58+
A notification object has the following properties:
59+
```json
60+
{
61+
"message": string,
62+
"type": string ("info"|"warning"|"alert"|"success"),
63+
"showIcon": boolean,
64+
"dismiss": {
65+
"manually": boolean,
66+
"automatically": boolean
67+
},
68+
"duration": number,
69+
"showDurationProgress": boolean,
70+
"appearance": string ("light"|"dark"|"glass")
71+
}
8072
```
73+
Please check the [demo](https://dafcoe.github.io/vue-notification) page to easily see all propreties in action.
8174

8275
## License
8376
[MIT License](https://opensource.org/licenses/MIT) © [Daf Coe](mailto:dafcoe@gmail.com)

docs/css/app.8bbfed80.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@dafcoe/vue-notification</title><link href="css/app.8bbfed80.css" rel="preload" as="style"><link href="js/app.debf9e21.js" rel="preload" as="script"><link href="js/chunk-vendors.14066df6.js" rel="preload" as="script"><link href="css/app.8bbfed80.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but @dafcoe/vue-notification doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.14066df6.js"></script><script src="js/app.debf9e21.js"></script></body></html>

0 commit comments

Comments
 (0)