Commit a7c21989 by asranov0003

refactor: news

parent a513873f
......@@ -2,6 +2,10 @@
padding-top: 60px;
}
.news__title {
margin-bottom: 1rem;
}
.news__list {
display: flex;
flex-direction: column;
......
......@@ -7,12 +7,14 @@ import {
type RootState,
} from "../../stores/store";
import { fetchAllNews } from "../../stores/slices/newsSlice";
import { useTranslation } from "react-i18next";
const News: React.FC = () => {
const { news, isNewsLoading } = useAppSelector(
(state: RootState) => state.news
);
const dispatch = useAppDispatch();
const { t } = useTranslation();
useEffect(() => {
dispatch(fetchAllNews());
......@@ -20,12 +22,18 @@ const News: React.FC = () => {
return (
<div className="news wrapper">
<h3 className="news__title">{t("navs.news")}</h3>
{isNewsLoading && news.length === 0 && (
<div className="cloading__center">
<CLoading />
</div>
)}
{!isNewsLoading && news.length === 0 && (
<p className="news__empty">{t("common.noData")}</p>
)}
<div className="news__list">
{news.map((item) => {
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment