Skip to content

Commit

Permalink
fix(Link): remove flexbox allowing text to break (#4274)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthprost authored Sep 26, 2024
1 parent 2158cec commit 59df043
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 358 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-planes-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ultraviolet/ui": patch
---

Fix `<Link />` component not to be flexbox allowing the text to break
34 changes: 21 additions & 13 deletions packages/ui/src/components/Alert/__stories__/Link.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import { Alert } from '..'
import { Link as UVLink } from '../../Link'
import { Stack } from '../../Stack'
import { Template } from './Template.stories'

export const Link = Template.bind({})

Link.args = {
sentiment: 'info',
title: 'Information',
children: (
<Stack direction="row" justifyContent="space-between" flex="1 1 auto">
<p>You cannot create a ressource here</p>
<UVLink href="scaleway.com">Read more</UVLink>
</Stack>
),
}
export const Link = () => (
<Stack gap={1}>
<Alert sentiment="info" title="Information">
<Stack direction="row" justifyContent="space-between" flex="1 1 auto">
<p>You cannot create a ressource here</p>
<UVLink href="scaleway.com">Read more</UVLink>
</Stack>
</Alert>
<Alert sentiment="info" title="Information">
<p>
You cannot create a ressource here If you believe this is an error,{' '}
<UVLink href="scaleway.com" variant="inline" target="_blank">
contact support for further assistance this is an error
</UVLink>
. Additionally, ensure that you have the necessary permissions to access
this resource.
</p>
</Alert>
</Stack>
)

Link.parameters = {
docs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,6 @@ exports[`Banner > renders correctly with a link 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down Expand Up @@ -593,6 +582,7 @@ exports[`Banner > renders correctly with a link 1`] = `
width: 14px;
min-width: 14px;
min-height: 14px;
margin-left: 8px;
}
.emotion-19 .fillStroke {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ exports[`Breadcrumbs > renders correctly with default values 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down Expand Up @@ -289,17 +278,6 @@ exports[`Breadcrumbs > renders correctly with onClick 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down Expand Up @@ -369,17 +347,6 @@ exports[`Breadcrumbs > renders correctly with onClick 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down Expand Up @@ -548,17 +515,6 @@ exports[`Breadcrumbs > renders correctly with selected item 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,17 +661,6 @@ exports[`EmptySpace > should work with learn more 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down Expand Up @@ -738,6 +727,7 @@ exports[`EmptySpace > should work with learn more 1`] = `
width: 16px;
min-width: 16px;
min-height: 16px;
margin-left: 8px;
}
.emotion-18 .fillStroke {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1527,17 +1527,6 @@ exports[`GlobalAlert > renders correctly with link 1`] = `
text-decoration-thickness: 1px;
text-underline-offset: 2px;
text-decoration-color: transparent;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-transition: text-decoration-color 250ms ease-out;
transition: text-decoration-color 250ms ease-out;
gap: 8px;
Expand Down
44 changes: 44 additions & 0 deletions packages/ui/src/components/Link/__stories__/Examples.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { Decorator } from '@storybook/react'
import type { ComponentProps } from 'react'
import { Link } from '..'
import { Stack } from '../../Stack'
import { Text } from '../../Text'

export const Examples = (props: ComponentProps<typeof Link>) => (
<>
<Text as="p" variant="body">
To know more about that feature please visit{' '}
<Link
{...props}
target="_blank"
variant="inline"
href="https://example.com"
>
our website
</Link>{' '}
that is available any time.
</Text>
<Text as="p" variant="body">
To know more about that feature please visit{' '}
<Link {...props} target="_blank" href="https://example.com">
our website
</Link>{' '}
that is available any time.
</Text>
<Text as="p" variant="body">
To know more about that feature please visit{' '}
<Link {...props} iconPosition="right" href="https://example.com">
our website
</Link>{' '}
that is available any time.
</Text>
</>
)

Examples.decorators = [
StoryComponent => (
<Stack>
<StoryComponent />
</Stack>
),
] satisfies Decorator[]
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export { Target } from './Target.stories'
export { Size } from './Size.stories'
export { OneLine } from './OneLine.stories'
export { Prominence } from './Prominence.stories'
export { Examples } from './Examples.stories'
Loading

0 comments on commit 59df043

Please sign in to comment.