Skip to content

Commit f2cdde8

Browse files
committed
Closes #24
1 parent 76f4b4d commit f2cdde8

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This library does not provide any CSS or base styling for the components / HTML
99
- [Notifications](https://ui.brixi.dev/notifications)
1010
- [Toast](https://ui.brixi.dev/toast)
1111
- [Snackbar](https://ui.brixi.dev/snackbar)
12+
- Sonner (coming soon)
1213

1314
## Installation
1415

@@ -103,7 +104,7 @@ sonner.push({
103104

104105
### Custom Events
105106

106-
If you are working with a server rendered web application using tools like [HTMX](https://htmx.org/) you can trigger events using [custom events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) dispatched on the `window`
107+
As of version 5 you can trigger notifications using [custom events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) dispatched on the `window`.
107108

108109
```typescript
109110
const event = new CustomEvent("notify:sonner", {
@@ -126,7 +127,7 @@ The `detail` object accepts the same interfaces as the function versions (see be
126127

127128
### Custom Event Callbacks
128129

129-
As of version 5 all callback interfaces support `event` and `eventData` properties. When the user interacts with but button a custom event will be fired on the `window`.
130+
As of version 5 all callback interfaces support `event` and `eventData` properties. When the user interacts with a button a custom event will be fired on the `window`.
130131

131132
```typescript
132133
import sonner from "@codewithkyle/notifyjs/sonner";
@@ -266,7 +267,19 @@ type ToastNotification = {
266267

267268
## Sonner
268269

269-
Sonner notifications are great for simple temporary alerts.
270+
Sonner notifications are great for simple temporary alerts. The Sonner notification is slightly opinionated due to the custom interaction and animations.
271+
272+
```css
273+
sonner-toast-component {
274+
opacity: var(--opacity);
275+
transform: translateY(var(--y)) translateY(var(--offset)) scale(var(--scale));
276+
transition: transform 300ms var(--ease-in-out), opacity 300ms var(--ease-in-out);
277+
left: 0;
278+
bottom: 0;
279+
}
280+
```
281+
282+
> **Note**: the sonner components UX is based on the look and feel of the [Sonner react package](https://sonner.emilkowal.ski/).
270283
271284
### Sonner Interface
272285

test/sonner.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ sonner-component {
1212
position: absolute;
1313
opacity: var(--opacity);
1414
transform: translateY(var(--y)) translateY(var(--offset)) scale(var(--scale));
15-
touch-action: none;
1615
transition: transform 300ms var(--ease-in-out), opacity 300ms var(--ease-in-out), height 300ms var(--ease-in-out), box-shadow 300ms var(--ease-in-out);
16+
touch-action: none;
1717
box-sizing: border-box;
1818
padding: 1rem 1.25rem;
1919
display: flex;

0 commit comments

Comments
 (0)