mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 16:25:13 +08:00
SnackBar
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
import React from 'react';
|
||||
import {SnackBar} from 'coral-ui';
|
||||
|
||||
const Notification = (props) => {
|
||||
if (props.notification.text) {
|
||||
setTimeout(() => {
|
||||
props.clearNotification();
|
||||
}, props.notifLength);
|
||||
// setTimeout(() => {
|
||||
// props.clearNotification();
|
||||
// }, props.notifLength);
|
||||
}
|
||||
return <div>
|
||||
{
|
||||
props.notification.text &&
|
||||
<dialog open id='coral-notif' className={`coral-notif-${ props.notification.type}`}>
|
||||
<SnackBar id='coral-notif' className={`coral-notif-${props.notification.type}`}>
|
||||
{props.notification.text}
|
||||
</dialog>
|
||||
</SnackBar>
|
||||
}
|
||||
</div>;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
.SnackBar {
|
||||
top: 0;
|
||||
background: red;
|
||||
position: fixed;
|
||||
cursor: default;
|
||||
background-color: #323232;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
will-change: transform;
|
||||
transition: transform .25s cubic-bezier(.4,0,1,1);
|
||||
pointer-events: none;
|
||||
transform: translate(-50%,80px);
|
||||
padding: 18px 14px;
|
||||
vertical-align: middle;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
left: 50%;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react';
|
||||
import styles from './SnackBar.css'
|
||||
|
||||
const SnackBar = ({children}) => (
|
||||
<div className={styles.SnackBar}>{children}</div>
|
||||
);
|
||||
|
||||
export default SnackBar;
|
||||
@@ -14,3 +14,4 @@ export {default as List} from './components/List';
|
||||
export {default as Item} from './components/Item';
|
||||
export {default as Card} from './components/Card';
|
||||
export {default as Pager} from './components/Pager';
|
||||
export {default as SnackBar} from './components/SnackBar';
|
||||
|
||||
Reference in New Issue
Block a user