live_toast icon indicating copy to clipboard operation
live_toast copied to clipboard

Request: `:top_center` and `:bottom_center`

Open sodapopcan opened this issue 1 year ago • 5 comments

My current toasts show up in the bottom centre. Obviously this isn't super desirable if you have multiple toasts, though my project doesn't need them (I'm more after the auto-hiding).

sodapopcan avatar May 18 '24 14:05 sodapopcan

Will do! Sonner has this option and I would like to have it as well.

srcrip avatar May 20 '24 21:05 srcrip

@srcrip do you need a PR for this or are you already working on it?

sergchernata avatar Jun 13 '24 17:06 sergchernata

Hi @sergchernata,

I can knock it out quickly, but I'm working on a few higher priority issues that are more complex first so if you would like to make a PR it will be appreciated too!

srcrip avatar Jul 06 '24 13:07 srcrip

I ended up just wrapping the LiveToast component into a div and positioning that in the center.

<div class="absolute bottom-0 left-1/2 -translate-x-1/2">
  <LiveToast.toast_group flash={@flash} connected={assigns[:socket] != nil} toast_class_fn={&Front.Helpers.toast_class_fn/1} />
</div>

sergchernata avatar Aug 31 '24 18:08 sergchernata

No worries, I will still make the change requested I've just been caught up with a few other things + thinking about one big change to the lib itself thats taking up my time.

srcrip avatar Sep 11 '24 15:09 srcrip

implemented in #29 (thank you @nallwhy).

srcrip avatar Dec 31 '24 17:12 srcrip