Forward link styling of EntityRefLink and EnriryRefLinks into the underling Link

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-02-18 11:07:11 +01:00
parent 49f9b7346d
commit 9615e68fb6
5 changed files with 32 additions and 24 deletions
+3 -3
View File
@@ -14,17 +14,17 @@
* limitations under the License.
*/
import React, { ElementType } from 'react';
import {
Link as MaterialLink,
LinkProps as MaterialLinkProps,
} from '@material-ui/core';
import React, { ElementType } from 'react';
import {
Link as RouterLink,
LinkProps as RouterLinkProps,
} from 'react-router-dom';
type Props = MaterialLinkProps &
export type LinkProps = MaterialLinkProps &
RouterLinkProps & {
component?: ElementType<any>;
};
@@ -33,7 +33,7 @@ type Props = MaterialLinkProps &
* Thin wrapper on top of material-ui's Link component
* Makes the Link to utilise react-router
*/
export const Link = React.forwardRef<any, Props>((props, ref) => {
export const Link = React.forwardRef<any, LinkProps>((props, ref) => {
const to = String(props.to);
return /^https?:\/\//.test(to) ? (
// External links
@@ -15,3 +15,4 @@
*/
export { Link } from './Link';
export type { LinkProps } from './Link';