diff --git a/packages/app/src/components/Music/PlaylistTimelineEntry/index.less b/packages/app/src/components/Music/PlaylistTimelineEntry/index.less index b48d3b61..c3ded5b8 100644 --- a/packages/app/src/components/Music/PlaylistTimelineEntry/index.less +++ b/packages/app/src/components/Music/PlaylistTimelineEntry/index.less @@ -2,13 +2,10 @@ display: flex; flex-direction: column; - width: 35vw; - min-width: 300px; + width: 100%; max-width: 600px; - //min-height: 165px; height: 100%; - max-width: 800px; background-color: var(--background-color-accent); diff --git a/packages/app/src/components/PostCard/components/attachments/index.jsx b/packages/app/src/components/PostCard/components/attachments/index.jsx index 8c8830df..f66bbbb9 100755 --- a/packages/app/src/components/PostCard/components/attachments/index.jsx +++ b/packages/app/src/components/PostCard/components/attachments/index.jsx @@ -7,6 +7,10 @@ import mimetypes from "mime" import ContentFailed from "../contentFailed" +import BearCarousel, { BearSlideCard } from "bear-react-carousel" + + +import "bear-react-carousel/dist/index.css" import "react-responsive-carousel/lib/styles/carousel.min.css" import "plyr-react/dist/plyr.css" import "./index.less" @@ -125,60 +129,40 @@ const Attachment = React.memo((props) => { }) export default React.memo((props) => { - const carouselRef = React.useRef(null) - const [attachmentIndex, setAttachmentIndex] = React.useState(0) - - const handleAttachmentChange = (index) => { - const currentAttachmentIndex = carouselRef.current.state.selectedItem - const currentAttachment = carouselRef.current.itemsRef[currentAttachmentIndex].querySelector("video, audio") - - if (currentAttachmentIndex !== index) { - // if the attachment is a video, pause it - if (currentAttachment) { - currentAttachment.pause() - } - } else { - // else if the attachment is a video, play it - if (currentAttachment) { - currentAttachment.play() - } - } - - setAttachmentIndex(index) - } + const [controller, setController] = React.useState() + const [carouselState, setCarouselState] = React.useState() React.useEffect(() => { // get attachment index from query string const attachmentIndex = parseInt(new URLSearchParams(window.location.search).get("attachment")) if (attachmentIndex) { - setAttachmentIndex(attachmentIndex) + controller?.slideToPage(attachmentIndex) } }, []) return
- 1 ?? false} - selectedItem={attachmentIndex} - onChange={handleAttachmentChange} - transitionTime={150} - stopOnHover={true} - > - { - props.attachments?.length > 0 && props.attachments.map((attachment, index) => { + { + props.attachments?.length > 0 && { if (typeof attachment !== "object") { return null } - return - - - }) - } - + return { + key: index, + children: + + + } + })} + isEnableNavButton + isEnableMouseMove + isEnablePagination + setController={setController} + onSlideChange={setCarouselState} + isDebug + /> + }
}) \ No newline at end of file diff --git a/packages/app/src/components/PostCard/components/attachments/index.less b/packages/app/src/components/PostCard/components/attachments/index.less index bac3e79a..35bb0101 100755 --- a/packages/app/src/components/PostCard/components/attachments/index.less +++ b/packages/app/src/components/PostCard/components/attachments/index.less @@ -1,91 +1,44 @@ .post_attachments { - display: flex; + box-sizing: border-box; - width: 100%; + position: relative; + + display: flex; align-items: center; justify-content: center; - transition: all 0.2s ease-in-out; + width: 100%; + max-width: 100%; - .carousel-root { - position: relative; + overflow-x: hidden; + transition: all 150ms ease-in-out; + + .bear-react-carousel__root { font-family: "DM Mono", monospace; - height: 100%; - width: 100%; + border-radius: 12px; - .carousel { - display: flex; - background-color: black; - border-radius: 8px; + overflow: hidden; - .slider-wrapper { - align-self: center; - } - } + background-color: black; - .control-prev, - .control-next { - color: #ffffff; - - height: 100%; - width: 30px; - - opacity: 0; - - transition: all 150ms ease-in-out; - - &:hover { - opacity: 1; - width: 50px; - } - - &:active { - transform: scale(0.5); - background-color: transparent; - } - - ::before { - font-size: 20px; - } - } - - .control-arrow { - z-index: 50; - } - - .control-dots { + .bear-react-carousel__pagination-group { top: 0; - height: fit-content; - margin: 0; + bottom: unset; - &:hover { - .dot { - height: 8px; - width: 20px; - } - } - - .dot { - transition: all 100ms ease-in; - - height: 3px; - width: 15px; - - border-radius: 2px; - - box-shadow: none; - } + margin-top: 10px; } - .carousel-status { - padding: 10px; + .bear-react-carousel__pagination-group:not([data-page-content="true"]) .bear-react-carousel__pagination-button[data-active] { + background-color: var(--colorPrimary); } } .attachment { + position: relative; + display: flex; flex-direction: column; diff --git a/packages/app/src/components/PostCard/components/header/index.less b/packages/app/src/components/PostCard/components/header/index.less index 9c63576f..c52dd80f 100755 --- a/packages/app/src/components/PostCard/components/header/index.less +++ b/packages/app/src/components/PostCard/components/header/index.less @@ -3,8 +3,6 @@ flex-direction: row; justify-content: space-between; - margin-bottom: 15px; - .user { display: inline-flex; flex-direction: row; diff --git a/packages/app/src/components/PostCard/index.jsx b/packages/app/src/components/PostCard/index.jsx index dde68294..d7800f65 100755 --- a/packages/app/src/components/PostCard/index.jsx +++ b/packages/app/src/components/PostCard/index.jsx @@ -157,15 +157,15 @@ export default class PostCard extends React.PureComponent { return
{ @@ -205,7 +202,6 @@ export default class PostCard extends React.PureComponent { attachments={this.props.data.attachments} /> } -
div { - margin-bottom: 10px; - } } &:first-child { @@ -117,6 +79,5 @@ border-bottom-right-radius: 8px; border-bottom: none; - padding-bottom: 0; } } \ No newline at end of file diff --git a/packages/app/src/components/PostsList/index.jsx b/packages/app/src/components/PostsList/index.jsx index 3e1fffdb..17ff590f 100755 --- a/packages/app/src/components/PostsList/index.jsx +++ b/packages/app/src/components/PostsList/index.jsx @@ -17,7 +17,7 @@ const LoadingComponent = () => { return diff --git a/packages/app/src/components/PostsList/index.less b/packages/app/src/components/PostsList/index.less index 26af603c..ea738c35 100755 --- a/packages/app/src/components/PostsList/index.less +++ b/packages/app/src/components/PostsList/index.less @@ -34,6 +34,8 @@ html { } .post-list_wrapper { + position: relative; + display: flex; flex-direction: column; @@ -42,6 +44,7 @@ html { width: fit-content; //overflow: hidden; + overflow-x: hidden; overflow-y: overlay; height: 100%; @@ -52,7 +55,8 @@ html { position: relative; // WARN: Only use if is a performance issue (If is using virtualized list) - //will-change: transform; + will-change: transform; + overflow: hidden; overflow-y: overlay; @@ -66,17 +70,20 @@ html { border-radius: 8px; - margin: auto; + //margin: auto; z-index: 150; .postCard { width: 100%; - min-width: none; + min-width: 0; + // FIXME: This is a walkaround for a bug when a post contains multiple attachments cause a overflow + max-width: unset; } .playlistTimelineEntry { width: 100%; - min-width: none; + min-width: 0; + max-width: unset; } } @@ -103,8 +110,8 @@ html { justify-content: center; align-items: center; - width: 35vw; - min-width: 300px; + width: 100%; + //min-width: 300px; max-width: 800px; opacity: 0; diff --git a/packages/app/src/theme/index.less b/packages/app/src/theme/index.less index c4e9bde0..3845812e 100755 --- a/packages/app/src/theme/index.less +++ b/packages/app/src/theme/index.less @@ -124,20 +124,40 @@ html { padding-left: 0; padding-right: 0; - @media screen and (max-width:2000px) { - max-width: 1000px; + .post_card { + max-width: 900px; + } + + @media screen and (max-width: 2000px) { + max-width: 1100px; + + .post_card { + max-width: 750px; + } } @media screen and (max-width: 1444px) { max-width: 800px; + + .post_card { + max-width: 550px; + } } @media screen and (max-width: 1170px) { max-width: 700px; + + .post_card { + max-width: 450px; + } } @media screen and (max-width: 1024px) { max-width: 600px; + + .post_card { + max-width: 350px; + } } } }