hensei-web/components/common/TableField/index.tsx
Justin Edmund 4c5fb3c28d Rename all files and fix imports
* Renaming index.scss files to index.module.scss
* Changing `import from` to `import styles from`
2023-06-23 13:19:38 -07:00

48 lines
1.1 KiB
TypeScript

import classNames from 'classnames'
import styles from './index.module.scss'
interface Props {
name: string
label: string
description?: string
className?: string
imageAlt?: string
imageClass?: string
imageSrc?: string[]
children: React.ReactNode
}
const TableField = (props: Props) => {
const image = () => {
return props.imageSrc && props.imageSrc.length > 0 ? (
<div className={`preview ${props.imageClass}`}>
<img
alt={props.imageAlt}
srcSet={props.imageSrc.join(', ')}
src={props.imageSrc[0]}
/>
</div>
) : (
''
)
}
return (
<div className={classNames({ TableField: true }, props.className)}>
<div className="Left">
<div className="Info">
<h3>{props.label}</h3>
{props.description && <p>{props.description}</p>}
</div>
<div className="Image">{image()}</div>
</div>
<div className="Right">
<div className="Image">{image()}</div>
{props.children}
</div>
</div>
)
}
export default TableField