Skip to content

Commit

Permalink
Truncate.js → Truncate.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
colebemis committed Jan 30, 2021
1 parent cc3266c commit 4eefd10
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/Truncate.js → src/Truncate.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import styled from 'styled-components'
import {maxWidth} from 'styled-system'
import {maxWidth, MaxWidthProps} from 'styled-system'
import PropTypes from 'prop-types'
import {TYPOGRAPHY, COMMON} from './constants'
import {TYPOGRAPHY, COMMON, SystemTypographyProps, SystemCommonProps} from './constants'
import theme from './theme'
import sx from './sx'
import sx, {SxProp} from './sx'
import {ComponentProps} from './utils/types'

const Truncate = styled('div')`
type StyledTruncateProps = {
title: string
inline?: boolean
expandable?: boolean
} & MaxWidthProps &
SystemTypographyProps &
SystemCommonProps &
SxProp

const Truncate = styled.div<StyledTruncateProps>`
${TYPOGRAPHY}
${COMMON}
display: ${props => (props.inline ? 'inline-block' : 'inherit')};
Expand All @@ -19,7 +29,6 @@ const Truncate = styled('div')`
`

Truncate.defaultProps = {
as: 'div',
expandable: false,
inline: false,
maxWidth: 125,
Expand All @@ -37,4 +46,5 @@ Truncate.propTypes = {
title: PropTypes.string.isRequired
}

export type TruncateProps = ComponentProps<typeof Truncate>
export default Truncate
File renamed without changes.

0 comments on commit 4eefd10

Please # to comment.