-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removing paths * Moving pages * Using LoadingButton * Fixing /pages
- Loading branch information
1 parent
9be5159
commit 55f4036
Showing
33 changed files
with
175 additions
and
458 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
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
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,56 @@ | ||
import Box from '@mui/material/Box' | ||
import { ButtonProps } from '@mui/material/Button' | ||
import CircularProgress from '@mui/material/CircularProgress' | ||
import * as React from 'react' | ||
import { ReactNode } from 'react' | ||
import { StyledButton } from './styled' | ||
|
||
export interface LoadingButtonProps | ||
extends Pick< | ||
ButtonProps, | ||
'ref' | 'onClick' | 'variant' | 'size' | 'children' | 'sx' | 'disabled' | ||
> { | ||
isLoading?: boolean | ||
startIcon?: ReactNode | ||
endIcon?: ReactNode | ||
} | ||
|
||
export const LoadingButton: React.FC<LoadingButtonProps> = React.forwardRef< | ||
HTMLButtonElement, | ||
LoadingButtonProps | ||
>(function RefLoadingButton( | ||
{ isLoading, children, startIcon, endIcon, disabled, ...props }, | ||
ref | ||
) { | ||
return ( | ||
<StyledButton | ||
ref={ref} | ||
{...props} | ||
isLoading={!isLoading} | ||
disabled={isLoading || disabled} | ||
sx={{ position: 'relative' }} | ||
startIcon={startIcon} | ||
endIcon={endIcon} | ||
> | ||
<Box | ||
sx={{ | ||
visibility: isLoading ? 'hidden' : 'visible' | ||
}} | ||
> | ||
{children} | ||
</Box> | ||
{isLoading && ( | ||
<CircularProgress | ||
size={24} | ||
sx={{ | ||
position: 'absolute', | ||
top: '50%', | ||
left: '50%', | ||
marginTop: '-12px', // half of size | ||
marginLeft: '-12px' // half of size | ||
}} | ||
/> | ||
)} | ||
</StyledButton> | ||
) | ||
}) |
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,49 @@ | ||
import React from 'react' | ||
import { styled } from '@mui/material/styles' | ||
import { Button, ButtonProps } from '@mui/material' | ||
|
||
interface StyledButtonProps extends ButtonProps { | ||
isLoading?: boolean | ||
} | ||
|
||
export const StyledButtonWrapper = React.forwardRef< | ||
HTMLButtonElement, | ||
StyledButtonProps | ||
>(function RefStyledButton({ isLoading, ...rest }, ref) { | ||
return <Button ref={ref} {...rest} /> | ||
}) | ||
|
||
export const StyledButton = styled(StyledButtonWrapper, { | ||
shouldForwardProp: prop => prop !== 'isLoading' | ||
})<StyledButtonProps>(({ theme, isLoading }) => ({ | ||
textTransform: 'uppercase', | ||
color: theme.palette.primary.main, | ||
fontSize: '1.4rem', | ||
borderRadius: '5rem', | ||
padding: '8px 16px', | ||
minWidth: '11rem', | ||
border: '1px solid', | ||
backgroundColor: '#e6007b2f', | ||
|
||
'&:hover': { | ||
backgroundColor: '#e6007b83', | ||
color: 'white', | ||
border: '1px solid #c00569 ' | ||
}, | ||
|
||
...(!isLoading && { | ||
'&:disabled': { | ||
color: theme.palette.grey[600] | ||
} | ||
}), | ||
|
||
'&.MuiButton-outlined': { | ||
color: 'white', | ||
borderColor: theme.palette.primary.main, | ||
backgroundColor: 'transparent', | ||
'&:hover': { | ||
backgroundColor: theme.palette.primary.main, | ||
border: '1px solid' | ||
} | ||
} | ||
})) |
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
Oops, something went wrong.