Skip to content
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

[DTRA-1047] henry/dtra-1047/feat: snackbar UI #56

Merged
merged 18 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
42 changes: 42 additions & 0 deletions lib/components/Snackbar/SnackbarWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { StandalonePlaceholderRegularIcon } from "@deriv/quill-icons/Standalone";
import { Snackbar } from ".";
import React, { useState } from "react";

export const SnackbarWrapper = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's weird but i couldn't find the place where this component is used..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just a wrapper to pass functions into the component to work for now. For the next task it'll be used.

const [isOpen, setIsOpen] = useState(false);

const handleActionClick = () => {
handleClose();
kate-deriv marked this conversation as resolved.
Show resolved Hide resolved
};

const handleOpen = () => {
setIsOpen(true);
};

const handleClose = () => {
setTimeout(() => {
henry-deriv marked this conversation as resolved.
Show resolved Hide resolved
setIsOpen(false);
}, 1000);
};

return (
<div>
<button onClick={handleOpen} style={{ color: "white" }}>
henry-deriv marked this conversation as resolved.
Show resolved Hide resolved
Click me
</button>
<Snackbar
icon={
<StandalonePlaceholderRegularIcon
fill="#ffffff"
iconSize="sm"
/>
}
message="Enter message here"
actionText="Action"
onActionClick={handleActionClick}
isOpen={isOpen}
onClose={handleClose}
/>
</div>
);
};
Loading