import React, { memo, HTMLAttributes, forwardRef } from 'react';
import CodeComponent, { Props as CodeProps } from './Code';
import styleProps from '@techytools/ui/types/styles';
import withCombinedProps from '@techytools/ui/hooks/withCombinedProps';
import variants from './styles';
import withStyles from '@techytools/ui/hooks/withStyles';
export type Props = CodeProps & styleProps & HTMLAttributes;
export const Component = (props: Props, ref: any) => {
const {
variant,
title,
code,
collapsed,
showNumbers,
language,
prismTheme,
...rest
} = props;
return (
);
};
/*
* (1) default export is normal component ready to use (2) withCode is HOC used to predefine common props
*/
const Styled: React.FC = withStyles(
forwardRef(Component),
'Code',
variants
);
export default memo(Styled);
export const withCode = (props: Props) =>
memo(withCombinedProps(Styled, props));