Skip to content

Commit

Permalink
fix(Sonner): correct position on mobile when rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Jun 17, 2024
1 parent 51ad64d commit 2b0e393
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 7 deletions.
7 changes: 7 additions & 0 deletions apps/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-docs

## 0.0.90

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.42.4

## 0.0.89

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-docs",
"version": "0.0.89",
"version": "0.0.90",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
Expand Down
9 changes: 8 additions & 1 deletion apps/docs/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
content: counter(step);
}
.neo-brutalism {
@apply shadow-color-primary active:shadow-color-primary-active border-primary rounded border-2 px-4 py-2 font-bold uppercase transition-all active:translate-x-0.5 active:translate-y-0.5 dark:bg-black;
@apply shadow-color-primary active:shadow-color-primary-active border-primary rounded border-2 px-4 py-2 font-bold uppercase transition-all active:translate-x-0.5 active:translate-y-0.5 dark:bg-black;
}
.clickable-link {
@apply text-primary/80 hover:text-primary cursor-pointer underline underline-offset-4 transition-all;
Expand Down Expand Up @@ -494,3 +494,10 @@
@apply px-4;
}
}

@media (max-width: 600px) {
[data-sonner-toaster] {
--mobile-offset: 32px !important;
right: var(--mobile-offset) !important ;
}
}
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sikka/hawa

## 0.42.4

### Patch Changes

- Sonner: fix wrong position on mobile when direction is `rtl`

## 0.42.3

### Patch Changes
Expand Down
8 changes: 6 additions & 2 deletions packages/components/elements/sonner/Sonner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";

import { cn } from "@util/index";
import { Toaster as SonnerToaster, toast } from "sonner";

import { DirectionType } from "@_types/commonTypes";
Expand All @@ -16,8 +17,11 @@ const Sonner = ({ ...props }: SonnerProps) => {
className="toaster group"
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:hawa-bg-background group-[.toaster]:hawa-text-foreground group-[.toaster]:hawa-border-border group-[.toaster]:hawa-shadow-lg",
toast: cn(
"group toast group-[.toaster]:hawa-bg-background group-[.toaster]:hawa-text-foreground group-[.toaster]:hawa-border-border group-[.toaster]:hawa-shadow-lg",
props.direction === "rtl" &&
"!hawa-start-[32px] md:!hawa-start-auto", //To fix on mobile
),
description: "group-[.toast]:hawa-text-muted-foreground",
actionButton:
"group-[.toast]:hawa-bg-primary group-[.toast]:hawa-text-primary-foreground",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sikka/hawa",
"version": "0.42.3",
"version": "0.42.4",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
7 changes: 7 additions & 0 deletions packages/storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-storybook

## 0.26.111

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.42.4

## 0.26.110

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-storybook",
"version": "0.26.110",
"version": "0.26.111",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const Default: Story = {
richColors
/>
<DropdownMenu
trigger={<Button>Add Toaster</Button>}
triggerProps={{
asChild: true,
}}
trigger={<Button asChild>Add Toaster</Button>}
items={[
{
label: "Info",
Expand Down

0 comments on commit 2b0e393

Please sign in to comment.