forked from samuellawerentz/style-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cnto 8202 notification #77
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6fbb364
cnto-8202 notification added
mimanshi-plivo 671027c
css fixes
mimanshi-plivo 06074ef
fixed css
mimanshi-plivo e7676c0
reverted npmrc token
mimanshi-plivo 54a81fe
updated to version 0.5.91
mimanshi-plivo d675282
xss fixes
mimanshi-plivo d0eb00c
css fixes for notification
mimanshi-plivo 5a8ea6a
reverted svg icon changes for succes notification
mimanshi-plivo 9cec355
reverted access token
mimanshi-plivo 2b974c4
revert delay to 5 sec
mimanshi-plivo dc1de6d
revert delay to 5 sec
mimanshi-plivo e35dda5
updated with main
mimanshi-plivo 9016d19
reverted svg changes from icon
mimanshi-plivo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { useEffect } from 'react' | ||
import { Icon } from '../Icon/index' | ||
import { Text } from '../Typography/index' | ||
import { notification } from 'antd' | ||
import './notification.scss' | ||
|
||
const iconMap = { | ||
info: 'info', | ||
warning: 'error', | ||
error: 'report', | ||
success: 'check_circle', | ||
} | ||
export const showNotification = (type, message) => { | ||
notification[type]({ | ||
message: <Text type="title-3">{message}</Text>, | ||
className: `notification-${type}`, | ||
icon: <Icon name={iconMap[type]} size={24} />, | ||
closeIcon: ( | ||
<Icon name="close" size={24} color="primary-text-color" hoverColor="primary-text-color" /> | ||
), | ||
duration: 5, | ||
}) | ||
} | ||
|
||
export const Notification = ({ type, message }) => { | ||
useEffect(() => { | ||
showNotification(type, message) | ||
}, [type]) | ||
return <>This is notification of type {type}</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { Notification, showNotification } from './' | ||
|
||
export default { | ||
title: 'Components/Notification', | ||
component: showNotification, | ||
} | ||
|
||
const Template = (args) => <Notification {...args} /> | ||
|
||
export const Info = Template.bind({}) | ||
Info.args = { | ||
message: 'This is info notification', | ||
type: 'info', | ||
} | ||
|
||
export const Success = Template.bind({}) | ||
Success.args = { | ||
message: 'This is success notification', | ||
type: 'success', | ||
} | ||
|
||
export const Error = Template.bind({}) | ||
Error.args = { | ||
message: 'This is error notification', | ||
type: 'error', | ||
} | ||
|
||
export const Warning = Template.bind({}) | ||
Warning.args = { | ||
message: 'This is warning notification', | ||
type: 'warning', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
.notification { | ||
&-success { | ||
color: var(--success-color); | ||
border-left: 4px solid var(--toast-success-color); | ||
} | ||
|
||
&-device-change { | ||
background: rgba(6, 14, 43, 0.9) !important; | ||
width: 100% !important; | ||
min-height: 36px; | ||
padding: 8px !important; | ||
.ant-notification-notice-message { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
margin: 0px; | ||
} | ||
} | ||
|
||
&-error { | ||
color: var(--danger-color); | ||
border-left: 4px solid var(--danger-color); | ||
} | ||
|
||
&-warning { | ||
color: var(--warning-color); | ||
border-left: 4px solid var(--warning-color); | ||
} | ||
|
||
&-info { | ||
color: var(--primary-color); | ||
border-left: 4px solid var(--primary-color); | ||
} | ||
|
||
} | ||
|
||
.ant-notification { | ||
&-notice-content { | ||
display: flex; | ||
margin-right: 40px; | ||
} | ||
&-notice-description { | ||
margin: 0; | ||
} | ||
|
||
&-notice-message { | ||
display: flex; | ||
margin: 0 !important; | ||
margin-left: 32px !important; | ||
padding-right: 0 !important; | ||
&-single-line-auto-margin { | ||
display: none; | ||
} | ||
} | ||
&-notice-with-icon { | ||
display: initial !important; | ||
} | ||
&-notice-close-icon, | ||
&-close-icon { | ||
svg { | ||
height: 1.5rem !important; | ||
width: 1.5rem !important; | ||
fill: var(--primary-text-color) !important; | ||
} | ||
} | ||
&-notice-close { | ||
right: 16px; | ||
} | ||
&-notice-icon { | ||
margin: 0; | ||
} | ||
&-notice { | ||
padding: 16px; | ||
width: 337px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add our custom css name later if some dependency comes with notification css may break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a custom class and handled CSS inside it but few elements of notification is mounted on top of document so had to handle it separately.