Skip to content

Commit d37b151

Browse files
authored
fix(app): remove marginLeft from ExternalLink component (#17112)
* fix(app): remove marginLeft from ExternalLink component
1 parent a4f2338 commit d37b151

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

app/src/atoms/Link/ExternalLink.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1-
import type * as React from 'react'
1+
import { css } from 'styled-components'
2+
import {
3+
DISPLAY_INLINE_BLOCK,
4+
Icon,
5+
Link,
6+
SPACING,
7+
TYPOGRAPHY,
8+
} from '@opentrons/components'
29

3-
import { Link, Icon, TYPOGRAPHY, SPACING } from '@opentrons/components'
10+
import type { ReactNode } from 'react'
411
import type { LinkProps } from '@opentrons/components'
5-
612
export interface ExternalLinkProps extends LinkProps {
713
href: string
814
id?: string
9-
children: React.ReactNode
15+
children: ReactNode
1016
}
1117

1218
export const ExternalLink = (props: ExternalLinkProps): JSX.Element => (
1319
<Link external {...props} css={TYPOGRAPHY.linkPSemiBold}>
1420
{props.children}
21+
<span css={SPAN_STYLE}></span>
1522
<Icon
1623
size={SPACING.spacing8}
17-
marginLeft="0.4375rem"
1824
name="open-in-new"
1925
aria-label="open_in_new_icon"
2026
/>
2127
</Link>
2228
)
29+
30+
const SPAN_STYLE = css`
31+
display: ${DISPLAY_INLINE_BLOCK};
32+
width: 0.4375rem;
33+
`

app/src/atoms/Link/__tests__/ExternalLink.test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ describe('ExternalLink', () => {
3838
const icon = screen.getByLabelText('open_in_new_icon')
3939
expect(icon).toBeInTheDocument()
4040
expect(icon).toHaveStyle('width: 0.5rem; height: 0.5rem')
41-
expect(icon).toHaveStyle('margin-left: 0.4375rem')
4241
})
4342
})

0 commit comments

Comments
 (0)