From 2aea7e31b6f3f2a54cdca785b58d0daffbce95ca Mon Sep 17 00:00:00 2001 From: IsaccoSordo Date: Tue, 7 Jan 2025 17:03:59 +0100 Subject: [PATCH] feat: bug-report form mui converstion --- .../components/status-icon.tsx | 62 ++++++ .../src/components/bug-report-form/index.tsx | 188 +++++++++++------- 2 files changed, 175 insertions(+), 75 deletions(-) create mode 100644 packages/beacon-ui/src/components/bug-report-form/components/status-icon.tsx diff --git a/packages/beacon-ui/src/components/bug-report-form/components/status-icon.tsx b/packages/beacon-ui/src/components/bug-report-form/components/status-icon.tsx new file mode 100644 index 000000000..c025dc909 --- /dev/null +++ b/packages/beacon-ui/src/components/bug-report-form/components/status-icon.tsx @@ -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 = ({ isLoading, status }) => { + if (isLoading || !status) return null; + + return ( + + {status === 'success' ? '✓' : '✕'} + + ); +}; + +export default StatusIcon; diff --git a/packages/beacon-ui/src/components/bug-report-form/index.tsx b/packages/beacon-ui/src/components/bug-report-form/index.tsx index bfc80a6b3..f8c248249 100644 --- a/packages/beacon-ui/src/components/bug-report-form/index.tsx +++ b/packages/beacon-ui/src/components/bug-report-form/index.tsx @@ -2,6 +2,15 @@ import React, { useState, useEffect } from 'react' import { IndexedDBStorage, Logger, SDK_VERSION } from '@airgap/beacon-core' import { StorageKey } from '@airgap/beacon-types' import { currentBrowser, currentOS } from '../../utils/platform' +import { + Box, + Button, + Checkbox, + FormControlLabel, + TextField, + Typography, +} from '@mui/material'; +import StatusIcon from './components/status-icon'; const logger = new Logger('BugReport') @@ -158,90 +167,119 @@ const BugReportForm: React.FC<{ onSubmit: () => void }> = (props) => { } return ( -
-
- - setTitle(e.currentTarget.value)} - onBlur={() => setTitleTouched(true)} - className={`input-style ${titleTouched && titleErrorMsg.length ? 'invalid' : ''}`} - /> - {titleTouched && titleErrorMsg.length > 0 && ( - - )} -
-
- -