Skip to content

Commit

Permalink
Merge pull request #1178 from deepa-s-13/Dev-2.0
Browse files Browse the repository at this point in the history
OBPAS: Added view more button for lengthy comments in Timeline
  • Loading branch information
sriranjan-s authored Jul 4, 2024
2 parents c87adfb + d37e9ea commit e0b2eed
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import React,{useState} from "react";
import { useTranslation } from "react-i18next";
import { TelePhone, DisplayPhotos } from "@upyog/digit-ui-react-components";
import BPAReason from "./BPAReason";

const BPACaption = ({ data,OpenImage }) => {
const { t } = useTranslation();
const [viewMore, setviewMore] = useState(false);
return (
<div>
{data.date && <p>{data.date}</p>}
Expand All @@ -16,7 +17,34 @@ const BPACaption = ({ data,OpenImage }) => {
{data?.wfComment ? <div>{data?.wfComment?.map( e =>
<div className="TLComments">
<h3>{t("WF_COMMON_COMMENTS")}</h3>
<p>{e}</p>
{!viewMore && (
<div>
<p style={{overflow:"hidden", textOverflow:"ellipsis",display:"-webkit-box", WebkitLineClamp:1, WebkitBoxOrient:"vertical"}}>{e}</p>
{e.length>36?(<button
type="button"
onClick={() => {
setviewMore(true);
}}
style={{color:"#800000"}}
>
{t("View More")}
</button>):null}
</div>
)}
{viewMore && (
<div >
<p style={{overflow:"visible"}}>{e}</p>
<button
type="button"
onClick={() => {
setviewMore(false);
}}
style={{color:"#800000"}}
>
{t("View Less")}
</button>
</div>
)}
</div>
)}</div> : null}
{data?.thumbnailsToShow?.thumbs?.length > 0 ? <div className="TLComments">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import React,{useState} from "react";
import { useTranslation } from "react-i18next";
import { TelePhone, DisplayPhotos, UnMaskComponent } from "@upyog/digit-ui-react-components";
import Reason from "./Reason";

const TLCaption = ({ data,OpenImage,privacy={}}) => {

const [viewMore, setviewMore] = useState(false);
const { t } = useTranslation();
return (
<div>
Expand All @@ -18,8 +19,36 @@ const TLCaption = ({ data,OpenImage,privacy={}}) => {
{data.comment && <Reason otherComment={data?.otherComment} headComment={data?.comment}></Reason>}
{data?.wfComment ? <div>{data?.wfComment?.map( e =>
<div className="TLComments">
<h3>{t("WF_COMMON_COMMENTS")}</h3>
<p style={{overflowX:"scroll"}}>{e}</p>
<h3>{t("WF_COMMON_COMMENTS")}</h3>
{!viewMore && (
<div>
<p style={{overflow:"hidden", textOverflow:"ellipsis",display:"-webkit-box", WebkitLineClamp:1, WebkitBoxOrient:"vertical"}}>{e}</p>
{e.length>36?(<button
type="button"
onClick={() => {
setviewMore(true);
}}
style={{color:"#800000"}}
>
{t("View More")}
</button>):null}
</div>
)}
{viewMore && (
<div >
<p style={{overflow:"visible"}}>{e}</p>
<button
type="button"
onClick={() => {
setviewMore(false);
}}
style={{color:"#800000"}}
>
{t("View Less")}
</button>
</div>
)}

</div>
)}</div> : null}
{data?.thumbnailsToShow?.thumbs?.length > 0 ? <div className="TLComments">
Expand Down

0 comments on commit e0b2eed

Please sign in to comment.