Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add possibility to inherit parent on a link #1825

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/pages/components/link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ For a target `_blank` we add `rel='noopener noreferrer'`
</Link>
```

## With a Text component

By default link is set to medium on fontWeight, you can force inherit to get the parent style.

```jsx
<Text variant="h5">
A text with h5{' '}
<Link href="#" fontWeight="inherit" target="_blank">
variant
</Link>
</Text>
```

## Usage with React Router

<code>
Expand Down
3 changes: 2 additions & 1 deletion packages/Link/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css, system, th } from '@xstyled/styled-components'
import styled, { css, system, th, typography } from '@xstyled/styled-components'
import { UniversalLink } from '@welcome-ui/universal-link'
import { shouldForwardProp } from '@welcome-ui/system'

Expand Down Expand Up @@ -26,6 +26,7 @@ export const Link = styled(UniversalLink).withConfig({ shouldForwardProp })<{
${th('links.default')};
${th(`links.${variant}.default`)};
${isExternalLink && th('links.withExternalLink')};
${typography};
}

&:hover,
Expand Down