Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Replace Typography with BCTypography for Design Consistency - #1341 #1435

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/src/components/BCForm/BCFormCheckbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
Checkbox,
FormControl,
FormControlLabel,
FormLabel,
Typography
FormLabel
} from '@mui/material'
import BCTypography from '@/components/BCTypography'
import { Controller } from 'react-hook-form'
import { CustomLabel } from './CustomLabel'
import PropTypes from 'prop-types'
Expand All @@ -22,9 +22,9 @@ export const BCFormCheckbox = ({ name, form, label, options, disabled }) => {
return (
<FormControl size={'small'} variant={'outlined'}>
<FormLabel component="legend">
<Typography variant="label" component="span">
<BCTypography variant="label" component="span">
{label}
</Typography>
</BCTypography>
</FormLabel>

<div>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/BCForm/BCFormRadio.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
FormControlLabel,
FormLabel,
Radio,
RadioGroup,
Typography
RadioGroup
} from '@mui/material'
import BCTypography from '@/components/BCTypography'
import { Controller } from 'react-hook-form'
import PropTypes from 'prop-types'
import { CustomLabel } from './CustomLabel'
Expand Down Expand Up @@ -34,9 +34,9 @@ export const BCFormRadio = ({ name, control, label, options, disabled }) => {
return (
<FormControl component="fieldset">
<FormLabel component="legend" sx={{ marginBottom: 1 }}>
<Typography variant="label" component="span">
<BCTypography variant="label" component="span">
{label}
</Typography>
</BCTypography>
</FormLabel>
<Controller
name={name}
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/BCForm/BCFormText.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Controller } from 'react-hook-form'
import { TextField, InputLabel, Typography } from '@mui/material'
import { TextField, InputLabel } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import PropTypes from 'prop-types'

export const BCFormText = ({ name, control, label, optional }) => {
Expand All @@ -14,14 +15,14 @@ export const BCFormText = ({ name, control, label, optional }) => {
}) => (
<>
<InputLabel htmlFor={name} component="label" className="form-label">
<Typography variant="label" component="span">
<BCTypography variant="label" component="span">
{label}&nbsp;
{optional && (
<span className="optional" style={{ fontWeight: 'normal' }}>
(optional)
</span>
)}
</Typography>
</BCTypography>
</InputLabel>
<TextField
id={name}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/BCForm/CustomLabel.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Typography } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import PropType from 'prop-types'

export const CustomLabel = ({ header, text }) => (
<Typography variant="body4" component="span">
<BCTypography variant="body4" component="span">
<strong>{header}</strong> —&nbsp;{text}
</Typography>
</BCTypography>
)

CustomLabel.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BCTypography/BCTypographyRoot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Typography from '@mui/material/Typography'
import { styled } from '@mui/material/styles'

const BCTypographyRoot = styled(Typography)(({ theme, ownerState }) => {
const { palette, typography, functions } = theme
const { palette, typography, functions = {} } = theme
const {
color,
textTransform,
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/DisclaimerBanner.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types'
import { Box, Typography } from '@mui/material'
import { Box } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import colors from '@/themes/base/colors'

const DisclaimerBanner = ({ messages }) => {
Expand All @@ -16,9 +17,9 @@ const DisclaimerBanner = ({ messages }) => {
}}
>
{messages.map((message, index) => (
<Typography key={index} variant="body2" sx={{ fontSize: '14px' }}>
<BCTypography key={index} sx={{ fontSize: '14px' }}>
{message}
</Typography>
</BCTypography>
))}
</Box>
)
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Loading.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import CircularProgress from '@mui/material/CircularProgress'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import BCTypography from '@/components/BCTypography'
import colors from '@/themes/base/colors'
import borders from '@/themes/base/borders'

Expand Down Expand Up @@ -36,9 +36,9 @@ const Loading = ({ message = 'Loading...', fixed = false }) => {
}}
>
<CircularProgress aria-labelledby="loading" />
<Typography variant="subtitle1" sx={{ mt: 2 }} data-test="message">
<BCTypography variant="subtitle1" sx={{ mt: 2 }} data-test="message">
{message}
</Typography>
</BCTypography>
</Box>
</Box>
)
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/components/ProgressBreadcrumb.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Breadcrumbs, Typography, Box, useMediaQuery } from '@mui/material'
import { Breadcrumbs, Box, useMediaQuery } from '@mui/material'
import BCTypography from '@/components/BCTypography'

/**
* ProgressBreadcrumb Component
Expand Down Expand Up @@ -62,19 +63,19 @@ const ProgressBreadcrumb = ({ steps, currentStep }) => {
mb: 1
}}
>
<Typography
<BCTypography
variant="caption"
color={isCurrent || isPast ? 'primary.contrastText' : 'inherit'}
>
{index + 1}
</Typography>
</BCTypography>
</Box>
<Typography
<BCTypography
color={isCurrent || isPast ? 'primary.main' : 'inherit'}
variant="body3"
>
{step}
</Typography>
</BCTypography>
</Box>
)
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/Admin/AdminMenu/components/AuditLog.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef, useCallback } from 'react'
import BCBox from '@/components/BCBox'
import BCDataGridServer from '@/components/BCDataGrid/BCDataGridServer'
import { Typography } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import { useTranslation } from 'react-i18next'
import { auditLogColDefs, defaultAuditLogSortModel } from './_schema'
import { apiRoutes, ROUTES } from '@/constants/routes'
Expand Down Expand Up @@ -38,9 +38,9 @@ export const AuditLog = () => {

return (
<BCBox>
<Typography variant="h5" color="primary" mb={2}>
<BCTypography variant="h5" color="primary" mb={2}>
{t('admin:AuditLog')}
</Typography>
</BCTypography>

<BCDataGridServer
gridRef={gridRef}
Expand Down
26 changes: 13 additions & 13 deletions frontend/src/views/Admin/AdminMenu/components/ViewAuditLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
TableRow,
Paper,
Box,
Typography
} from '@mui/material'
import BCTypography from '@/components/BCTypography'
import { useTranslation } from 'react-i18next'
import colors from '@/themes/base/colors'

Expand Down Expand Up @@ -59,29 +59,29 @@ export const ViewAuditLog = () => {

return (
<Box>
<Typography variant="h5" color="primary" mb={2}>
<BCTypography variant="h5" color="primary" mb={2}>
{t('AuditLogDetails', { id })}
</Typography>
</BCTypography>

{/* Display the additional information */}
<Box mb={2}>
<Typography variant="body2">
<BCTypography variant="body2">
<strong>{t('auditLogColLabels.tableName')}:</strong> {tableName}
</Typography>
<Typography variant="body2">
</BCTypography>
<BCTypography variant="body2">
<strong>{t('auditLogColLabels.operation')}:</strong> {operation}
</Typography>
<Typography variant="body2">
</BCTypography>
<BCTypography variant="body2">
<strong>{t('auditLogColLabels.rowId')}:</strong> {rowId}
</Typography>
<Typography variant="body2">
</BCTypography>
<BCTypography variant="body2">
<strong>{t('auditLogColLabels.createDate')}:</strong>{' '}
{new Date(createDate).toLocaleString()}
</Typography>
<Typography variant="body2">
</BCTypography>
<BCTypography variant="body2">
<strong>{t('auditLogColLabels.userId')}:</strong>{' '}
{createUser || t('System')}
</Typography>
</BCTypography>
</Box>

