Skip to content

Commit

Permalink
fix(app): remove marginLeft from ExternalLink component (#17112)
Browse files Browse the repository at this point in the history
* fix(app): remove marginLeft from ExternalLink component
  • Loading branch information
koji authored Dec 16, 2024
1 parent a4f2338 commit d37b151
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 16 additions & 5 deletions app/src/atoms/Link/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
import type * as React from 'react'
import { css } from 'styled-components'
import {
DISPLAY_INLINE_BLOCK,
Icon,
Link,
SPACING,
TYPOGRAPHY,
} from '@opentrons/components'

import { Link, Icon, TYPOGRAPHY, SPACING } from '@opentrons/components'
import type { ReactNode } from 'react'
import type { LinkProps } from '@opentrons/components'

export interface ExternalLinkProps extends LinkProps {
href: string
id?: string
children: React.ReactNode
children: ReactNode
}

export const ExternalLink = (props: ExternalLinkProps): JSX.Element => (
<Link external {...props} css={TYPOGRAPHY.linkPSemiBold}>
{props.children}
<span css={SPAN_STYLE}></span>
<Icon
size={SPACING.spacing8}
marginLeft="0.4375rem"
name="open-in-new"
aria-label="open_in_new_icon"
/>
</Link>
)

const SPAN_STYLE = css`
display: ${DISPLAY_INLINE_BLOCK};
width: 0.4375rem;
`
1 change: 0 additions & 1 deletion app/src/atoms/Link/__tests__/ExternalLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ describe('ExternalLink', () => {
const icon = screen.getByLabelText('open_in_new_icon')
expect(icon).toBeInTheDocument()
expect(icon).toHaveStyle('width: 0.5rem; height: 0.5rem')
expect(icon).toHaveStyle('margin-left: 0.4375rem')
})
})

0 comments on commit d37b151

Please sign in to comment.