Skip to content

Commit

Permalink
[REFACTOR] CSS for PostCard.tsx (#3006)
Browse files Browse the repository at this point in the history
* refactor css for PostCard.tsx

* code coverage issue fix

* css optimise

* Update src/style/app.module.css

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
hustlernik and coderabbitai[bot] authored Dec 29, 2024
1 parent a36c0ff commit 2e2e8ef
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 195 deletions.
183 changes: 0 additions & 183 deletions src/components/UserPortal/PostCard/PostCard.module.css

This file was deleted.

18 changes: 6 additions & 12 deletions src/components/UserPortal/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
import CommentCard from '../CommentCard/CommentCard';
import { errorHandler } from 'utils/errorHandler';
import useLocalStorage from 'utils/useLocalstorage';
import styles from './PostCard.module.css';
import styles from './../../../style/app.module.css';
import UserDefault from '../../../assets/images/defaultImg.png';

interface InterfaceCommentCardProps {
Expand Down Expand Up @@ -121,13 +121,12 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
postId: props.id,
},
});
/* istanbul ignore next */

if (data) {
setLikes((likes) => likes - 1);
setIsLikedByUser(false);
}
} catch (error: unknown) {
/* istanbul ignore next */
toast.error(error as string);
}
} else {
Expand All @@ -137,13 +136,12 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
postId: props.id,
},
});
/* istanbul ignore next */

if (data) {
setLikes((likes) => likes + 1);
setIsLikedByUser(true);
}
} catch (error: unknown) {
/* istanbul ignore next */
toast.error(error as string);
}
}
Expand Down Expand Up @@ -205,7 +203,6 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
},
});

/* istanbul ignore next */
if (createEventData) {
setCommentInput('');
setNumComments((numComments) => numComments + 1);
Expand All @@ -228,7 +225,6 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
setComments([...comments, newComment]);
}
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
}
};
Expand All @@ -247,7 +243,6 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
toggleEditPost();
toast.success(tCommon('updatedSuccessfully', { item: 'Post' }) as string);
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
}
};
Expand All @@ -264,15 +259,14 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
props.fetchPosts(); // Refresh the posts
toast.success('Successfully deleted the Post.');
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
}
};

return (
<Col key={props.id} className="d-flex justify-content-center my-2">
<Card className={`${styles.cardStyles}`}>
<Card.Header className={`${styles.cardHeader}`}>
<Card.Header className={`${styles.cardHeaderPostCard}`}>
<div className={`${styles.creator}`}>
<AccountCircleIcon className="my-2" />
<p>{postCreator}</p>
Expand Down Expand Up @@ -316,7 +310,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
}
/>
<Card.Body className="pb-0">
<Card.Title className={`${styles.cardTitle}`}>
<Card.Title className={`${styles.cardTitlePostCard}`}>
{props.title}
</Card.Title>
<Card.Subtitle style={{ color: '#808080' }}>
Expand Down Expand Up @@ -355,7 +349,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
</div>
<div className="w-50 p-2 position-relative">
<div className="d-flex justify-content-between align-items-center">
<div className={`${styles.cardHeader} p-0`}>
<div className={`${styles.cardHeaderPostCard} p-0`}>
<AccountCircleIcon className="my-2" />
<p>{postCreator}</p>
</div>
Expand Down
Loading

0 comments on commit 2e2e8ef

Please sign in to comment.