Comments (9)
@dstroot could you post your webpack configuration?
This package requires you to have .css extensions setup
In the future, this package could get the .css hosted in cdn or as separate import and ask the user to import it themselves
from react-notifications-component.
FYI:
import ReactNotification from 'react-notifications-component';
import '../../node_modules/react-notifications-component/dist/theme.css'; <-----!
from react-notifications-component.
Also - how do you add the font awesome checkmark??
from react-notifications-component.
Hey,
dstroot,
I've tested now with create-react-app
and style is imported properly. Make sure you're referencing node_modules properly, I don't know your folder structure so I can't tell you exactly. This is how I imported in create-react-app
import "../node_modules/react-notifications-component/dist/theme.css";
To include font awesome check mark - or any other icon toolkit - you need either:
- custom content with custom CSS
- change current CSS to suit your needs
The way we're doing it on GitHub pages is custom content with custom CSS, but it should work well also if you tweak react-notifications-component
stylesheet. Have a look at samples to see how it is done.
from react-notifications-component.
usually if you use CRA, then it's just import 'react-notifications-component/dist/theme.css'
from react-notifications-component.
@teodosii - thanks for the responses. I tried to use custom content but I could get it to work. I am assuming I was not referencing the custom content react component properly.
@themre - yep, using CRA and you are right - I had to dive into the folder structure to find the theme so I took the full path.
from react-notifications-component.
You could or couldn't? I didn't get what you meant by
I was not referencing the custom content react component properly
Here is how custom content is used in samples to have that icon included
this.props.addNotification(Object.assign({}, notification, {
width: 275,
container: getContainer(),
content: (
<div className="notification-custom-success">
<div className="notification-custom-icon">
<i className={iconClassName} />
</div>
<div className="notification-custom-content">
<p className="notification-message">
{message}
</p>
</div>
</div>
)
}));
And this is the SASS code for it (not included by react-notifications-component
)
.notification-custom-icon {
flex-basis: 20%;
position: relative;
display: inline-block;
padding: 8px 8px 8px 12px;
.fa {
top: 50%;
left: 50%;
color: #fff;
font-size: 28px;
position: relative;
transform: translate(-50%, -50%);
}
}
.notification-custom-success {
width: 100%;
display: flex;
background-color: #28a745;
.notification-custom-icon {
border-left: 8px solid darken(#28a745, 15%);
}
}
I will update README soon so that there will be some examples there as well.
from react-notifications-component.
@PierreAndreis - my config is based on:
"react-scripts": "2.0.0-next.3e165448"
@teodosii - that worked! Thanks!
My main point was the readme didn't mention importing the theme CSS which is obviously needed.
Cheers!
from react-notifications-component.
Closing this issue as it has been fixed.
from react-notifications-component.
Related Issues (20)
- How to give width to notification in percentage HOT 2
- Project breaking due to "Removed default export" HOT 1
- TypeError: Cannot read properties of undefined (reading 'addNotification') HOT 2
- Does not display any notifications
- Scrolling when screen is full of notifications HOT 2
- Please fix typo HOT 1
- Notifications are not auto dismissed when browser tab is inactive HOT 3
- Unable to resolve dependency tree error when installing npm packages HOT 4
- Fade In animation suddenly appears instead of playing the animation HOT 3
- uncompatibility with animate.css library HOT 6
- Notifications created in rapid succession may not be removed from the DOM when dismissed HOT 4
- Not all styles are renamed HOT 1
- npm ERR! Missing script: "build:library:dev" HOT 3
- compatibility issue
- The component's test for closing by timeout failed HOT 1
- Store.addNotification is getting called and failing in my tests HOT 4
- 'message' property renders only string, not component HOT 1
- Notification blinks when it appears HOT 2
- Add `top: 0` to rnc__base
- Desktop Notifications as an option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-notifications-component.