flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
48
VISUALIZACION/node_modules/polished/lib/mixins/ellipsis.js.flow
generated
vendored
Executable file
48
VISUALIZACION/node_modules/polished/lib/mixins/ellipsis.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
// @flow
|
||||
import type { Styles } from '../types/style'
|
||||
|
||||
/**
|
||||
* CSS to represent truncated text with an ellipsis. You can optionally pass a max-width and number of lines before truncating.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* ...ellipsis('250px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* ${ellipsis('250px')}
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div: {
|
||||
* 'display': 'inline-block',
|
||||
* 'maxWidth': '250px',
|
||||
* 'overflow': 'hidden',
|
||||
* 'textOverflow': 'ellipsis',
|
||||
* 'whiteSpace': 'nowrap',
|
||||
* 'wordWrap': 'normal'
|
||||
* }
|
||||
*/
|
||||
export default function ellipsis(width?: ?string | ?number, lines?: number = 1): Styles {
|
||||
const styles = {
|
||||
display: 'inline-block',
|
||||
maxWidth: width || '100%',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
wordWrap: 'normal',
|
||||
}
|
||||
|
||||
return lines > 1
|
||||
? {
|
||||
...styles,
|
||||
WebkitBoxOrient: 'vertical',
|
||||
WebkitLineClamp: lines,
|
||||
display: '-webkit-box',
|
||||
whiteSpace: 'normal',
|
||||
}
|
||||
: styles
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue