/
BlockquoteRenderer.tsx
38 lines (33 loc) · 1.02 KB
/
BlockquoteRenderer.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'clsx';
import Styled, { JssInjectedProps } from 'rsg-components/Styled';
import * as Rsg from '../../../../typings';
const styles = ({ space, color, fontSize, fontFamily }: Rsg.Theme) => ({
blockquote: {
margin: [[space[2], space[4]]],
padding: 0,
color: color.base,
fontFamily: fontFamily.base,
fontSize: fontSize.base,
lineHeight: 1.5,
},
});
interface BlockquoteProps extends JssInjectedProps {
children: React.ReactNode;
className?: string;
}
export const BlockquoteRenderer: React.FunctionComponent<BlockquoteProps> = ({
classes,
className,
children,
}) => {
const blockquoteClasses = cx(classes.blockquote, className);
return <blockquote className={blockquoteClasses}>{children}</blockquote>;
};
BlockquoteRenderer.propTypes = {
classes: PropTypes.objectOf(PropTypes.string.isRequired).isRequired,
className: PropTypes.string,
children: PropTypes.any.isRequired,
};
export default Styled<BlockquoteProps>(styles)(BlockquoteRenderer);