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 styles #2001

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/components/admin/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function AdminPage() {
},
border: '1px solid ' + `${colors[index % colors.length]}7A`,
}}>
<div onClick={() => router.push(href)} style={{ cursor: 'pointer' }}>
<Box onClick={() => router.push(href)} sx={{ cursor: 'pointer' }}>
<CardContent>
<Box textAlign="center">
<Icon fontSize="large" />
Expand All @@ -87,7 +87,7 @@ export default function AdminPage() {
{label}
</Typography>
</CardContent>
</div>
</Box>
</Card>
</Grid>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/DetailsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default observer(function DetailsDialog({ modalStore, data }: Prop) {

return (
<Dialog open={isDetailsOpen} onClose={hideDetails} sx={containerStyles}>
<Card style={{ paddingTop: '35px' }}>
<Card sx={{ pt: '35px' }}>
<CloseModalButton onClose={hideDetails} />
<CardContent>
{data.map((field) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/InfoRequestGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function InfoRequestGrid() {

return (
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
height: 'calc(100vh - 300px)',
border: 'none',
Expand Down
3 changes: 2 additions & 1 deletion src/components/admin/affiliates/AffiliatesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ export default function AffiliatesPage() {
},
},
]

return (
<AdminLayout>
<AdminContainer title={t('profile:affiliate.index')}>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
8 changes: 2 additions & 6 deletions src/components/admin/bank-transactions/grid/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ export default function DropdownFilter(props: DropdownFilterProps) {
}

return (
<FormControl style={selectElementStyle}>
<FormControl sx={selectElementStyle}>
<InputLabel size="small">{t(label)}</InputLabel>
<Select
startAdornment={
value ? (
<Close
fontSize="small"
style={closeIconStyle}
onClick={(e) => handleClear(e, name, '')}
/>
<Close fontSize="small" sx={closeIconStyle} onClick={(e) => handleClear(e, name, '')} />
) : null
}
name={name}
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/bank-transactions/grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default observer(function Grid() {
<>
<Box sx={{ mx: 'auto', width: 700 }}>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Edit } from '@mui/icons-material'
import { Dialog, Box, Tooltip, Grid, DialogContent, DialogTitle } from '@mui/material'
import { Dialog, Box, Tooltip, Grid } from '@mui/material'
import { GridRenderCellParams, useGridApiContext } from '@mui/x-data-grid'
import { paymentRef } from 'common/form/validation'
import FormTextField from 'components/common/form/FormTextField'
Expand All @@ -17,6 +17,7 @@ import { useMutation } from '@tanstack/react-query'
import { useEditTransactionPaymentRef } from 'service/bankTransaction'
import { AlertStore } from 'stores/AlertStore'
import { ApiError } from 'next/dist/server/api-utils'
import { StyledDialogContent, StyledDialogTitle } from 'components/admin/styles/Admin.styled'

interface RenderCellProps {
params: GridRenderCellParams
Expand Down Expand Up @@ -97,26 +98,18 @@ export default function RenderBankDonationStatusCell({ params }: RenderCellProps

return (
<Dialog open onClose={handleClose} sx={{ scroll: 'none' }} fullWidth={true} maxWidth={'sm'}>
<DialogContent
style={{
overflow: 'hidden',
padding: '4rem',
paddingTop: '1rem',
width: '100%',
}}>
<Grid style={{ display: 'flex', justifyContent: 'end', marginRight: '-4rem' }}>
<StyledDialogContent>
<Grid sx={{ display: 'flex', justifyContent: 'end', mr: '-4rem' }}>
<CloseModalButton href={''} onClose={handleClose} />
</Grid>
<DialogTitle style={{ display: 'flex', justifyContent: 'center', width: '100%' }}>
{t('bank-transactions:cta.apply-ref-heading')}
</DialogTitle>
<StyledDialogTitle>{t('bank-transactions:cta.apply-ref-heading')}</StyledDialogTitle>
<Grid container direction="column" component="section">
<GenericForm
onSubmit={onSubmit}
initialValues={{ paymentRef: '' }}
validationSchema={validationSchema}>
<Grid container spacing={3}>
<Grid item xs={12} sx={{ marginBottom: '1rem' }}>
<Grid item xs={12} sx={{ mb: '1rem' }}>
<FormTextField
type="text"
label="bank-transactions:payment-ref"
Expand All @@ -133,7 +126,7 @@ export default function RenderBankDonationStatusCell({ params }: RenderCellProps
</Grid>
</GenericForm>
</Grid>
</DialogContent>
</StyledDialogContent>
</Dialog>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dialog, Grid, DialogContent, DialogTitle } from '@mui/material'
import { Dialog, Grid } from '@mui/material'
import GenericForm from 'components/common/form/GenericForm'
import SubmitButton from 'components/common/form/SubmitButton'
import { useState } from 'react'
Expand All @@ -10,6 +10,7 @@ import { useRerunBankImportForDate } from 'service/bankTransaction'
import FormDatePicker from 'components/common/form/FormDatePicker'
import { useMutation } from '@tanstack/react-query'
import { AlertStore } from 'stores/AlertStore'
import { StyledDialogContent, StyledDialogTitle } from 'components/admin/styles/Admin.styled'

const validationSchema: yup.SchemaOf<RerunTransactionsDatesInput> = yup
.object()
Expand Down Expand Up @@ -54,19 +55,11 @@ export default function RerunTransactionSyncModal({
sx={{ scroll: 'none' }}
fullWidth={true}
maxWidth={'sm'}>
<DialogContent
style={{
overflow: 'hidden',
padding: '4rem',
paddingTop: '1rem',
width: '100%',
}}>
<Grid style={{ display: 'flex', justifyContent: 'end', marginRight: '-4rem' }}>
<StyledDialogContent>
<Grid sx={{ display: 'flex', justifyContent: 'end', mr: '-4rem' }}>
<CloseModalButton href={''} onClose={handleClose} />
</Grid>
<DialogTitle style={{ display: 'flex', justifyContent: 'center', width: '100%' }}>
{t('bank-transactions:rerun-dates')}
</DialogTitle>
<StyledDialogTitle> {t('bank-transactions:rerun-dates')}</StyledDialogTitle>
<Grid container direction="column" component="section">
<GenericForm
onSubmit={onSubmit}
Expand All @@ -89,7 +82,7 @@ export default function RerunTransactionSyncModal({
</Grid>
</GenericForm>
</Grid>
</DialogContent>
</StyledDialogContent>
</Dialog>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default observer(function BankAccountsGrid() {
return (
<>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'
import { Box } from '@mui/material'

const renderCell = (cellValues: GridRenderCellParams): React.ReactNode => {
const style =
Expand All @@ -15,14 +16,14 @@ const renderCell = (cellValues: GridRenderCellParams): React.ReactNode => {
? { color: 'green' }
: { color: '' }

return <div style={style}>{cellValues.value}</div>
return <Box sx={style}>{cellValues.value}</Box>
}

export const renderCellWithdraws = (): React.ReactNode => {
return (
<div style={{ width: '100%' }}>
<p style={{ cursor: 'pointer', color: 'hsl(206,100%,40%)' }}>Отваряне</p>
</div>
<Box sx={{ width: '100%' }}>
<Box sx={{ cursor: 'pointer', color: 'hsl(206,100%,40%)' }}>Отваряне</Box>
</Box>
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/benefactor/grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default observer(function Grid() {
<>
<Box sx={{ marginTop: '2%', mx: 'auto', width: 700 }}>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/beneficiary/grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default observer(function Grid() {
<>
<Box sx={{ marginTop: '2%', mx: 'auto', width: 700 }}>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function CampaignApplicationsGrid() {

return (
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 299px)',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/campaign-news/CampaignNewsGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default function CampaignNewsGrid() {
</Link>
</Toolbar>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/campaign-news/GridActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {
export default function GridActions({ id, allowDelete = false, onView, onDelete }: Props) {
return (
<Box
style={{
sx={{
width: '100%',
height: '100%',
display: 'flex',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/campaigns/grid/CampaignGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export default function CampaignGrid() {
</Link>
</Toolbar>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/campaigns/grid/GridActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {
export default function GridActions({ id, allowDelete = false, onView, onDelete }: Props) {
return (
<Box
style={{
sx={{
width: '100%',
height: '100%',
display: 'flex',
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/cities/grid/CityGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default observer(function CitiesGrid() {
return (
<>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
42 changes: 22 additions & 20 deletions src/components/admin/coordinators/grid/CoordinatorsGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import { ModalStore } from '../CoordinatorsPage'
import DeleteModal from './DeleteModal'
import DetailsModal from './DetailsModal'
import { useTranslation } from 'next-i18next'
import { styled } from '@mui/material/styles'

const StyledMailLink = styled('a')(() => ({
textDecoration: 'underline',
color: '#0070f3',
cursor: 'pointer',
}))

export default function CoordinatorsGrid() {
const { t } = useTranslation('coordinator')
Expand Down Expand Up @@ -47,15 +54,9 @@ export default function CoordinatorsGrid() {
width: 250,
renderCell: (params: GridRenderCellParams): React.ReactNode => {
return (
<a
href={`mailto:${params.row.person.email}`}
style={{
textDecoration: 'underline',
color: '#0070f3',
cursor: 'pointer',
}}>
<StyledMailLink href={`mailto:${params.row.person.email}`}>
{params.row.person.email}
</a>
</StyledMailLink>
)
},
},
Expand All @@ -76,20 +77,21 @@ export default function CoordinatorsGrid() {
page: 0,
})

const StyledDataGrid = styled(DataGrid)({
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
border: 'none',
width: 'calc(100% - 48px)',
left: '24px',
overflowY: 'auto',
overflowX: 'hidden',
borderRadius: '0 0 13px 13px',
})

return (
<>
<DataGrid
style={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
border: 'none',
width: 'calc(100% - 48px)',
left: '24px',
overflowY: 'auto',
overflowX: 'hidden',
borderRadius: '0 0 13px 13px',
}}
<StyledDataGrid
rows={data || []}
columns={columns}
pageSizeOptions={[5, 10]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Box } from '@mui/material'
import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'

import React from 'react'
Expand All @@ -16,7 +17,7 @@ const renderCell = (cellValues: GridRenderCellParams): React.ReactNode => {
? { color: 'green' }
: { color: '' }

return <div style={style}>{cellValues.value}</div>
return <Box sx={style}>{cellValues.value}</Box>
}

export const commonProps: Partial<GridColDef> = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/countries/grid/CountryGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default observer(function Grid() {
<Root>
<Box sx={{ marginTop: '2%', mx: 'auto', width: 700 }}>
<DataGrid
style={{
sx={{
background: theme.palette.common.white,
position: 'absolute',
height: 'calc(100vh - 300px)',
Expand Down
Loading
Loading