<TableContainer component={Paper}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect, useMemo, useRef, useCallback } from 'react'
import { Typography } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import { useTranslation } from 'react-i18next'
import { useLocation, useNavigate, useParams } from 'react-router-dom'
Expand Down Expand Up @@ -253,17 +253,17 @@ export const AddEditAllocationAgreements = () => {
!allocationAgreementsLoading && (
<Grid2 className="add-edit-allocation-agreement-container" mx={-1}>
<div className="header">
<Typography variant="h5" color="primary">
<BCTypography variant="h5" color="primary">
{t('allocationAgreement:addAllocationAgreementRowsTitle')}
</Typography>
<Typography
</BCTypography>
<BCTypography
variant="body4"
color="primary"
sx={{ marginY: '2rem' }}
component="div"
>
{t('allocationAgreement:allocationAgreementSubtitle')}
</Typography>
</BCTypography>
</div>
<BCBox my={2} component="div" style={{ height: '100%', width: '100%' }}>
<BCGridEditor
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/AllocationAgreements/_schema.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { suppressKeyboardEvent } from '@/utils/grid/eventHandlers'
import { Typography } from '@mui/material'
import BCTypography from '@/components/BCTypography'
import {
AutocompleteCellEditor,
RequiredHeader,
Expand Down Expand Up @@ -63,7 +63,7 @@ export const allocationAgreementColDefs = (optionsData, errors) => [
},
cellRenderer: (params) =>
params.value ||
(!params.value && <Typography variant="body4">Select</Typography>),
(!params.value && <BCTypography variant="body4">Select</BCTypography>),
cellStyle: (params) => StandardCellErrors(params, errors),
suppressKeyboardEvent,
minWidth: 120,
Expand Down Expand Up @@ -95,7 +95,7 @@ export const allocationAgreementColDefs = (optionsData, errors) => [
cellRenderer: (params) =>
params.value ||
(!params.value && (
<Typography variant="body4">Enter or search a name</Typography>
<BCTypography variant="body4">Enter or search a name</BCTypography>
)),
cellStyle: (params) => StandardCellErrors(params, errors),
suppressKeyboardEvent,
Expand Down Expand Up @@ -177,7 +177,7 @@ export const allocationAgreementColDefs = (optionsData, errors) => [
},
cellRenderer: (params) =>
params.value ||
(!params.value && <Typography variant="body4">Select</Typography>),
(!params.value && <BCTypography variant="body4">Select</BCTypography>),
cellStyle: (params) => StandardCellErrors(params, errors),
suppressKeyboardEvent,
minWidth: 200,
Expand Down Expand Up @@ -276,7 +276,7 @@ export const allocationAgreementColDefs = (optionsData, errors) => [
},
cellRenderer: (params) =>
params.value ||
(!params.value && <Typography variant="body4">Select</Typography>),
(!params.value && <BCTypography variant="body4">Select</BCTypography>),
cellStyle: (params) => StandardCellErrors(params, errors),
suppressKeyboardEvent,
minWidth: 300,
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/views/ComplianceReports/ComplianceReports.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// mui components
import { Typography, Stack } from '@mui/material'
import { Stack } from '@mui/material'
import BCBox from '@/components/BCBox'
import BCAlert from '@/components/BCAlert'
import BCDataGridServer from '@/components/BCDataGrid/BCDataGridServer'
Expand All @@ -19,6 +19,7 @@ import { useCreateComplianceReport } from '@/hooks/useComplianceReports'
// internal components
import { reportsColDefs, defaultSortModel } from './components/_schema'
import { NewComplianceReportButton } from './components/NewComplianceReportButton'
import BCTypography from '@/components/BCTypography'

export const ComplianceReports = () => {
const { t } = useTranslation(['common', 'report'])
Expand All @@ -39,7 +40,10 @@ export const ComplianceReports = () => {
}),
[t]
)
const getRowId = useCallback((params) => params.data.complianceReportId.toString(), [])
const getRowId = useCallback(
(params) => params.data.complianceReportId.toString(),
[]
)
// eslint-disable-next-line react-hooks/exhaustive-deps
const handleRowClicked = useCallback(
({ data }) => {
Expand Down Expand Up @@ -114,9 +118,9 @@ export const ComplianceReports = () => {
</BCAlert>
)}
</div>
<Typography variant="h5" color="primary">
<BCTypography variant="h5" color="primary">
{t('report:title')}
</Typography>
</BCTypography>
<Stack
direction={{ md: 'coloumn', lg: 'row' }}
spacing={{ xs: 2, sm: 2, md: 3 }}
Expand Down
Loading
Loading