Small component extraction

This commit is contained in:
Willian Mitsuda 2021-07-14 16:17:27 -03:00
parent f3213b3c69
commit 4c72fd6966
3 changed files with 18 additions and 14 deletions

View File

@ -16,6 +16,7 @@ import StandardFrame from "./StandardFrame";
import StandardSubtitle from "./StandardSubtitle";
import Tab from "./components/Tab";
import ContentFrame from "./ContentFrame";
import InfoRow from "./components/InfoRow";
import BlockLink from "./components/BlockLink";
import AddressHighlighter from "./components/AddressHighlighter";
import AddressOrENSName from "./components/AddressOrENSName";
@ -364,15 +365,4 @@ const Transaction: React.FC = () => {
);
};
type InfoRowProps = {
title: string;
};
const InfoRow: React.FC<InfoRowProps> = ({ title, children }) => (
<div className="grid grid-cols-4 py-4 text-sm">
<div>{title}:</div>
<div className="col-span-3">{children}</div>
</div>
);
export default React.memo(Transaction);

View File

@ -1,9 +1,9 @@
import React from "react";
import { useSelectionContext } from "../useSelection";
type AddressHighlighterProps = {
type AddressHighlighterProps = React.PropsWithChildren<{
address: string;
};
}>;
const AddressHighlighter: React.FC<AddressHighlighterProps> = ({
address,
@ -34,4 +34,4 @@ const AddressHighlighter: React.FC<AddressHighlighterProps> = ({
);
};
export default AddressHighlighter;
export default React.memo(AddressHighlighter);

View File

@ -0,0 +1,14 @@
import React from "react";
type InfoRowProps = React.PropsWithChildren<{
title: string;
}>;
const InfoRow: React.FC<InfoRowProps> = ({ title, children }) => (
<div className="grid grid-cols-4 py-4 text-sm">
<div>{title}:</div>
<div className="col-span-3">{children}</div>
</div>
);
export default React.memo(InfoRow);