-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add react-toastify * feat: add zIndex type to theme * feat: Toast container * feat: show toast and reset slide * fix: make handleVote return Promise<boolean>
- Loading branch information
Showing
9 changed files
with
130 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { ReactNode } from 'react'; | ||
import { ToastContainer, ToastOptions, toast } from 'react-toastify'; | ||
import styled, { keyframes } from 'styled-components'; | ||
|
||
import 'react-toastify/dist/ReactToastify.css'; | ||
|
||
const toastifyTrackProgress = keyframes` | ||
0% { | ||
transform: scaleX(1); | ||
} | ||
100% { | ||
transform: scaleX(0); | ||
} | ||
`; | ||
|
||
export const StyledToastConatiner = styled(ToastContainer)` | ||
/* stylelint-disable-next-line selector-class-pattern */ | ||
.Toastify__toast { | ||
padding: 50px 0 8px; | ||
color: ${({ theme }) => theme.colors.white}; | ||
text-align: center; | ||
background-color: ${({ theme }) => theme.colors.purple}; | ||
/* stylelint-disable-next-line selector-class-pattern */ | ||
.Toastify__toast-body { | ||
padding: 0; | ||
} | ||
} | ||
/* .Toastify__toast--info { | ||
} */ | ||
/* .Toastify__toast--success { | ||
} */ | ||
/* .Toastify__toast--error { | ||
} */ | ||
/* stylelint-disable-next-line selector-class-pattern */ | ||
.Toastify__progress-bar { | ||
animation: ${toastifyTrackProgress} linear 1; | ||
} | ||
`; | ||
|
||
const defaultToastOption: ToastOptions = { | ||
position: 'top-center', | ||
autoClose: 3000, | ||
hideProgressBar: true, | ||
closeOnClick: true, | ||
draggable: true, | ||
pauseOnHover: false, | ||
closeButton: false, | ||
}; | ||
|
||
export const Toast = { | ||
info: (message: ReactNode, options: ToastOptions = {}) => { | ||
toast.info(message, { | ||
icon: false, | ||
...defaultToastOption, | ||
...options, | ||
}); | ||
}, | ||
success: (message: ReactNode, options: ToastOptions = {}) => { | ||
toast.success(message, { | ||
...defaultToastOption, | ||
// icon: <Icon name="check-circle" stroke={white} />, | ||
...options, | ||
}); | ||
}, | ||
error: (message: ReactNode, options: ToastOptions = {}) => { | ||
toast.error(message, { | ||
...defaultToastOption, | ||
icon: false, | ||
...options, | ||
}); | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import 'styled-components'; | ||
import { ColorsTypes } from '@styles/theme'; | ||
import { ColorsTypes, ZIndexTypes } from '@styles/theme'; | ||
|
||
declare module 'styled-components' { | ||
export interface DefaultTheme { | ||
colors: ColorsTypes; | ||
zIndex: ZIndexTypes; | ||
} | ||
} |
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