lbry-desktop/ui/component/yrbl/index.jsx

42 lines
908 B
React
Raw Normal View History

2019-03-05 05:46:57 +01:00
// @flow
import * as React from 'react';
import classnames from 'classnames';
import HappyYrbl from './gerbil-happy.png';
import SadYrbl from './gerbil-sad.png';
type Props = {
title?: string,
subtitle?: string | React.Node,
type: string,
className?: string,
};
const yrblTypes = {
happy: HappyYrbl,
sad: SadYrbl,
};
export default class extends React.PureComponent<Props> {
static defaultProps = {
type: 'happy',
};
render() {
const { title, subtitle, type, className } = this.props;
const image = yrblTypes[type];
return (
<div className="yrbl__wrap">
2019-04-04 06:40:28 +02:00
<img alt="Friendly gerbil" className={classnames('yrbl', className)} src={`${image}`} />
2019-03-05 05:46:57 +01:00
{title && subtitle && (
<div className="yrbl__content">
2019-03-05 05:46:57 +01:00
<h2 className="card__title">{title}</h2>
2019-07-21 23:31:22 +02:00
<p>{subtitle}</p>
2019-03-05 05:46:57 +01:00
</div>
)}
</div>
);
}
}