Added check in StatusCard for isVertical
• Added: - check in StatusCard for isVertical to force vertical layout for card image and texts
This commit is contained in:
parent
188dc4e008
commit
b608453939
@ -4,7 +4,10 @@ import Immutable from 'immutable'
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||||
import punycode from 'punycode'
|
import punycode from 'punycode'
|
||||||
import { DEFAULT_REL } from '../constants'
|
import {
|
||||||
|
CX,
|
||||||
|
DEFAULT_REL,
|
||||||
|
} from '../constants'
|
||||||
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
|
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
|
||||||
import Icon from './icon'
|
import Icon from './icon'
|
||||||
|
|
||||||
@ -124,7 +127,11 @@ class StatusCard extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { card, isReduced } = this.props
|
const {
|
||||||
|
card,
|
||||||
|
isReduced,
|
||||||
|
isVertical,
|
||||||
|
} = this.props
|
||||||
const { width, embedded } = this.state
|
const { width, embedded } = this.state
|
||||||
|
|
||||||
if (card === null) return null
|
if (card === null) return null
|
||||||
@ -132,7 +139,6 @@ class StatusCard extends ImmutablePureComponent {
|
|||||||
const maxDescription = 160
|
const maxDescription = 160
|
||||||
const cardImg = card.get('image')
|
const cardImg = card.get('image')
|
||||||
const provider = card.get('provider_name').length === 0 ? decodeIDNA(getHostname(card.get('url'))) : card.get('provider_name')
|
const provider = card.get('provider_name').length === 0 ? decodeIDNA(getHostname(card.get('url'))) : card.get('provider_name')
|
||||||
const horizontal = (card.get('width') > card.get('height') && (card.get('width') + 100 >= width)) || card.get('type') !== 'link' || embedded
|
|
||||||
const interactive = card.get('type') !== 'link'
|
const interactive = card.get('type') !== 'link'
|
||||||
|
|
||||||
const cardTitle = `${card.get('title')}`.trim()
|
const cardTitle = `${card.get('title')}`.trim()
|
||||||
@ -233,6 +239,12 @@ class StatusCard extends ImmutablePureComponent {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const containerClasses = CX({
|
||||||
|
d: 1,
|
||||||
|
width100PC: 1,
|
||||||
|
flexRow: !isVertical,
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={[_s.d, _s.w100PC, _s.px10].join(' ')}>
|
<div className={[_s.d, _s.w100PC, _s.px10].join(' ')}>
|
||||||
<a
|
<a
|
||||||
@ -243,7 +255,7 @@ class StatusCard extends ImmutablePureComponent {
|
|||||||
className={[_s.d, _s.cursorPointer, _s.overflowHidden, _s.noUnderline, _s.w100PC, _s.bgSubtle_onHover, _s.borderColorSecondary, _s.border1PX, _s.radiusSmall].join(' ')}
|
className={[_s.d, _s.cursorPointer, _s.overflowHidden, _s.noUnderline, _s.w100PC, _s.bgSubtle_onHover, _s.borderColorSecondary, _s.border1PX, _s.radiusSmall].join(' ')}
|
||||||
>
|
>
|
||||||
<ResponsiveClassesComponent
|
<ResponsiveClassesComponent
|
||||||
classNames={[_s.d, _s.flexRow, _s.w100PC].join(' ')}
|
classNames={containerClasses}
|
||||||
classNamesSmall={!cardImg ? undefined : [_s.d, _s.w100PC].join(' ')}
|
classNamesSmall={!cardImg ? undefined : [_s.d, _s.w100PC].join(' ')}
|
||||||
>
|
>
|
||||||
{!isReduced && embed}
|
{!isReduced && embed}
|
||||||
@ -262,6 +274,7 @@ StatusCard.propTypes = {
|
|||||||
defaultWidth: PropTypes.number,
|
defaultWidth: PropTypes.number,
|
||||||
cacheWidth: PropTypes.func,
|
cacheWidth: PropTypes.func,
|
||||||
isReduced: PropTypes.bool,
|
isReduced: PropTypes.bool,
|
||||||
|
isVertical: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default StatusCard
|
export default StatusCard
|
@ -105,7 +105,7 @@ class StatusMedia extends ImmutablePureComponent {
|
|||||||
onOpenMedia={onOpenMedia}
|
onOpenMedia={onOpenMedia}
|
||||||
cacheWidth={cacheWidth}
|
cacheWidth={cacheWidth}
|
||||||
defaultWidth={defaultWidth}
|
defaultWidth={defaultWidth}
|
||||||
isComment={isComment}
|
isVertical={isComment || isChild}
|
||||||
isReduced={isStatusCard || isComposeModalOpen}
|
isReduced={isStatusCard || isComposeModalOpen}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user