Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix post alignment #1131

Merged
merged 4 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Post/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
}

.post__background {
min-height: 350px;
/* min-height: 350px; */
height: 350px;
background: linear-gradient(
130deg,
#dee2ed,
Expand Down
83 changes: 7 additions & 76 deletions src/reusableComponents/ImageSlider/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
display: flex;
justify-content: center;
margin: 0 auto;
/* min-height: 300px; */
height: 350px;
/* min-width: 300px; */
/* max-width: 350px; */
position: relative;
/* width: 100%; */
/* object-fit:scale-down; */
overflow: hidden;
/* aspect-ratio: 16/1; */
border-bottom: 2px solid #eee;
}

.post__image {
width: 100% !important;
height: 100%;
object-fit: cover;
}

.slide {
Expand Down Expand Up @@ -42,7 +43,6 @@

.slider-action {
display: flex;
/*height: 100%;*/
justify-content: space-between;
position: absolute;
width: 90%;
Expand All @@ -59,77 +59,8 @@
width: 5%;
}

/*.chevron:hover, .circle:hover {*/
/* !*color: #ab4bc2;*!*/
/* transform: scale(1.2);*/
/*}*/

.chevron:active,
.circle:active {
transform: scale(1);
z-index: 9;
}

/*.overlay {*/
/* position: absolute;*/
/* top: 0;*/
/* left: 0;*/
/* width: 100%;*/
/* height: 100%;*/
/* background-color: rgba(0, 0, 0, 0.5);*/
/* z-index: 1;*/
/* opacity: 0;*/
/* transition: opacity 0.3s ease;*/
/*}*/

/*.slide:hover .overlay {*/
/* opacity: 1;*/
/*}*/

/*.overlay-content {*/
/* position: absolute;*/
/* top: 50%;*/
/* left: 50%;*/
/* transform: translate(-50%, -50%);*/
/* text-align: center;*/
/* color: white;*/
/*}*/

/*.overlay-content h3 {*/
/* font-size: 24px;*/
/* margin-bottom: 10px;*/
/*}*/

/*.overlay-content p {*/
/* font-size: 16px;*/
/*}*/

/*.slide-button {*/
/* position: absolute;*/
/* top: 50%;*/
/* transform: translateY(-50%);*/
/* width: 40px;*/
/* height: 40px;*/
/* border-radius: 50%;*/
/* background-color: #ab4bc2;*/
/* display: flex;*/
/* justify-content: center;*/
/* align-items: center;*/
/* color: white;*/
/* font-size: 20px;*/
/* cursor: pointer;*/
/* opacity: 0;*/
/* transition: opacity 0.3s ease;*/
/*}*/

/*.slide-button:hover {*/
/* opacity: 1;*/
/*}*/

/*.slide-button.left {*/
/* left: 20px;*/
/*}*/

/*.slide-button.right {*/
/* right: 20px;*/
/*}*/
87 changes: 36 additions & 51 deletions src/reusableComponents/ImageSlider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { LazyLoadImage } from "react-lazy-load-image-component";
const ImageSlider = ({ slides, doubleClickHandler }) => {
const [current, setCurrent] = useState(0);

//destructure slides.length to get const { length } = slides;

const prevStep = () => {
setCurrent(current === 0 ? slides.length - 1 : current - 1);
};
Expand All @@ -22,58 +20,45 @@ const ImageSlider = ({ slides, doubleClickHandler }) => {
setTimeout(nextStep, 1000);
}, [slides]);

// useEffect(() => {
// setTimeout(() => setCurrent(current + 1), 1000);
// }, [slides]);

return slides.length ? (
<div className="slider" onDoubleClick={doubleClickHandler}>
{slides.map(({ imageUrl, thumbnail }, index) => (
<div
style={{
display: index === current ? "contents" : "none",
width: "100%",
}}
className={index === current ? "slide active" : "slide"}
key={index}
>
<LazyLoadImage
className="image"
src={imageUrl}
placeholderSrc={thumbnail}
effect="blur"
alt={" upload"}
delayTime={1000}
return (
slides.length > 0 && (
<div className="slider" onDoubleClick={doubleClickHandler}>
{slides.map(({ imageUrl, thumbnail }, index) => (
<div
style={{
display: index === current ? "contents" : "none",
width: "100%",
height: "100%",
objectFit: "contain",
}}
/>
{slides.length > 1 ? (
<div className={"slider-action"}>
<FaChevronCircleLeft
className="circle"
onClick={prevStep}
title={"View Previous Image"}
// style={isCommentBox ? {width: "60%"} : {width: "60%"}}
/>
<FaChevronCircleRight
className="chevron"
onClick={nextStep}
title={"View Next Image"}
// style={isCommentBox ? {width: "60%"} : {width: "60%"}}
/>
</div>
) : (
<></>
)}
</div>
))}
</div>
) : null;
className={index === current ? "slide active" : "slide"}
key={index}
>
<LazyLoadImage
className="image post__image"
src={imageUrl}
placeholderSrc={thumbnail}
effect="blur"
alt={" upload"}
delayTime={1000}
/>
{slides.length > 1 && (
<div className={"slider-action"}>
<FaChevronCircleLeft
className="circle"
onClick={prevStep}
title={"View Previous Image"}
/>
<FaChevronCircleRight
className="chevron"
onClick={nextStep}
title={"View Next Image"}
/>
</div>
)}
</div>
))}
</div>
)
);
};

export default ImageSlider;

// className={index === current ? "slide active" : "slide"}
Loading