-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bug-report form mui converstion
- Loading branch information
1 parent
0cfc29f
commit 2aea7e3
Showing
2 changed files
with
175 additions
and
75 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
packages/beacon-ui/src/components/bug-report-form/components/status-icon.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,62 @@ | ||
import React from 'react'; | ||
import { Typography } from '@mui/material'; | ||
|
||
type StatusType = 'success' | 'error' | null; | ||
|
||
interface StatusIconProps { | ||
isLoading: boolean; | ||
status: StatusType; | ||
} | ||
|
||
const StatusIcon: React.FC<StatusIconProps> = ({ isLoading, status }) => { | ||
if (isLoading || !status) return null; | ||
|
||
return ( | ||
<Typography | ||
component="span" | ||
sx={{ | ||
// Base icon styles: make the container a perfect circle | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: '1.5rem', | ||
height: '1.5rem', | ||
border: '2px solid white', | ||
borderRadius: '50%', | ||
fontWeight: 'bold', | ||
fontSize: '0.9rem', // Adjust font size so checkmark fits nicely | ||
marginBottom: '3px', | ||
opacity: 0, | ||
transition: 'opacity 0.3s ease', | ||
|
||
// SUCCESS icon styles & spinning animation | ||
...(status === 'success' && { | ||
animation: 'successAnimation 0.6s ease forwards', | ||
'@keyframes successAnimation': { | ||
'0%': { | ||
opacity: 0, | ||
transform: 'rotate(0deg)', | ||
}, | ||
'100%': { | ||
opacity: 1, | ||
transform: 'rotate(360deg)', | ||
}, | ||
}, | ||
}), | ||
|
||
// ERROR icon styles & simple fade-in | ||
...(status === 'error' && { | ||
animation: 'fadeIn 0.3s ease forwards', | ||
'@keyframes fadeIn': { | ||
'0%': { opacity: 0 }, | ||
'100%': { opacity: 1 }, | ||
}, | ||
}), | ||
}} | ||
> | ||
{status === 'success' ? '✓' : '✕'} | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default StatusIcon; |
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