Skip to content

Commit

Permalink
fix(ellipsis): set the height of ellipsis manually
Browse files Browse the repository at this point in the history
  • Loading branch information
unix committed Jun 25, 2020
1 parent 965654f commit 228bf62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Ellipsis should render correctly 1`] = `
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 10px;
min-width: 0;
}
</style></span></div>"
Expand Down
2 changes: 1 addition & 1 deletion components/shared/__tests__/ellipsis.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Ellipsis', () => {
it('should render correctly', () => {
const wrapper = mount(
<div style={{ width: '1px' }}>
<Ellipsis>text</Ellipsis>
<Ellipsis height="10px">text</Ellipsis>
</div>,
)
expect(wrapper.html()).toMatchSnapshot()
Expand Down
7 changes: 6 additions & 1 deletion components/shared/ellipsis.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react'

const Ellipsis: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {
export type EllipsisProps = {
height: string
}

const Ellipsis: React.FC<React.PropsWithChildren<EllipsisProps>> = ({ children, height }) => {
return (
<span>
{children}
Expand All @@ -9,6 +13,7 @@ const Ellipsis: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: ${height};
min-width: 0;
}
`}</style>
Expand Down

0 comments on commit 228bf62

Please sign in to comment.