on a3bbc03 help sign in
23 lines 778 B history raw
1import React from 'react';
2import cn from 'classnames';
4import getComponent from '../lib/getComponent';
6const typeWith = (DefaultComponent, defaultClassName) =>
7 function({ as = DefaultComponent, className, ...rest }) {
8 const Component = getComponent(as);
9 return <Component className={cn(defaultClassName, className)} {...rest} />;
10 };
12export const H1 = typeWith('h1');
13export const H2 = typeWith('h2');
14export const H3 = typeWith('h3');
15export const H4 = typeWith('h4');
16export const H5 = typeWith('h5');
17export const H6 = typeWith('h6');
18export const Caption = typeWith('caption');
19export const P = typeWith('p');
21export const Breadcrumb = typeWith('span', 'f6');
22export const Text = typeWith('span', 'f5');
23export const HelpText = typeWith('span', 'f6 gray4');