Skip to content

Commit b9478b3

Browse files
author
Elliot
authored
refactor(ListItem): Moved Truncate within Text for proper styling (#2070)
* ListItem - Moved Truncate within Text element * Removed Truncate style override - Not necessary since we inverted truncate + text wrapper relationship
1 parent e0ff56f commit b9478b3

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

packages/components/src/List/ListItem.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ const TruncateWrapper: FC<{
5757
fontSize?: FontSizes
5858
lineHeight?: FontSizes
5959
}> = ({ children, color, fontSize, lineHeight }) => (
60-
<Truncate>
61-
<Text color={color} fontSize={fontSize} lineHeight={lineHeight}>
62-
{children}
63-
</Text>
64-
</Truncate>
60+
<Text color={color} fontSize={fontSize} lineHeight={lineHeight}>
61+
<Truncate>{children}</Truncate>
62+
</Text>
6563
)
6664

6765
export interface ListItemProps

packages/components/src/List/ListItemWrapper.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import omit from 'lodash/omit'
2929
import React, { forwardRef, ReactNode, Ref } from 'react'
3030
import styled from 'styled-components'
3131
import { Icon } from '../Icon'
32-
import { Truncate } from '../Truncate'
3332
import {
3433
ListItemStatefulWithHoveredProps,
3534
ListItemDimensions,
@@ -130,10 +129,6 @@ export const ListItemWrapper = styled(ListItemWrapperInternal)`
130129
${({ theme }) => `${theme.transitions.quick}ms ${theme.easings.ease}`};
131130
}
132131
133-
${Truncate} {
134-
line-height: 1;
135-
}
136-
137132
&[aria-current='true'] {
138133
background: ${({ theme: { colors } }) => colors.ui2};
139134
font-weight: ${({ theme: { fontWeights } }) => fontWeights.semiBold};

packages/components/src/Truncate/Truncate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const TruncateLayout: FC<TruncateProps> = ({
8787

8888
const TextStyle = styled.span<WidthProps>`
8989
display: block;
90-
overflow: hidden;
90+
overflow-x: hidden;
9191
text-overflow: ellipsis;
9292
${widthHelper}
9393
white-space: nowrap;

0 commit comments

Comments
 (0)