mirror of
https://github.com/zhigang1992/react.git
synced 2026-03-26 22:42:51 +08:00
refactor: abstract inline ellipsis component
This commit is contained in:
19
components/shared/ellipsis.tsx
Normal file
19
components/shared/ellipsis.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react'
|
||||
|
||||
const Ellipsis: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {
|
||||
return (
|
||||
<span>
|
||||
{children}
|
||||
<style jsx>{`
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
`}</style>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export default React.memo(Ellipsis)
|
||||
Reference in New Issue
Block a user