mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-20 18:09:51 +00:00
* fix: share modal not opening * fix: add more spacing above snackbar link * fix: properly close thumbnail error modal * fix: better align media property icons * fix: tx filter alignment and prevent hiding filter if no current tx's * fix: publish markdown on dark mode * fix: add max-width on container for large screens * fix: channel pagination aligmnent and spacing * fix: modal spacing and flow errors * fix: home page scrolling (now with mouse scrolling) * fix: hover color in dark mode for outline buttons * fix: improve file page spacing/layout * cleanup * fix: wrap file actions on smaller screens * fix: comment button spacing
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
// @flow
|
|
import React from 'react';
|
|
import Button from 'component/button';
|
|
import classnames from 'classnames';
|
|
|
|
type Props = {
|
|
removeSnack: any => void,
|
|
snack: ?{
|
|
linkTarget: ?string,
|
|
linkText: ?string,
|
|
message: string,
|
|
isError: boolean,
|
|
},
|
|
};
|
|
|
|
class SnackBar extends React.PureComponent<Props> {
|
|
constructor(props: Props) {
|
|
super(props);
|
|
|
|
this.displayTime = 5; // in seconds
|
|
this.hideTimeout = null;
|
|
}
|
|
|
|
hideTimeout: ?TimeoutID;
|
|
displayTime: number;
|
|
|
|
render() {
|
|
const { snack, removeSnack } = this.props;
|
|
|
|
if (!snack) {
|
|
this.hideTimeout = null; // should be unmounting anyway, but be safe?
|
|
return null;
|
|
}
|
|
|
|
const { message, linkText, linkTarget, isError } = snack;
|
|
|
|
if (this.hideTimeout === null) {
|
|
this.hideTimeout = setTimeout(() => {
|
|
this.hideTimeout = null;
|
|
removeSnack();
|
|
}, this.displayTime * 1000);
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={classnames('snack-bar', {
|
|
'snack-bar--error': isError,
|
|
})}
|
|
>
|
|
<div className="snack-bar__message">
|
|
<div>ⓘ</div>
|
|
<div>{message}</div>
|
|
</div>
|
|
{linkText &&
|
|
linkTarget && (
|
|
<Button navigate={linkTarget} className="snack-bar__action" label={linkText} />
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SnackBar;
|