1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #~: Minor fix to empty card component (#2076)

This commit is contained in:
Sergio Betanzos 2022-05-24 18:57:13 +02:00 committed by GitHub
parent 627a95bbd2
commit 7e24b82c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 37 deletions

View File

@ -16,46 +16,26 @@
import { memo } from 'react'
import PropTypes from 'prop-types'
import { Card, CardHeader, Fade } from '@mui/material'
import makeStyles from '@mui/styles/makeStyles'
import { Tr } from 'client/components/HOC'
import { styled, Card, CardHeader, Fade } from '@mui/material'
import { Translate } from 'client/components/HOC'
import { T } from 'client/constants'
const useStyles = makeStyles((theme) => ({
root: {
height: '100%',
},
content: {
height: '100%',
minHeight: 140,
padding: theme.spacing(1),
textAlign: 'center',
},
const Title = styled(CardHeader)(({ theme }) => ({
height: '100%',
minHeight: 140,
padding: theme.spacing(1),
textAlign: 'center',
}))
const EmptyCard = memo(({ title }) => {
const classes = useStyles()
return (
<Fade in unmountOnExit>
<Card className={classes.root} variant="outlined">
<CardHeader
subheader={Tr(title ?? T.Empty)}
className={classes.content}
/>
</Card>
</Fade>
)
})
EmptyCard.propTypes = {
title: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
}
EmptyCard.defaultProps = {
title: undefined,
}
const EmptyCard = memo(({ title }) => (
<Fade in unmountOnExit>
<Card variant="outlined">
<Title subheader={<Translate word={title ?? T.Empty} />} />
</Card>
</Fade>
))
EmptyCard.propTypes = { title: PropTypes.string }
EmptyCard.displayName = 'EmptyCard'
export default EmptyCard

View File

@ -20,7 +20,7 @@ import { TextField, Chip, Autocomplete } from '@mui/material'
import { useController } from 'react-hook-form'
import { ErrorHelper } from 'client/components/FormControl'
import { Tr, Translate } from 'client/components/HOC'
import { Translate } from 'client/components/HOC'
import { generateKey } from 'client/utils'
const AutocompleteController = memo(
@ -86,7 +86,7 @@ const AutocompleteController = memo(
<ErrorHelper label={error?.message ?? error[0]?.message}>
{tooltip &&
inputProps?.value?.length > 0 &&
`. ${Tr(tooltip)}`}
`. ${(<Translate word={tooltip} />)}`}
</ErrorHelper>
)
}