mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
implement autoCarrousel
& expansibleActions
support
This commit is contained in:
parent
a85c157003
commit
d59cae979a
@ -113,22 +113,6 @@ const PostContent = React.memo((props) => {
|
|||||||
|
|
||||||
let carruselRef = React.useRef(null)
|
let carruselRef = React.useRef(null)
|
||||||
|
|
||||||
const onClickController = (direction) => {
|
|
||||||
if (carruselRef.current) {
|
|
||||||
switch (direction) {
|
|
||||||
case "left": {
|
|
||||||
return carruselRef.current.prev()
|
|
||||||
}
|
|
||||||
case "right": {
|
|
||||||
return carruselRef.current.next()
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// first filter if is an string
|
// first filter if is an string
|
||||||
additions = additions.filter(file => typeof file === "string")
|
additions = additions.filter(file => typeof file === "string")
|
||||||
|
|
||||||
@ -191,7 +175,7 @@ const PostContent = React.memo((props) => {
|
|||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
<div className="addition">
|
<div className="addition">
|
||||||
<React.Suspense ref={carruselRef} fallback={<div>Loading</div>} >
|
<React.Suspense fallback={<div>Loading</div>} >
|
||||||
<MediaRender />
|
<MediaRender />
|
||||||
</React.Suspense>
|
</React.Suspense>
|
||||||
</div>
|
</div>
|
||||||
@ -228,7 +212,7 @@ const PostContent = React.memo((props) => {
|
|||||||
arrows={true}
|
arrows={true}
|
||||||
nextArrow={<Icons.ChevronRight />}
|
nextArrow={<Icons.ChevronRight />}
|
||||||
prevArrow={<Icons.ChevronLeft />}
|
prevArrow={<Icons.ChevronLeft />}
|
||||||
autoplay
|
autoplay={props.autoCarrousel}
|
||||||
>
|
>
|
||||||
{additions}
|
{additions}
|
||||||
</antd.Carousel>
|
</antd.Carousel>
|
||||||
@ -285,7 +269,13 @@ const PostActions = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PostCard = React.memo(({ selfId, data = {}, events = {} }) => {
|
export const PostCard = React.memo(({
|
||||||
|
selfId,
|
||||||
|
expansibleActions = window.app.settings.get("postCard_expansible_actions"),
|
||||||
|
autoCarrousel = window.app.settings.get("postCard_carrusel_auto"),
|
||||||
|
data = {},
|
||||||
|
events = {}
|
||||||
|
}) => {
|
||||||
const [loading, setLoading] = React.useState(true)
|
const [loading, setLoading] = React.useState(true)
|
||||||
const [likes, setLikes] = React.useState(data.likes ?? [])
|
const [likes, setLikes] = React.useState(data.likes ?? [])
|
||||||
const [comments, setComments] = React.useState(data.comments ?? [])
|
const [comments, setComments] = React.useState(data.comments ?? [])
|
||||||
@ -345,7 +335,11 @@ export const PostCard = React.memo(({ selfId, data = {}, events = {} }) => {
|
|||||||
return <div
|
return <div
|
||||||
key={data.key ?? data._id}
|
key={data.key ?? data._id}
|
||||||
id={data._id}
|
id={data._id}
|
||||||
className={classnames("postCard", { ["liked"]: hasLiked })}
|
className={classnames(
|
||||||
|
"postCard",
|
||||||
|
{ ["liked"]: hasLiked },
|
||||||
|
{ ["noHide"]: !expansibleActions }
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<div className="wrapper">
|
<div className="wrapper">
|
||||||
<PostHeader
|
<PostHeader
|
||||||
@ -356,6 +350,7 @@ export const PostCard = React.memo(({ selfId, data = {}, events = {} }) => {
|
|||||||
/>
|
/>
|
||||||
<PostContent
|
<PostContent
|
||||||
data={data}
|
data={data}
|
||||||
|
autoCarrousel={autoCarrousel}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="actionsIndicatorWrapper">
|
<div className="actionsIndicatorWrapper">
|
||||||
|
@ -21,6 +21,16 @@
|
|||||||
outline-color: var(--primaryColor);
|
outline-color: var(--primaryColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.noHide {
|
||||||
|
.wrapper {
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionsWrapper {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -409,10 +419,6 @@
|
|||||||
.actionsWrapper {
|
.actionsWrapper {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .actionsIndicator {
|
|
||||||
// opacity: 0;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.adm-swiper-track-inner {
|
.adm-swiper-track-inner {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user