Skip to content

Commit

Permalink
adjusted toast message width for mobile experience (#577)
Browse files Browse the repository at this point in the history
* adjusted toast message width for mobile experience

* updated toast containerStyle
  • Loading branch information
rjwignar committed Apr 12, 2024
1 parent adcfd2d commit 654ee24
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hooks/use-alert.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from "react";
import { useToast } from "@chakra-ui/react";

import useMobileBreakpoint from "../hooks/use-mobile-breakpoint";
export type AlertArguments = {
// Use `id` if you want to avoid duplicate alerts showing
id?: string;
Expand All @@ -21,7 +21,12 @@ function truncateMessage(message?: string): string {
}

export function useAlert() {
const toast = useToast();
const isMobile = useMobileBreakpoint();
const toast = useToast({
containerStyle: {
width: isMobile ? "90vw" : "initial",
},
});

const info = useCallback(
({ id, title, message }: AlertArguments) =>
Expand Down

0 comments on commit 654ee24

Please sign in to comment.