Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Mobile
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
165
Merge Requests
15
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Minds
Minds Mobile
Compare Revisions
3c5e3d34370a6c5f3253849a8582c8186411d481...80e4902735e123b41fd2a948c721a43c442a2777
Source
80e4902735e123b41fd2a948c721a43c442a2777
...
Target
3c5e3d34370a6c5f3253849a8582c8186411d481
Compare
Commits (2)
(feat) limit blog card title length
· 6d460a9b
Martin Santangelo
authored
1 week ago
6d460a9b
Merge branch 'feat/limit-blog-card-title-to-two-lines' into 'release/3.15.0'
· 80e49027
Brian Hatchet
authored
1 hour ago
Limit blog card title length See merge request
!470
80e49027
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
__tests__/blogs/__snapshots__/BlogCard.js.snap
View file @
80e49027
...
...
@@ -80,6 +80,8 @@ exports[`blog card component should renders correctly 1`] = `
}
>
<Text
ellipsizeMode="tail"
numberOfLines={2}
style={
Array [
Object {
...
...
@@ -88,6 +90,9 @@ exports[`blog card component should renders correctly 1`] = `
Object {
"fontWeight": "500",
},
Object {
"flex": 1,
},
]
}
>
...
...
This diff is collapsed.
src/blogs/BlogCard.js
View file @
80e49027
...
...
@@ -23,13 +23,25 @@ import Actions from '../newsfeed/activity/Actions';
* Blog Card
*/
export
default
class
BlogCard
extends
PureComponent
{
/**
* Navigate to blog
*/
navToBlog
=
()
=>
{
if
(
!
this
.
props
.
navigation
||
!
this
.
props
.
entity
.
can
(
FLAG_VIEW
,
true
))
return
;
if
(
!
this
.
props
.
navigation
||
!
this
.
props
.
entity
.
can
(
FLAG_VIEW
,
true
))
{
return
;
}
return
this
.
props
.
navigation
.
push
(
'
BlogView
'
,
{
blog
:
this
.
props
.
entity
});
};
/**
* Trim and remove new line char
* @param {string} title
*/
cleanTitle
(
title
)
{
if
(
!
title
)
{
return
''
;
}
return
title
.
trim
().
replace
(
/
\n
/gm
,
'
'
);
}
/**
...
...
@@ -39,13 +51,14 @@ export default class BlogCard extends PureComponent {
const
blog
=
this
.
props
.
entity
;
const
channel
=
this
.
props
.
entity
.
ownerObj
;
const
image
=
blog
.
getBannerSource
();
const
title
=
this
.
cleanTitle
(
blog
.
title
);
return
(
<
TouchableOpacity
onPress
=
{
this
.
navToBlog
}
style
=
{
CS
.
backgroundWhite
}
>
<
FastImage
source
=
{
image
}
style
=
{
styles
.
banner
}
resizeMode
=
{
FastImage
.
resizeMode
.
cover
}
/
>
<
View
style
=
{[
CS
.
padding2x
]}
>
<
View
style
=
{[
CS
.
columnAlignStart
,
CS
.
fullWidth
]}
>
<
Text
style
=
{[
CS
.
fontL
,
CS
.
fontMedium
]}
>
{
blog
.
title
}
<
/Text
>
<
Text
style
=
{[
CS
.
fontL
,
CS
.
fontMedium
,
CS
.
flexContainer
]}
numberOfLines
=
{
2
}
ellipsizeMode
=
"
tail
"
>
{
title
}
<
/Text
>
<
View
style
=
{[
CS
.
marginBottom2x
,
CS
.
marginTop2x
,
CS
.
rowJustifyCenter
,
CS
.
alignCenter
]}
>
{
channel
&&
<
Avatar
width
=
{
24
}
...
...
@@ -73,5 +86,5 @@ const styles = StyleSheet.create({
flexDirection
:
'
row
'
,
height
:
150
,
width
:
'
100%
'
,
}
}
,
});
This diff is collapsed.