Skip to content

Commit

Permalink
πŸ€ Fixed: BroadCasts UI (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamgaur99 authored Jul 27, 2024
1 parent 884cee3 commit 0a946e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from "react";
import ReactCardFlip from "react-card-flip";
import { Modals } from "../../Carousel/Modal/index.js";
import style from "./card.module.scss";
import DOMPurify from "dompurify";

export function Card(props) {
let dark = props.theme;
Expand Down Expand Up @@ -39,6 +40,12 @@ export function Card(props) {
"December",
];

const sanitizedContent = DOMPurify.sanitize(props.project.content);
const truncatedContent =
sanitizedContent.length > 250
? sanitizedContent.substring(0, 250) + "..."
: sanitizedContent;

return (
<div id={props.id} className={style["card-container"]}>
<Modals theme={dark} open={open} handleClose={handleClose} data={data} />
Expand All @@ -53,7 +60,10 @@ export function Card(props) {
>
<div className={style["clickable-card"]}>
<div className={style["card-title"]}>{props.project.title}</div>
<div className={style["card-content"]} dangerouslySetInnerHTML={{__html: props.project.content}} />
<div
className={style["card-content"]}
dangerouslySetInnerHTML={{ __html: truncatedContent }}
/>
<div className={style["card-date"]}>
{months[date.getMonth()]},{date.getFullYear()}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
text-align: center;
font-size: 1.2rem;
width: 100%;
word-wrap: break-word;
overflow-wrap: break-word;
display: inline-block;
}

.card-item-light:hover {
Expand Down

0 comments on commit 0a946e5

Please sign in to comment.