-
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.
Merge pull request #106 from PotLock/staging
Staging => main
- Loading branch information
Showing
38 changed files
with
983 additions
and
243 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
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,9 @@ | ||
const SuccessfulIcon = (props: React.SVGProps<SVGSVGElement>) => ( | ||
<svg {...props} viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M9 1.5C4.86 1.5 1.5 4.86 1.5 9C1.5 13.14 4.86 16.5 9 16.5C13.14 16.5 16.5 13.14 16.5 9C16.5 4.86 13.14 1.5 9 1.5ZM9 15C5.6925 15 3 12.3075 3 9C3 5.6925 5.6925 3 9 3C12.3075 3 15 5.6925 15 9C15 12.3075 12.3075 15 9 15ZM12.4425 5.685L7.5 10.6275L5.5575 8.6925L4.5 9.75L7.5 12.75L13.5 6.75L12.4425 5.685Z" | ||
fill="#079A90" | ||
/> | ||
</svg> | ||
); | ||
export default SuccessfulIcon; |
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,23 @@ | ||
import { useEffect } from "alem"; | ||
import SuccessfulIcon from "@app/assets/svgs/SuccessfulIcon"; | ||
import ToastProvider, { ToastProps } from "@app/contexts/ToastProvider"; | ||
import { useToastNotification } from "@app/hooks/useToast"; | ||
import { Container, Description, Header } from "./styles"; | ||
|
||
const ToastContainer = ({ toastContent }: { toastContent: ToastProps }) => { | ||
// ToastProvider(); | ||
|
||
// const { toastContent } = useToastNotification(); | ||
|
||
return ( | ||
<Container className={toastContent.title ? "active" : ""}> | ||
<Header> | ||
<SuccessfulIcon /> | ||
{toastContent.title} | ||
</Header> | ||
<Description>{toastContent.description}</Description> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ToastContainer; |
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,42 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Container = styled.div` | ||
position: fixed; | ||
right: -310px; | ||
top: 10%; | ||
opacity: 0; | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 300px; | ||
padding: 1rem; | ||
background: #fff; | ||
box-shadow: 0px 0px 0px 1px rgba(5, 5, 5, 0.08), 0px 8px 8px -4px rgba(15, 15, 15, 0.15), | ||
0px 4px 15px -2px rgba(5, 5, 5, 0.08); | ||
border-radius: 6px; | ||
gap: 6px; | ||
font-size: 14px; | ||
transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1); | ||
&.active { | ||
right: 10px; | ||
opacity: 1; | ||
} | ||
`; | ||
|
||
export const Header = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.5rem; | ||
div { | ||
line-height: 142%; | ||
font-weight: 600; | ||
} | ||
svg { | ||
width: 18px; | ||
height: 18px; | ||
} | ||
`; | ||
|
||
export const Description = styled.div` | ||
padding-left: 1.5rem; | ||
color: #656565; | ||
`; |
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,41 @@ | ||
import { createContext } from "alem"; | ||
|
||
export interface ToastProps { | ||
title: string; | ||
description: string; | ||
type?: "success" | "error" | "warning"; | ||
} | ||
|
||
export interface ToastContextProps { | ||
toast: (newValue: ToastProps) => void; | ||
toastContent: ToastProps; | ||
} | ||
|
||
const ToastProvider = () => { | ||
// Create a provider using a reference key | ||
const { setDefaultData, updateData, getSelf } = createContext<ToastContextProps>("toast-notification"); | ||
|
||
const EMPTY_TOAST = { | ||
title: "", | ||
description: "", | ||
}; | ||
|
||
setDefaultData({ | ||
toastContent: EMPTY_TOAST, | ||
toast: (toastContent: ToastProps) => { | ||
updateData({ | ||
toastContent, | ||
}); | ||
setTimeout(() => { | ||
updateData({ | ||
toastContent: EMPTY_TOAST, | ||
}); | ||
// Wait 7sec before clearing the notification | ||
}, 7000); | ||
}, | ||
}); | ||
|
||
return getSelf(); | ||
}; | ||
|
||
export default ToastProvider; |
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,4 @@ | ||
import { useContext } from "alem"; | ||
import { ToastContextProps } from "@app/contexts/ToastProvider"; | ||
|
||
export const useToastNotification = () => useContext<ToastContextProps>("toast-notification"); |
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
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
Oops, something went wrong.