From f9109bbf1cd1600e77d78f591e8fc11434a5d7ae Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Sun, 15 Dec 2024 22:49:19 +0100 Subject: [PATCH] Adaptation Grid/mui for Col/antd --- src/components/Claim/ClaimSummaryContent.tsx | 6 +-- .../Claim/CreateClaim/ClaimSelectType.tsx | 6 +-- src/components/ClaimReview/ReviewAlert.tsx | 6 +-- src/components/ClaimReview/ReviewCard.tsx | 22 +++++------ .../Comment/CommentPopoverContent.tsx | 6 +-- .../Components/SourceEditorButton.tsx | 8 ++-- .../Collaborative/Form/EditorCard.tsx | 8 ++-- .../Collaborative/Form/QuestionCard.tsx | 9 +++-- src/components/Dashboard/DashboardView.tsx | 14 +++---- .../Footer/AletheiaSocialMediaIcons.tsx | 7 ++-- src/components/Header/HeaderActions.style.tsx | 4 +- src/components/Header/HeaderContent.tsx | 2 +- src/components/Home/CTA/CTASectionButtons.tsx | 21 +++++----- src/components/Home/CTA/CTASectionTitle.tsx | 6 +-- src/components/Home/DonationBanner.style.tsx | 11 ++++-- src/components/Home/DonationBanner.tsx | 38 +++++++++---------- src/components/Home/HomeFeed.tsx | 10 ++--- .../Home/HomeHeader/HomeHeader.style.tsx | 2 +- src/components/Home/HomeStats.tsx | 14 +++---- src/components/LoginButton.tsx | 6 +-- .../adminArea/Drawer/HeaderTotpStatus.tsx | 4 +- .../adminArea/Drawer/HeaderUserStatus.tsx | 4 +- 22 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/components/Claim/ClaimSummaryContent.tsx b/src/components/Claim/ClaimSummaryContent.tsx index 482d50ab1..a1753b325 100644 --- a/src/components/Claim/ClaimSummaryContent.tsx +++ b/src/components/Claim/ClaimSummaryContent.tsx @@ -1,5 +1,5 @@ import colors from "../../styles/colors"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import React from "react"; import { useTranslation } from "next-i18next"; import { ContentModelEnum } from "../../types/enums"; @@ -56,7 +56,7 @@ const ClaimSummaryContent = ({ : {}; return ( - + - + ); }; diff --git a/src/components/Claim/CreateClaim/ClaimSelectType.tsx b/src/components/Claim/CreateClaim/ClaimSelectType.tsx index b8bb8b87e..ac40a26ab 100644 --- a/src/components/Claim/CreateClaim/ClaimSelectType.tsx +++ b/src/components/Claim/CreateClaim/ClaimSelectType.tsx @@ -3,7 +3,7 @@ import { PictureOutlined, VideoCameraOutlined, } from "@ant-design/icons"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { useAtom } from "jotai"; import { useTranslation } from "next-i18next"; @@ -53,7 +53,7 @@ const ClaimSelectType = () => {

- { {t(`claimForm:${key}`)} ))} - + ); }; diff --git a/src/components/ClaimReview/ReviewAlert.tsx b/src/components/ClaimReview/ReviewAlert.tsx index 7720f4554..3b3594c0c 100644 --- a/src/components/ClaimReview/ReviewAlert.tsx +++ b/src/components/ClaimReview/ReviewAlert.tsx @@ -1,4 +1,4 @@ -import { Col } from "antd"; +import { Grid } from "@mui/material"; import React, { useContext, useEffect, useState } from "react"; import AletheiaAlert from "../AletheiaAlert"; import { useTranslation } from "next-i18next"; @@ -107,7 +107,7 @@ const ReviewAlert = ({ isHidden, isPublished, hideDescription }) => { return ( <> {alert.show && ( - { description={alert.description} showIcon={true} /> - + )} ); diff --git a/src/components/ClaimReview/ReviewCard.tsx b/src/components/ClaimReview/ReviewCard.tsx index c3472354b..5ba16e17e 100644 --- a/src/components/ClaimReview/ReviewCard.tsx +++ b/src/components/ClaimReview/ReviewCard.tsx @@ -1,7 +1,7 @@ import React from "react"; import PersonalityMinimalCard from "../Personality/PersonalityMinimalCard"; import CardBase from "../CardBase"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { useTranslation } from "next-i18next"; import reviewColors from "../../constants/reviewColors"; import TagsList from "../topics/TagsList"; @@ -68,15 +68,15 @@ const ReviewCard = ({ review, summarized = false }) => { {!summarized && personalityItem && ( - + - + )} - - + + { classificationTextStyle={{ fontSize: 16 }} /> )} - - + + {content?.props?.classification && (
{ linkText={t(linkText)} style={{ fontSize: 18 }} /> - + - + { > {t("home:reviewsCarouselOpen")} - - + + ); diff --git a/src/components/Collaborative/Comment/CommentPopoverContent.tsx b/src/components/Collaborative/Comment/CommentPopoverContent.tsx index 71a1ed126..5fa22a72d 100644 --- a/src/components/Collaborative/Comment/CommentPopoverContent.tsx +++ b/src/components/Collaborative/Comment/CommentPopoverContent.tsx @@ -1,13 +1,13 @@ import React from "react"; import Button, { ButtonType } from "../../Button"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import DeleteIcon from "@mui/icons-material/Delete"; import { useTranslation } from "react-i18next"; const CommentPopoverContent = ({ handleDeleteClick }) => { const { t } = useTranslation(); return ( - + - + ); }; diff --git a/src/components/Collaborative/Components/SourceEditorButton.tsx b/src/components/Collaborative/Components/SourceEditorButton.tsx index 921cac94b..8341afca8 100644 --- a/src/components/Collaborative/Components/SourceEditorButton.tsx +++ b/src/components/Collaborative/Components/SourceEditorButton.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useContext, useState } from "react"; import AletheiaButton from "../../Button"; import { Col } from "antd"; +import { Grid } from "@mui/material"; import SummarizationApi from "../../../api/summarizationApi"; import { useTranslation } from "next-i18next"; import { VisualEditorContext } from "../VisualEditorProvider"; @@ -42,8 +43,9 @@ const SourceEditorButton = ({ manager, state, readonly }) => { }, [manager, state.doc]); return ( - { > {t("sourceForm:summarizeSouce")} - + ); }; diff --git a/src/components/Collaborative/Form/EditorCard.tsx b/src/components/Collaborative/Form/EditorCard.tsx index 84b656972..3f9054e61 100644 --- a/src/components/Collaborative/Form/EditorCard.tsx +++ b/src/components/Collaborative/Form/EditorCard.tsx @@ -1,6 +1,6 @@ import React from "react"; import { uniqueId } from "remirror"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import CardStyle from "./CardStyle"; interface EditorCardProps { @@ -17,13 +17,13 @@ const EditorCard = ({ dataCy, forwardRef, extra, - span = 24, + span = 12, inputSize = 100, }: EditorCardProps) => { return ( - +

- +
{extra}
); diff --git a/src/components/Collaborative/Form/QuestionCard.tsx b/src/components/Collaborative/Form/QuestionCard.tsx index 6662d3f7b..7e4e87ec5 100644 --- a/src/components/Collaborative/Form/QuestionCard.tsx +++ b/src/components/Collaborative/Form/QuestionCard.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useContext } from "react"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import Button from "../../Button"; import { useCommands } from "@remirror/react"; import { DeleteOutlined } from "@ant-design/icons"; @@ -29,11 +29,12 @@ const QuestionCard = ({ forwardRef, node, initialPosition }) => { + - + } /> ); diff --git a/src/components/Dashboard/DashboardView.tsx b/src/components/Dashboard/DashboardView.tsx index fdb7581b6..38535bfe4 100644 --- a/src/components/Dashboard/DashboardView.tsx +++ b/src/components/Dashboard/DashboardView.tsx @@ -4,7 +4,7 @@ import personalitiesApi from "../../api/personality"; import { useTranslation } from "next-i18next"; import PersonalityCard from "../Personality/PersonalityCard"; import PersonalitySkeleton from "../Skeleton/PersonalitySkeleton"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import ClaimSkeleton from "../Skeleton/ClaimSkeleton"; import claimApi from "../../api/claim"; import ClaimCard from "../Claim/ClaimCard"; @@ -17,7 +17,7 @@ const DashboardView = () => { return ( - + { } skeleton={} /> - + - + { } skeleton={} /> - + - + { } skeleton={} /> - + ); }; diff --git a/src/components/Footer/AletheiaSocialMediaIcons.tsx b/src/components/Footer/AletheiaSocialMediaIcons.tsx index 3d9d5a03e..ee79ecb28 100644 --- a/src/components/Footer/AletheiaSocialMediaIcons.tsx +++ b/src/components/Footer/AletheiaSocialMediaIcons.tsx @@ -4,12 +4,13 @@ import colors from "../../styles/colors"; import { NameSpaceEnum } from "../../types/Namespace"; import { useAtom } from "jotai"; import { currentNameSpace } from "../../atoms/namespace"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; const AletheiaSocialMediaIcons = () => { const [nameSpace] = useAtom(currentNameSpace); return ( - + { rel="noreferrer" fgColor="white" /> - + ) } diff --git a/src/components/Header/HeaderActions.style.tsx b/src/components/Header/HeaderActions.style.tsx index a2533c6b2..e7bf1f80e 100644 --- a/src/components/Header/HeaderActions.style.tsx +++ b/src/components/Header/HeaderActions.style.tsx @@ -1,8 +1,8 @@ import styled from "styled-components"; import { queries } from "../../styles/mediaQueries"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; -const HeaderActionsStyle = styled(Col)` +const HeaderActionsStyle = styled(Grid)` display: flex; align-items: flex-end; justify-content: space-evenly; diff --git a/src/components/Header/HeaderContent.tsx b/src/components/Header/HeaderContent.tsx index ec1ec1675..7c8b8b91f 100644 --- a/src/components/Header/HeaderContent.tsx +++ b/src/components/Header/HeaderContent.tsx @@ -68,7 +68,7 @@ const HeaderContent = () => { - + {vw?.xs && !router.pathname.includes("/home-page") && ( { }; return ( - {!isLoggedIn && ( - + - + )} {!smallDevice && ( - + {localConfig.header.donateButton.show ? ( ) : null} - + )} - + ); }; diff --git a/src/components/Home/CTA/CTASectionTitle.tsx b/src/components/Home/CTA/CTASectionTitle.tsx index 41cf69d6c..a9cbde1b8 100644 --- a/src/components/Home/CTA/CTASectionTitle.tsx +++ b/src/components/Home/CTA/CTASectionTitle.tsx @@ -1,4 +1,4 @@ -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { useTranslation } from "next-i18next"; import React from "react"; import { isUserLoggedIn } from "../../../atoms/currentUser"; @@ -9,9 +9,9 @@ const CTASectionTitle = () => { const [isLoggedIn] = useAtom(isUserLoggedIn); return ( - +

{t("home:statsFooter")}

- +
); }; diff --git a/src/components/Home/DonationBanner.style.tsx b/src/components/Home/DonationBanner.style.tsx index 220fb428a..209c24563 100644 --- a/src/components/Home/DonationBanner.style.tsx +++ b/src/components/Home/DonationBanner.style.tsx @@ -1,10 +1,13 @@ import styled from "styled-components"; import colors from "../../styles/colors"; +import { Grid } from "@mui/material"; import { Col } from "antd"; import { queries } from "../../styles/mediaQueries"; -const DonationBannerStyle = styled(Col)` - background-color: ${colors.inactive}; + +const DonationBannerStyle = styled(Grid)` + background-color: ${colors.inactive}; + position: relative; .close-banner { color: ${colors.primary}; @@ -12,7 +15,7 @@ const DonationBannerStyle = styled(Col)` align-self: flex-end; position: absolute; right: 10px; - bottom: -10px; + bottom: 10px; z-index: 1; } @@ -67,7 +70,7 @@ const DonationBannerStyle = styled(Col)` .close-banner { align-self: flex-start; - top: -10px; + top: 10px; } } `; diff --git a/src/components/Home/DonationBanner.tsx b/src/components/Home/DonationBanner.tsx index a93ac1553..828d56248 100644 --- a/src/components/Home/DonationBanner.tsx +++ b/src/components/Home/DonationBanner.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import DonationBannerContent from "./DonationBanner/DonationBannerContent"; import DonationBannerStyle from "./DonationBanner.style"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import Cookies from "js-cookie"; import CloseOutlined from "@mui/icons-material/CloseOutlined"; @@ -27,25 +27,23 @@ const DonationBanner = () => { return null; } - return ( - showDonationBanner && ( - - - - closeBanner(() => setDonationBanner(false)) - } - /> - - closeBanner(() => setDonationBanner(false)) - } - /> - - - ) - ); + if (!enableDonationBanner) { + return null + }; + + return showDonationBanner && ( + + + closeBanner(() => setDonationBanner(false))} + /> + closeBanner(() => setDonationBanner(false))} + /> + + + ) }; export default DonationBanner; diff --git a/src/components/Home/HomeFeed.tsx b/src/components/Home/HomeFeed.tsx index 70babc4e4..29de5f810 100644 --- a/src/components/Home/HomeFeed.tsx +++ b/src/components/Home/HomeFeed.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { useTranslation } from "next-i18next"; import claimRevisionApi from "../../api/claimRevision"; import Loading from "../Loading"; @@ -50,10 +50,10 @@ const HomeFeed = ({ searchResults }) => { return ( <> {results.length > 0 && ( - +

{t("home:homeFeedTitle")}

- { }} > - - +
+ )} ); diff --git a/src/components/Home/HomeHeader/HomeHeader.style.tsx b/src/components/Home/HomeHeader/HomeHeader.style.tsx index 0ad69b099..c717fe2b6 100644 --- a/src/components/Home/HomeHeader/HomeHeader.style.tsx +++ b/src/components/Home/HomeHeader/HomeHeader.style.tsx @@ -16,7 +16,7 @@ const HomeHeaderStyle = styled(Col)` display: flex; flex-direction: column; width: 100%; - align-items: center; + align-items: start; } .home-header-title > h1 { diff --git a/src/components/Home/HomeStats.tsx b/src/components/Home/HomeStats.tsx index 93527409d..2ce054e30 100644 --- a/src/components/Home/HomeStats.tsx +++ b/src/components/Home/HomeStats.tsx @@ -2,23 +2,21 @@ import React from "react"; import { useTranslation } from "next-i18next"; import colors from "../../styles/colors"; import { Stats } from "./Stats"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; const HomeStats = ({ stats }) => { const { t } = useTranslation(); return ( - { title={t("home:statsClaimReviews")} style={{ justifyContent: "flex-end" }} /> - + ); }; diff --git a/src/components/LoginButton.tsx b/src/components/LoginButton.tsx index 46c4a1cb4..a44f25a80 100644 --- a/src/components/LoginButton.tsx +++ b/src/components/LoginButton.tsx @@ -1,4 +1,4 @@ -import { Col } from "antd"; +import { Grid } from "@mui/material"; import React from "react"; import { useTranslation } from "next-i18next"; import Button from "./Button"; @@ -7,7 +7,7 @@ const LoginButton = () => { const { t } = useTranslation(); return ( - { }} > - + ); }; diff --git a/src/components/adminArea/Drawer/HeaderTotpStatus.tsx b/src/components/adminArea/Drawer/HeaderTotpStatus.tsx index ae08fd484..6b9511c56 100644 --- a/src/components/adminArea/Drawer/HeaderTotpStatus.tsx +++ b/src/components/adminArea/Drawer/HeaderTotpStatus.tsx @@ -1,10 +1,10 @@ import React from "react"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { useTranslation } from "next-i18next"; import styled from "styled-components"; import colors from "../../../styles/colors"; -const HeaderTotpStatusStyle = styled(Col)` +const HeaderTotpStatusStyle = styled(Grid)` ::before { content: ""; display: inline-block; diff --git a/src/components/adminArea/Drawer/HeaderUserStatus.tsx b/src/components/adminArea/Drawer/HeaderUserStatus.tsx index 28895fef8..ee2646d11 100644 --- a/src/components/adminArea/Drawer/HeaderUserStatus.tsx +++ b/src/components/adminArea/Drawer/HeaderUserStatus.tsx @@ -1,11 +1,11 @@ import React from "react"; -import { Col } from "antd"; +import { Grid } from "@mui/material"; import { Status } from "../../../types/enums"; import { useTranslation } from "next-i18next"; import styled from "styled-components"; import colors from "../../../styles/colors"; -const HeaderStatusStyle = styled(Col)` +const HeaderStatusStyle = styled(Grid)` ::before { content: ""; display: inline-block;