All files / src ThemedLink.js

100% Statements 7/7
100% Branches 4/4
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                    30x 126x 126x   126x 21x     126x             30x      
// @flow strict
import React from 'react';
 
import Link from './Link';
import Theme from './material-toolbox/theme';
 
type Props = {
  to?: string,
};
 
const ThemedLink = React.forwardRef<Props, _>(({ to, ...rest }: Props, ref) => {
  const Component = to != null ? Link : 'a';
  const props = {};
 
  if (to != null) {
    props.to = to;
  }
 
  return (
    <Theme color="primary">
      <Component {...(rest: mixed)} {...props} ref={ref} />
    </Theme>
  );
});
 
ThemedLink.displayName = 'ThemedLink';
 
export default ThemedLink;