Skip to content

Commit ec2501e

Browse files
authored
chore(condo): DOMA-12175 add ability to set custom component in ui kit Typography.Link (#6554)
* chore(condo): add ability to set custom component in ui kit Typography.Link * chore(condo): fix link type * chore(condo): use unknown type
1 parent 49f2309 commit ec2501e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

apps/condo/domains/user/components/auth/SignInForm.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,9 @@ export const SignInForm = (): React.ReactElement => {
198198
</Col>
199199

200200
<Col span={24}>
201-
<Link href={`/auth/forgot?next=${encodeURIComponent(redirectUrl)}`}>
202-
<Typography.Link href={`/auth/forgot?next=${encodeURIComponent(redirectUrl)}`} tabIndex={3}>
203-
{ResetPasswordMessage}
204-
</Typography.Link>
205-
</Link>
201+
<Typography.Link component={Link} href={`/auth/forgot?next=${encodeURIComponent(redirectUrl)}`} tabIndex={3}>
202+
{ResetPasswordMessage}
203+
</Typography.Link>
206204
</Col>
207205
</Row>
208206
</Col>

packages/ui/src/components/Typography/link.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type TypographyLinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElem
1414
size?: typeof TEXT_SIZES[number]
1515
id?: string
1616
children?: React.ReactNode
17+
component?: unknown
1718
['aria-label']?: string
1819
}
1920

@@ -23,7 +24,7 @@ const Link = React.forwardRef<HTMLElement, TypographyLinkProps>((props, ref) =>
2324
[`${TYPOGRAPHY_CLASS_PREFIX}-${size}`]: size,
2425
})
2526
// NOTE: Used wrapper destructuring to explicitly pass component props, which is marked as internal in antd
26-
const componentProps = { component: 'a' }
27+
const componentProps = { component: props.component ? props.component : 'a' }
2728

2829
const handleClick = useCallback<React.MouseEventHandler<HTMLAnchorElement>>((event) => {
2930
const stringContent = extractChildrenContent(children)

0 commit comments

Comments
 (0)