Skip to content

Commit 02af8f1

Browse files
committed
migrating components from platform sources
1 parent 2fe958f commit 02af8f1

File tree

8 files changed

+58
-62
lines changed

8 files changed

+58
-62
lines changed

src/components/SentenceReport/SourceSummaryDisplay.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import React from "react";
2-
import { Typography } from "antd";
2+
import { Typography } from "@mui/material";
33
import { useTranslation } from "next-i18next";
44
import SentenceReportSummary from "./SentenceReportSummary";
55
import AletheiaButton from "../Button";
66

7-
const { Paragraph } = Typography;
8-
97
const SourceSummaryDisplay = ({ href }) => {
108
const { t } = useTranslation();
119

1210
return (
13-
<SentenceReportSummary>
14-
<Paragraph className="sentence-content">
11+
<SentenceReportSummary item>
12+
<Typography variant="body1" className="sentence-content">
1513
<cite>{href}</cite>
16-
</Paragraph>
14+
</Typography>
1715

1816
<AletheiaButton
1917
href={href}

src/components/Source/ClaimSourceList.style.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const ClaimSourceListStyle = styled.div`
99
.source {
1010
display: flex;
1111
flex-direction: column;
12+
font-size: 14px;
1213
}
1314
1415
.all-sources-link-button {

src/components/Source/ClaimSourceList.tsx

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import AletheiaButton, { ButtonType } from "../Button";
2-
import { List, Typography } from "antd";
2+
import { Grid, Typography } from "@mui/material";
33

44
import React from "react";
55
import ClaimSourceListItem from "./ClaimSourceListItem";
@@ -17,46 +17,40 @@ const ClaimSourceList = ({
1717
}) => {
1818
const { t } = useTranslation();
1919
const sourcesGridColumns = 6;
20+
const dataSource = showAllSources
21+
? sources
22+
: sources.slice(0, sourcesGridColumns);
2023

2124
return (
2225
<ClaimSourceListStyle>
2326
{sources && (
24-
<List
25-
dataSource={
26-
showAllSources
27-
? sources
28-
: sources.slice(0, sourcesGridColumns)
29-
}
30-
style={{ width: "100%" }}
31-
grid={{
32-
gutter: 38,
33-
xs: 1,
34-
sm: 2,
35-
md: 2,
36-
lg: 3,
37-
xl: 3,
38-
xxl: 3,
39-
}}
40-
renderItem={(source, index) => {
41-
return (
27+
<Grid container style={{ width: '100%' }}>
28+
{dataSource.map((source, index) => (
29+
<Grid
30+
item
31+
xs={12}
32+
sm={6}
33+
md={6}
34+
lg={4}
35+
key={source}
36+
>
4237
<ClaimSourceListItem
43-
key={index}
4438
source={source}
4539
index={index + 1}
4640
/>
47-
);
48-
}}
49-
/>
41+
</Grid>
42+
))}
43+
</Grid>
5044
)}
5145
{!showAllSources && sources?.length > sourcesGridColumns && (
5246
<AletheiaButton
5347
type={ButtonType.blue}
5448
href={seeMoreHref}
5549
className="all-sources-link-button"
5650
>
57-
<Typography.Title level={4} className="all-sources-link">
51+
<Typography variant="h4" className="all-sources-link">
5852
{t("claim:seeSourcesButton")}
59-
</Typography.Title>
53+
</Typography>
6054
</AletheiaButton>
6155
)}
6256
</ClaimSourceListStyle>

src/components/Source/ClaimSourceListItem.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
import { Col, List } from "antd";
1+
import { Grid, ListItem } from "@mui/material";
22

33
import React from "react";
44

55
const ClaimSourceListItem = ({ source, index }) => {
66
const { href } = source;
77

88
return (
9-
<Col className="source">
9+
<Grid item className="source">
1010
{typeof source === "object" ? (
11-
<List.Item id={source?.props?.targetText || source?.targetText}>
11+
<ListItem id={source?.props?.targetText || source?.targetText}>
1212
<span style={{ marginRight: 4 }}>
1313
{source?.props?.sup || source?.sup || index}.
1414
</span>
1515
<a href={href} target="_blank" rel="noopener noreferrer">
1616
{href}
1717
</a>
18-
</List.Item>
18+
</ListItem>
1919
) : (
20-
<List.Item id={source}>
20+
<ListItem id={source}>
2121
{/* TODO: Remove this ternary when source migration is done */}
2222
{index}.{" "}
2323
<a href={source} target="_blank" rel="noopener noreferrer">
2424
{source}
2525
</a>
26-
</List.Item>
26+
</ListItem>
2727
)}
28-
</Col>
28+
</Grid>
2929
);
3030
};
3131

src/components/Source/CreateSource/CreateSourceView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from "react";
2-
import { Col, Row } from "antd";
2+
import { Grid } from "@mui/material";
33
import colors from "../../../styles/colors";
44
import DynamicSourceForm from "./DynamicSourceForm";
55

66
const CreateSourceView = () => {
77
return (
8-
<Row justify="center" style={{ background: colors.lightNeutral }}>
9-
<Col span={18}>
8+
<Grid container justifyContent="center" style={{ background: colors.lightNeutral }}>
9+
<Grid item xs={9}>
1010
<DynamicSourceForm />
11-
</Col>
12-
</Row>
11+
</Grid>
12+
</Grid>
1313
);
1414
};
1515

src/components/Source/SourceList.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SourceApi from "../../api/sourceApi";
33
import BaseList from "../List/BaseList";
44
import SourceSkeleton from "../Skeleton/SourceSkeleton";
55
import SourceListItem from "./SourceListItem";
6-
import { Col, Row } from "antd";
6+
import { Grid } from "@mui/material";
77
import { useTranslation } from "next-i18next";
88
import { useAtom } from "jotai";
99
import { currentNameSpace } from "../../atoms/namespace";
@@ -14,8 +14,8 @@ const SourceList = ({ footer = false }) => {
1414
const [nameSpace] = useAtom(currentNameSpace);
1515

1616
return (
17-
<Row justify="center">
18-
<Col span={18}>
17+
<Grid container justifyContent="center">
18+
<Grid item xs={9} sm={12} lg={10}>
1919
<BaseList
2020
apiCall={SourceApi.get}
2121
filter={{ nameSpace }}
@@ -34,8 +34,8 @@ const SourceList = ({ footer = false }) => {
3434
emptyFallback={<SourceCreateCTA />}
3535
footer={footer && <SourceCreateCTA />}
3636
/>
37-
</Col>
38-
</Row>
37+
</Grid>
38+
</Grid>
3939
);
4040
};
4141
export default SourceList;

src/components/Source/SourceListItem.style.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import colors from "../../styles/colors";
22
import styled from "styled-components";
33
import reviewColors from "../../constants/reviewColors";
4-
import { Col } from "antd";
4+
import { Grid } from "@mui/material";
55

6-
const SourceListItemStyled = styled(Col)`
6+
const SourceListItemStyled = styled(Grid)`
77
display: flex;
88
flex-direction: column;
99
gap: 16px;
@@ -13,6 +13,7 @@ const SourceListItemStyled = styled(Col)`
1313
font-weight: 600;
1414
color: ${colors.primary};
1515
margin: 0;
16+
width: 100%;
1617
}
1718
1819
.title ::before {

src/components/Source/SourceListItem.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React, { useMemo } from "react";
2-
import { Col, Typography } from "antd";
2+
import { Grid, Typography } from "@mui/material";
33
import CardBase from "../CardBase";
44
import AletheiaButton from "../Button";
55
import { useTranslation } from "next-i18next";
66
import SourceListItemStyled from "./SourceListItem.style";
77
import ReviewClassification from "../ClaimReview/ReviewClassification";
8-
const { Paragraph } = Typography;
98
const DOMAIN_PROTOCOL_REGEX = /^(https?:\/\/)?(www\.)?/;
109

1110
const SourceListItem = ({ source }) => {
@@ -22,25 +21,28 @@ const SourceListItem = ({ source }) => {
2221

2322
return (
2423
<CardBase style={{ padding: "32px" }}>
25-
<SourceListItemStyled
26-
span={24}
24+
<SourceListItemStyled container
25+
xs={12}
2726
classification={source.props.classification}
2827
>
2928
<h4 className="title">{title}</h4>
3029

31-
<Paragraph
32-
style={{ marginBottom: 0 }}
33-
ellipsis={{
34-
rows: 4,
35-
expandable: false,
30+
<Typography
31+
variant="body1"
32+
sx={{
33+
display: "-webkit-box",
34+
overflow: "hidden",
35+
WebkitBoxOrient: "vertical",
36+
WebkitLineClamp: 4,
37+
textOverflow: "ellipsis",
3638
}}
3739
>
3840
<cite style={{ fontStyle: "normal" }}>
3941
<p className="summary">{source.props.summary}</p>
4042
</cite>
41-
</Paragraph>
43+
</Typography>
4244

43-
<Col className="footer">
45+
<Grid item className="footer">
4446
<ReviewClassification
4547
label={t("sources:sourceReview")}
4648
classification={source.props.classification}
@@ -53,7 +55,7 @@ const SourceListItem = ({ source }) => {
5355
>
5456
{t("sources:sourceCardButton")}
5557
</AletheiaButton>
56-
</Col>
58+
</Grid>
5759
</SourceListItemStyled>
5860
</CardBase>
5961
);

0 commit comments

Comments
 (0)