Skip to content

Added fontawesome notification style #123

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions dist/styles/fa-theme/notify-fa-theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.notifyjs-fa-theme-base {
position: relative;
min-height: 52px;
color:#444;
box-shadow: 0 2px 28px 0 rgba(58,59,69,0.15);
-webkit-box-shadow: 0 2px 28px 0 rgba(58,59,69,0.15);
-moz-box-shadow: 0 2px 28px 0 rgba(58,59,69,0.15);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;

}

.notifyjs-fa-theme-base .image {
display: table;
position: absolute;
height: auto;
width: auto;
left: 25px;
top: 50%;

-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

.notifyjs-fa-theme-base .image img{
width: 50px;
height: 50px;
}

.notifyjs-fa-theme-base .text-wrapper {
display: inline-block;
vertical-align: top;
text-align: left;
margin: 10px 10px 10px 52px;
clear: both;
font-family: -apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
}

.notifyjs-fa-theme-base .title {
font-size: 16px;
font-weight: bold;
}

.notifyjs-fa-theme-base .text {
font-size: 13px;
padding-right: 10px;
font-weight: normal;
vertical-align: middle;
}
34 changes: 34 additions & 0 deletions dist/styles/fa-theme/notify-fa-theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$.notify.addStyle("fa-theme", {
html:
"<div>" +
"<div class='image' data-notify-html='image'/>" +
"<div class='text-wrapper'>" +
"<div class='title' data-notify-html='title'/>" +
"<div class='text' data-notify-html='text'/>" +
"</div>" +
"</div>",
classes: {
error: {
"color": "#fff !important",
"background-color": "#ff5959",
},
success: {
"color": "#fff !important",
"background-color": "#239d60",
},
info: {
"color": "#fff !important",
"background-color": "#2aa9d2",
},
warning: {
"background-color": "#facf5a",
},
black: {
"color": "#fff !important",
"background-color": "#333",
},
white: {
"background-color": "#fff",
}
}
});
44 changes: 44 additions & 0 deletions examples/fa-theme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<html>
<body>
<head>
<link href="../dist/styles/fa-theme/notify-fa-theme.css" rel="stylesheet" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<script src="../dist/notify.js"></script>
<script src="../dist/styles/fa-theme/notify-fa-theme.js"></script>
</head>

<h2>Index</h2>
<p>
This page use <a href="https://fontawesome.com/" target="_blank">fontawesome.com</a> for notifications icon.<br/><br/>
Use the icon class name in the second parameter to add a new notification with an icon :<br/>
<pre>
notify('success','far fa-check-circle');
</pre>

</p>
<button onclick="notify('white','fas fa-info')">White</button>
<button onclick="notify('black','fas fa-trash-alt')">Black</button>
<button onclick="notify('error','fas fa-ban')">Err</button>
<button onclick="notify('success','far fa-check-circle')">Success</button>
<button onclick="notify('warning','fas fa-radiation')">Warning</button>
<button onclick="notify('info','fas fa-map-marker-alt')">Info</button>

<script type="text/javascript">
function notify($style, $faIcon) {
$.notify({
title: 'Notification',
text: 'This is an incredible notification !',
image: "<i class='"+ $faIcon +" fa-lg'></i>"
}, {
style: 'fa-theme',
className: $style,
autoHide: false,
clickToHide: true
});
}
</script>
</body>
</html>