168675f3eSEvan Baconimport { ComponentType, forwardRef } from 'react';
23ee10587SEvan Baconimport { StyleSheet } from 'react-native';
33ee10587SEvan Baconimport createElement from 'react-native-web/dist/exports/createElement';
468675f3eSEvan Bacon
568675f3eSEvan Baconimport { BlockQuoteProps, QuoteProps, TimeProps } from './Text.types';
6*8a424bebSJames Ideimport { TextProps } from '../primitives/Text';
768675f3eSEvan Bacon
868675f3eSEvan Baconexport const P = forwardRef(({ style, ...props }: TextProps, ref) => {
968675f3eSEvan Bacon  return createElement('p', { ...props, style: [styles.reset, style], ref });
1068675f3eSEvan Bacon}) as ComponentType<TextProps>;
1168675f3eSEvan Bacon
1268675f3eSEvan Baconexport const B = forwardRef(({ style, ...props }: TextProps, ref) => {
1368675f3eSEvan Bacon  return createElement('b', { ...props, style: [styles.reset, style], ref });
1468675f3eSEvan Bacon}) as ComponentType<TextProps>;
1568675f3eSEvan Bacon
1668675f3eSEvan Baconexport const S = forwardRef(({ style, ...props }: TextProps, ref) => {
1768675f3eSEvan Bacon  return createElement('s', { ...props, style: [styles.reset, style], ref });
1868675f3eSEvan Bacon}) as ComponentType<TextProps>;
1968675f3eSEvan Bacon
2068675f3eSEvan Baconexport const Del = forwardRef(({ style, ...props }: TextProps, ref) => {
2168675f3eSEvan Bacon  return createElement('del', { ...props, style: [styles.reset, style], ref });
2268675f3eSEvan Bacon}) as ComponentType<TextProps>;
2368675f3eSEvan Bacon
2468675f3eSEvan Baconexport const Strong = forwardRef(({ style, ...props }: TextProps, ref) => {
2568675f3eSEvan Bacon  return createElement('strong', { ...props, style: [styles.reset, style], ref });
2668675f3eSEvan Bacon}) as ComponentType<TextProps>;
2768675f3eSEvan Bacon
2868675f3eSEvan Baconexport const I = forwardRef(({ style, ...props }: TextProps, ref) => {
2968675f3eSEvan Bacon  return createElement('i', { ...props, style: [styles.reset, style], ref });
3068675f3eSEvan Bacon}) as ComponentType<TextProps>;
3168675f3eSEvan Bacon
3268675f3eSEvan Baconexport const Q = forwardRef(({ style, ...props }: QuoteProps, ref) => {
3368675f3eSEvan Bacon  return createElement('q', { ...props, style: [styles.reset, style], ref });
3468675f3eSEvan Bacon}) as ComponentType<QuoteProps>;
3568675f3eSEvan Bacon
3668675f3eSEvan Baconexport const BlockQuote = forwardRef(({ style, ...props }: BlockQuoteProps, ref) => {
3768675f3eSEvan Bacon  return createElement('blockquote', { ...props, style: [styles.reset, style], ref });
3868675f3eSEvan Bacon}) as ComponentType<BlockQuoteProps>;
3968675f3eSEvan Bacon
4068675f3eSEvan Baconexport const EM = forwardRef(({ style, ...props }: TextProps, ref) => {
4168675f3eSEvan Bacon  return createElement('em', { ...props, style: [styles.reset, style], ref });
4268675f3eSEvan Bacon}) as ComponentType<TextProps>;
4368675f3eSEvan Bacon
4468675f3eSEvan Baconexport const BR = forwardRef((props: TextProps, ref) => {
4568675f3eSEvan Bacon  return createElement('br', { ...props, ref });
4668675f3eSEvan Bacon}) as ComponentType<TextProps>;
4768675f3eSEvan Bacon
4868675f3eSEvan Baconexport const Small = forwardRef(({ style, ...props }: TextProps, ref) => {
4968675f3eSEvan Bacon  return createElement('small', { ...props, style: [styles.reset, style], ref });
5068675f3eSEvan Bacon}) as ComponentType<TextProps>;
5168675f3eSEvan Bacon
5268675f3eSEvan Baconexport const Mark = forwardRef(({ style, ...props }: TextProps, ref) => {
5368675f3eSEvan Bacon  return createElement('mark', { ...props, style: [styles.reset, style], ref });
5468675f3eSEvan Bacon}) as ComponentType<TextProps>;
5568675f3eSEvan Bacon
5668675f3eSEvan Baconexport const Code = forwardRef((props: TextProps, ref) => {
5768675f3eSEvan Bacon  return createElement('code', { ...props, ref });
5868675f3eSEvan Bacon}) as ComponentType<TextProps>;
5968675f3eSEvan Bacon
6068675f3eSEvan Baconexport const Time = forwardRef(({ style, ...props }: TimeProps, ref) => {
6168675f3eSEvan Bacon  return createElement('time', { ...props, style: [styles.reset, style], ref });
6268675f3eSEvan Bacon}) as ComponentType<TimeProps>;
6368675f3eSEvan Bacon
6468675f3eSEvan Baconexport const Pre = forwardRef(({ style, ...props }: TextProps, ref) => {
65b3e65a7aSJames Ide  return createElement('pre', { ...props, style: [styles.reset, style], ref });
6668675f3eSEvan Bacon}) as ComponentType<TextProps>;
6768675f3eSEvan Bacon
6868675f3eSEvan Baconconst styles = StyleSheet.create({
6968675f3eSEvan Bacon  reset: {
7068675f3eSEvan Bacon    fontFamily: 'System',
7168675f3eSEvan Bacon    color: '#000',
7268675f3eSEvan Bacon    border: '0 solid black',
7368675f3eSEvan Bacon    boxSizing: 'border-box',
7468675f3eSEvan Bacon    // @ts-ignore: inline is not supported
7568675f3eSEvan Bacon    display: 'inline',
7668675f3eSEvan Bacon    margin: 0,
7768675f3eSEvan Bacon    padding: 0,
7868675f3eSEvan Bacon    whiteSpace: 'pre-wrap',
7968675f3eSEvan Bacon    wordWrap: 'break-word',
8068675f3eSEvan Bacon  },
8168675f3eSEvan Bacon});
82