Prevent fullWidth from being passed to Link ie <a> (#6893)

fixes #6825
This commit is contained in:
nitin 2024-09-09 18:52:59 +05:30 committed by GitHub
parent 5123655128
commit b01745dba7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,15 @@
import styled from '@emotion/styled';
import React from 'react';
import { Link } from 'react-router-dom';
import { Link, LinkProps } from 'react-router-dom';
const StyledUndecoratedLink = styled(Link)<{ fullWidth: boolean }>`
type StyledLinkProps = LinkProps & {
fullWidth?: boolean;
};
const StyledUndecoratedLink = styled(
// eslint-disable-next-line react/jsx-props-no-spreading
({ fullWidth: _, ...props }: StyledLinkProps) => <Link {...props} />,
)<StyledLinkProps>`
text-decoration: none;
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
`;