Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky alerts (Toasts) #69

Open
findelallc opened this issue Oct 24, 2020 · 8 comments
Open

Sticky alerts (Toasts) #69

findelallc opened this issue Oct 24, 2020 · 8 comments
Labels
v1 Version 1.x.x

Comments

@findelallc
Copy link

findelallc commented Oct 24, 2020

I just tried to use Sticky alerts (Toasts) but unfortunately for Toasting a precompiled alert version there is no dismiss-able button or option which surely would require, foolish UX flaw generally speaking.

Any luck? is it there already or when can it be expected?

@halfmoonui
Copy link
Owner

I don't exactly understand what you are asking. Are you asking for a close button inside a pre-compiled alert?

@findelallc
Copy link
Author

findelallc commented Oct 28, 2020

in simple word YES, now I manage to write click handler to close it, I think it should have an option to close with animation, the same way it's opened.

@halfmoonui
Copy link
Owner

But you can just put a close button inside your pre-compiled alert like so: <button class="close" data-dismiss="alert" type="button" aria-label="Close">&times;</button>. Clicking that will dismiss that alert, exactly like it dismisses the other sticky alerts.

@findelallc
Copy link
Author

No it doesn't work.

@halfmoonui
Copy link
Owner

halfmoonui commented Oct 29, 2020

Kindly post the code or at least make a Codepen. It worked for me, and there is no reason it shouldn't.
Edit: https://jsfiddle.net/pg2h8dt7/

@findelallc
Copy link
Author

findelallc commented Oct 29, 2020

I am using react next js to work with your plugin

<div className="sticky-alerts bottom-0" style={{top: "auto", right: -75}}>
  <div className="alert card shadow-lg border-0 w-three-quarter filled mr-0" id="precompiled-alert-1">
    <div className="d-flex justify-content-between">
      <h6 className="text-theme-color my-auto font-weight-bold">Blockchain Metrics Notification</h6>
      <button class="close" data-dismiss="alert" type="button" aria-label="Close">&times;</button>
    </div>
  </div>
</div>

@halfmoonui
Copy link
Owner

Since you are using React, I recommend the following:

  1. Make sure you are calling the halfmoon.onDOMContentLoaded() method, preferably on route change. Reference: https://www.gethalfmoon.com/docs/download/#using-npm
  2. Make sure you are aware of binding issues with React: https://github.com/halfmoonui/halfmoon#using-react

Please let me know if that solves your problem. If this doesn't solve it, I would recommend posting a question on a React/Next.JS support forum, maybe even Stack Overflow.

@findelallc
Copy link
Author

findelallc commented Oct 31, 2020

This is how I achieved it -

<div className="sticky-alerts bottom-0" style={{top: "auto", right: -75}}>
  <div className="alert card shadow-lg border-0 w-three-quarter filled mr-0" id="precompiled-alert-1">
    <div className="d-flex justify-content-between">
      <h6 className="text-theme-color my-auto font-weight-bold">Blockchain Metrics Notification</h6>
      <a onClick={this.dismissNotification.bind(this)} className="btn btn-link text-deep-purple-color my-auto">
           <i className="fas fa-times"/>
      </a>
    </div>
  </div>
</div>

Method:

dismissNotification = () => {
   document.getElementById("precompiled-alert-1").style.display = "none";
};

@halfmoonui halfmoonui added the v1 Version 1.x.x label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 Version 1.x.x
Projects
None yet
Development

No branches or pull requests

2 participants