add Card component
This commit is contained in:
1 parent
0ce8486d99
commit
13c7d473b1
3 files changed
+122
-1
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import './styles.css'
|
||||
import cx from 'classnames'
|
||||
import Link from 'next/link'
|
||||
|
||||
export type CardLayout = 'simple' | 'featured'
|
||||
export type CardProps = {
|
||||
style?: React.CSSProperties
|
||||
href: string
|
||||
img: {
|
||||
alt: string
|
||||
src: string
|
||||
srcSet: string
|
||||
}
|
||||
layout: CardLayout
|
||||
}
|
||||
|
||||
export const Card: React.FC<CardProps> = props => (
|
||||
<div className={cx('card', props.layout)} style={props.style}>
|
||||
<Link href={props.href}>
|
||||
<a>
|
||||
<div className={'card-image'}>
|
||||
<img
|
||||
className={cx({ opa: false })}
|
||||
alt={props.img.alt}
|
||||
src={props.img.src}
|
||||
srcSet={props.img.srcSet}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={'card-body'}>
|
||||
{props.children}
|
||||
</div>
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
Reference in new issue
Block a user