Skip to content

Commit

Permalink
Merge pull request #417 from Ashutosh-1302/master
Browse files Browse the repository at this point in the history
Fixed: Added feature that notices without url or link will not redirect anywhere and behave like text
  • Loading branch information
Ashutosh-1302 authored Nov 30, 2023
2 parents cb46c5e + 5d6868d commit c906179
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions src/components/home/notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,42 @@ const BlinkingText = styled.span`
`

const Notice = props => {
// const newtime = new Date().getTime()

// let d = Math.round((newtime - props.time) / 3600000)
// if (d > 48) {
// d = new Date(props.time).toLocaleDateString()
// } else if (d > 24) {
// d = `${Math.round(d / 24)} days ago`
// } else if (d < 1) {
// d = `Just now`
// } else if (d < 2) {
// d = `${d} hour ago`
// } else {
// d = `${d} hours ago`
// }
return (
<>
<NoticeStyle>
<p className="noticecarddetail">
{props.imp == 1 ? <img id="flag" src={flag} alt="f" /> : ""}
{props.imp == 1 ? (
<a
href={props.link}
rel="noopener noreferrer"
target="_blank"
style={{ color: "#941b0c", fontWeight: "bold" }}
>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</a>
) : (
""
)}
{props.imp != 1 ? (
{props.imp === 1 ? <img id="flag" src={flag} alt="f" /> : ""}
{props.imp === 1 ? (
props.link ? (
<a
href={props.link}
rel="noopener noreferrer"
target="_blank"
style={{ color: "#941b0c", fontWeight: "bold" }}
>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</a>
) : (
<span style={{ color: "#941b0c", fontWeight: "bold" }}>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</span>
)
) : props.link ? (
<a href={props.link} rel="noopener noreferrer" target="_blank">
{" "}
{props.detail}
</a>
) : (
""
<span>{props.detail}</span>
)}
</p>
<div>
{props.attachments.map(elem => {
{props.attachments.map((elem, index) => {
if (elem.url)
return (
<ul>
<ul key={index}>
<img id="notdownimg" src={downimg} alt="c" />
<a
className="notdown"
Expand All @@ -80,13 +70,12 @@ const Notice = props => {
</a>
</ul>
)
return null
})}
{/* <div>
<p className="notet">{d}</p>
</div> */}
</div>
</NoticeStyle>
</>
)
}

export default Notice

0 comments on commit c906179

Please sign in to comment.