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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user