-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new circular progress component and add to transaction
- Loading branch information
1 parent
5fce108
commit 6798443
Showing
18 changed files
with
151 additions
and
63 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/extension/components/CircularProgressWithIcon/CircularProgressWithIcon.tsx
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,57 @@ | ||
import { | ||
CircularProgress, | ||
CircularProgressLabel, | ||
Icon, | ||
} from '@chakra-ui/react'; | ||
import React, { FC } from 'react'; | ||
|
||
// hooks | ||
import usePrimaryColor from '@extension/hooks/usePrimaryColor'; | ||
import useSubTextColor from '@extension/hooks/useSubTextColor'; | ||
|
||
// types | ||
import type { IProps } from './types'; | ||
|
||
// utils | ||
import calculateIconSize from '@extension/utils/calculateIconSize'; | ||
|
||
const CircularProgressWithIcon: FC<IProps> = ({ | ||
icon, | ||
iconColor, | ||
progress, | ||
progressColor, | ||
}) => { | ||
// hooks | ||
const primaryColor = usePrimaryColor(); | ||
const subTextColor = useSubTextColor(); | ||
// misc | ||
const iconSize = calculateIconSize('lg'); | ||
|
||
return ( | ||
<CircularProgress | ||
color={progressColor || primaryColor} | ||
isIndeterminate={!progress} | ||
size="100px" | ||
thickness="4px" | ||
trackColor={subTextColor} | ||
{...(progress && { | ||
value: progress[1] > 0 ? (progress[0] / progress[1]) * 100 : 0, | ||
})} | ||
> | ||
<CircularProgressLabel | ||
alignItems="center" | ||
display="flex" | ||
justifyContent="center" | ||
> | ||
<Icon | ||
as={icon} | ||
color={iconColor || subTextColor} | ||
h={iconSize} | ||
w={iconSize} | ||
/> | ||
</CircularProgressLabel> | ||
</CircularProgress> | ||
); | ||
}; | ||
|
||
export default CircularProgressWithIcon; |
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,2 @@ | ||
export { default } from './CircularProgressWithIcon'; | ||
export * from './types'; |
17 changes: 17 additions & 0 deletions
17
src/extension/components/CircularProgressWithIcon/types/IProps.ts
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,17 @@ | ||
import { IconType } from 'react-icons'; | ||
|
||
/** | ||
* @property {IconType} icon - the icon to use in the centre. | ||
* @property {string} iconColor - [optional] the color of the icon. Defaults to the default text color. | ||
* @property {[number, number]} progress - [optional] a tuple where the first value is the count and the second value | ||
* is the total. If this value is omitted, the progress will be indeterminate. | ||
* @property {string} progressColor - [optional] the color of the progress bar. Defaults to the primary color. | ||
*/ | ||
interface IProps { | ||
icon: IconType; | ||
iconColor?: string; | ||
progress?: [number, number]; | ||
progressColor?: string; | ||
} | ||
|
||
export default IProps; |
2 changes: 2 additions & 0 deletions
2
src/extension/components/CircularProgressWithIcon/types/index.ts
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,2 @@ | ||
export type { default as IEncryptionState } from './IEncryptionState'; | ||
export type { default as IProps } from './IProps'; |
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
35 changes: 21 additions & 14 deletions
35
src/extension/modals/SendAssetModal/SendAssetModalConfirmingContent.tsx
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
5 changes: 5 additions & 0 deletions
5
src/extension/modals/SendAssetModal/types/ISendAssetModalConfirmingContentProps.ts
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,5 @@ | ||
interface ISendAssetModalConfirmingContentProps { | ||
numberOfTransactions?: number; | ||
} | ||
|
||
export default ISendAssetModalConfirmingContentProps; |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export type { default as SendAssetModalSummaryContentProps } from './SendAssetModalSummaryContentProps'; | ||
export type { default as ISendAssetModalConfirmingContentProps } from './ISendAssetModalConfirmingContentProps'; | ||
export type { default as ISendAssetModalSummaryContentProps } from './ISendAssetModalSummaryContentProps'; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
type TSizes = 'lg' | 'md' | 'sm' | 'xs'; | ||
type TSizes = 'lg' | 'md' | 'sm' | 'xl' | 'xs'; | ||
|
||
export default TSizes; |
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