fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.58k stars 692 forks source link

Hanging Widow/Orphan support #1007

Closed mdodge-ecgrow closed 11 months ago

mdodge-ecgrow commented 11 months ago

Do you want to request a feature or report a bug? Feature

What is the current behavior? A single word can be dropped down and displayed on the second line and it looks funny.

And here is a screenshot of what I am talking about. image

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

What is the expected behavior? I feel like this library could use support for a property to set the number of hanging widows (I think that is what it is called, or maybe its ophans). Here is a link that talks all about it: https://thenewcode.com/946/CSS-last-line-Controlling-Widows-amp-Orphans

Ideally I would want more than one word to drop down or maybe the option to split the text in half(as close as possible) and display 2 semi-equal lines of text.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 18.2.0, no it did not

fkhadra commented 11 months ago

Hey @mdodge-ecgrow I believe what you want can be accomplished by rendering jsx instead of a string

toast(<div className="your-css-class">Add new static rule...</div>);
// You could even compose it the way you'd like
toast(<><div>Add new static rule</div><br /><span>more text</span></>);