-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add loading toast when creating offers (#708)
- Loading branch information
1 parent
274a938
commit 8a52ff0
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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,44 @@ | ||
import { X } from "phosphor-react"; | ||
import { ReactNode } from "react"; | ||
import toast, { Toast } from "react-hot-toast"; | ||
import styled from "styled-components"; | ||
|
||
import { colors } from "../../../lib/styles/colors"; | ||
import Button from "../../ui/Button"; | ||
import Grid from "../../ui/Grid"; | ||
import Loading from "../../ui/Loading"; | ||
|
||
const Close = styled(X)` | ||
line { | ||
stroke: ${colors.darkGrey}; | ||
} | ||
`; | ||
const StyledButton = styled(Button)` | ||
padding: 0 !important; | ||
`; | ||
interface Props { | ||
t: Toast; | ||
children: ReactNode; | ||
} | ||
|
||
export function LoadingToast({ t, children }: Props) { | ||
return ( | ||
<Grid gap="1rem"> | ||
<Grid flexBasis="0"> | ||
<Loading size={3} wrapperStyle={{ padding: 0 }} /> | ||
</Grid> | ||
{children} | ||
<Grid alignSelf="flex-start" justifyContent="flex-end" flexBasis="0"> | ||
<StyledButton | ||
data-close | ||
theme="blank" | ||
onClick={() => toast.dismiss(t.id)} | ||
> | ||
<Close size={20} /> | ||
</StyledButton> | ||
</Grid> | ||
</Grid> | ||
); | ||
} | ||
|
||
export default LoadingToast; |
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