Skip to content

Commit

Permalink
linting check
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobHomanics committed Jan 27, 2024
1 parent 1ef3bc6 commit 18ce863
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 240 deletions.
15 changes: 3 additions & 12 deletions packages/nextjs/components/rep-tokens-demo/Index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// import { ImageProperties } from "../rep-tokens/cards/property-cards/ImageCard";
import { TokenGroupCard } from "../rep-tokens/cards/token-group-card/TokenGroupCard";
import { useRepTokens } from "../rep-tokens/hooks/Hooks";
import {
buildTokenCards, // RenderProps, TokenElementsClasses
} from "../rep-tokens/utils/buildTokensCard";
import {
// tokensCardPropertiesClasses as mainTokenGroupCardElementsClassess,
tokenCardProps,
tokenGroupCardProps,
} from "./MainTokensCardConfig";
import { buildTokenCards } from "../rep-tokens/utils/buildTokensCard";
import { tokenGroupCardProps } from "./MainTokensCardConfig";
// import {
// tokenCardPrettifyLoadingProps as isBeautifyingMainTokenCardOverlayLoadingProps,
// tokenCardPropertiesClasses as mainNumberOverlayTokenCardPropertiesClasses,
Expand Down Expand Up @@ -46,9 +39,7 @@ export const Index = () => {

// );

// console.log(tokenCardElementsProps);

const mainTokenCards = buildTokenCards(tokensData.tokens, tokensData.address, tokenCardProps);
const mainTokenCards = buildTokenCards(tokensData.tokens, tokensData.address, tokenGroupCardProps.tokenCardProps);

// const mainNumberOverlayTokenCard = buildTokenGroupCard(
// tokensData.tokens,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import { ImageProperties } from "../rep-tokens/cards/property-cards/ImageCard";
// import {
// IsBeautifyingTokenCardLoadingProps,
// IsRenderingTokenCardProps,
// TokenCardElementsClasses,
// } from "../rep-tokens/cards/token-card/TokenCard";
// import {
// IsBeautifyingTokenGroupCardLoadingProps
// } from "../rep-tokens/cards/token-group-card/TokenGroupCard";
import { TokenGroupCardElementsClasses } from "../rep-tokens/cards/token-group-card/TokenGroupCard";
import { BaseElementConfigProp, ImageElementConfigProp, TokenElementsConfigProps } from "../rep-tokens/types/Types";

export const tokensCardPropertiesClasses = {
container: "flex justify-center",
card: "bg-slate-800 flex flex-col items-center",
address: {
container: "flex items-center justify-center bg-slate-600",
value: "ml-1.5 text-${size} font-normal text-white",
},
} as TokenGroupCardElementsClasses;
import {
BaseElementConfigProp,
ImageElementConfigProp,
TokenCardConfigProps,
TokenElementsConfigProps,
} from "../rep-tokens/types/Types";

export const balanceProps = {
isRendering: true,
Expand Down Expand Up @@ -94,12 +81,3 @@ export const tokenGroupCardProps = {
isPrettyLoading: true,
tokenCardProps,
};

export interface TokenCardConfigProps {
isRendering: true;
classes: {
card: string;
};
elementsProps: TokenElementsConfigProps;
isPrettyLoading: true;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
IsBeautifyingTokenCardLoadingProps,
IsRenderingTokenCardProps,
TokenCardElementsClasses,
} from "../rep-tokens/cards/token-card/TokenCard";
import {
IsBeautifyingTokenGroupCardLoadingProps, // IsRenderingTokenGroupCardProps,
} from "../rep-tokens/cards/token-group-card/TokenGroupCard";
import { TokenCardClasses } from "../rep-tokens/cards/token-card/TokenCard";
import { TokenGroupCardElementsClasses } from "../rep-tokens/cards/token-group-card/TokenGroupCard";

export const tokensCardPropertiesClasses = {
Expand All @@ -30,34 +23,4 @@ export const tokenCardPropertiesClasses = {
value: "rounded mx-auto",
},
},
} as TokenCardElementsClasses;

// export const tokensCardRenderProps = {
// card: true,
// address: true,
// } as IsRenderingTokenGroupCardProps;

export const isRenderingTokenCardProps = {
card: true,
isRenderingElementsProps: {
balance: true,
image: true,
name: true,
description: true,
address: true,
},
} as IsRenderingTokenCardProps;

export const tokensCardPrettifyLoadingProps = {
card: true,
} as IsBeautifyingTokenGroupCardLoadingProps;

export const tokenCardPrettifyLoadingProps = {
card: false,
isBeautifyLoadingElementsProps: {
balance: false,
image: false,
name: false,
description: false,
},
} as IsBeautifyingTokenCardLoadingProps;
} as TokenCardClasses;
41 changes: 2 additions & 39 deletions packages/nextjs/components/rep-tokens-demo/NavBarCardConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
IsBeautifyingTokenCardLoadingProps,
IsRenderingTokenCardProps,
TokenCardElementsClasses,
} from "../rep-tokens/cards/token-card/TokenCard";
import {
IsBeautifyingTokenGroupCardLoadingProps, // IsRenderingTokenGroupCardProps,
} from "../rep-tokens/cards/token-group-card/TokenGroupCard";
import { TokenCardClasses } from "../rep-tokens/cards/token-card/TokenCard";
import { TokenGroupCardElementsClasses } from "../rep-tokens/cards/token-group-card/TokenGroupCard";

export const tokensCardPropertiesClasses = {
Expand All @@ -28,34 +21,4 @@ export const tokenCardPropertiesClasses = {
value: "rounded mx-auto",
},
},
} as TokenCardElementsClasses;

// export const tokensCardRenderProps = {
// card: true,
// address: true,
// } as IsRenderingTokenGroupCardProps;

export const isRenderingTokenCardProps = {
card: true,
isRenderingElementsProps: {
balance: true,
image: true,
name: false,
description: false,
address: false,
},
} as IsRenderingTokenCardProps;

export const tokensCardPrettifyLoadingProps = {
card: true,
} as IsBeautifyingTokenGroupCardLoadingProps;

export const tokenCardPrettifyLoadingProps = {
card: false,
isBeautifyLoadingElementsProps: {
balance: false,
image: false,
name: false,
description: false,
},
} as IsBeautifyingTokenCardLoadingProps;
} as TokenCardClasses;
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import { Address } from "~~/components/scaffold-eth";

export interface BaseTokenCardProps {
token: Token;
balanceProp?: BalanceProp;
nameProp?: NameProp;
descriptionProp?: DescriptionProp;
imageProp?: ImageProp;
addressProp?: AddressProp;
elementsProps: BaseTokenCardElementsProps;
}

export interface BaseTokenCardElementsProps {
Expand Down Expand Up @@ -54,53 +50,51 @@ export interface AddressProp {
isPrettyLoading?: boolean;
}

export const BaseTokenCard = ({
balanceProp,
nameProp,
descriptionProp,
imageProp,
addressProp,
}: BaseTokenCardProps) => {
export const BaseTokenCard = ({ elementsProps }: BaseTokenCardProps) => {
return (
<>
{balanceProp ? (
{elementsProps?.balanceProp ? (
<BalanceCard
value={balanceProp.value}
elementClasses={balanceProp.classes}
prettifyLoading={balanceProp.isPrettyLoading}
value={elementsProps?.balanceProp?.value}
elementClasses={elementsProps?.balanceProp?.classes}
prettifyLoading={elementsProps?.balanceProp?.isPrettyLoading}
/>
) : (
<></>
)}
{imageProp ? (
{elementsProps?.imageProp ? (
<ImageCard
value={imageProp.value}
imageProperties={imageProp.properties}
elementClasses={imageProp.classes}
prettifyLoading={imageProp.isPrettyLoading}
value={elementsProps?.imageProp?.value}
imageProperties={elementsProps?.imageProp?.properties}
elementClasses={elementsProps?.imageProp?.classes}
prettifyLoading={elementsProps?.imageProp?.isPrettyLoading}
/>
) : (
<></>
)}
{nameProp ? (
{elementsProps?.nameProp ? (
<StringCard
value={nameProp.value}
elementClasses={nameProp.classes}
prettifyLoading={nameProp.isPrettyLoading}
value={elementsProps?.nameProp?.value}
elementClasses={elementsProps?.nameProp?.classes}
prettifyLoading={elementsProps?.nameProp?.isPrettyLoading}
/>
) : (
<></>
)}
{descriptionProp ? (
{elementsProps?.descriptionProp ? (
<StringCard
value={descriptionProp.value}
elementClasses={descriptionProp.classes}
prettifyLoading={descriptionProp.isPrettyLoading}
value={elementsProps?.descriptionProp?.value}
elementClasses={elementsProps?.descriptionProp?.classes}
prettifyLoading={elementsProps?.descriptionProp?.isPrettyLoading}
/>
) : (
<></>
)}
{addressProp ? <Address address={addressProp.value} propertyClasses={addressProp?.classes} /> : <></>}
{elementsProps?.addressProp ? (
<Address address={elementsProps?.addressProp?.value} propertyClasses={elementsProps?.addressProp?.classes} />
) : (
<></>
)}
</>
);
};
Original file line number Diff line number Diff line change
@@ -1,61 +1,26 @@
import { Token } from "../../hooks/Hooks";
// import { ImageProperties } from "../property-cards/ImageCard";
import {
AddressProp,
BalanceProp,
BaseTokenCard, // BaseTokenCardElementsClasses,
// BaseTokenCardElementsSetOfBooleans,
DescriptionProp,
ImageProp,
NameProp, // BaseTokenCardElementsProps
} from "./BaseTokenCard";
import { BaseTokenCard, BaseTokenCardElementsProps } from "./BaseTokenCard";

export interface TokenCardProps {
token: Token;
elementsClasses?: TokenCardElementsClasses;
elementsClasses?: TokenCardClasses;
isBeautifyingTokenCardLoadingProps?: boolean;
balanceProp?: BalanceProp;
nameProp?: NameProp;
descriptionProp?: DescriptionProp;
imageProp?: ImageProp;
addressProp?: AddressProp;
elementsProps: BaseTokenCardElementsProps;
}

export interface TokenCardElementsClasses {
export interface TokenCardClasses {
card: string;
// baseTokenCardElementsClasses?: BaseTokenCardElementsClasses;
}

export interface IsRenderingTokenCardProps {
card: boolean;
// isRenderingElementsProps: BaseTokenCardElementsSetOfBooleans;
}

export interface IsBeautifyingTokenCardLoadingProps {
card: boolean;
// isBeautifyLoadingElementsProps: BaseTokenCardElementsSetOfBooleans;
}

export const TokenCard = ({
token,
elementsClasses,
isBeautifyingTokenCardLoadingProps = false,
balanceProp,
nameProp,
descriptionProp,
imageProp,
addressProp,
elementsProps,
}: TokenCardProps) => {
const output = (
<>
<BaseTokenCard
token={token}
balanceProp={balanceProp}
nameProp={nameProp}
descriptionProp={descriptionProp}
imageProp={imageProp}
addressProp={addressProp}
/>
<BaseTokenCard token={token} elementsProps={elementsProps} />
</>
);

Expand All @@ -67,7 +32,7 @@ export const TokenCard = ({
token?.balance !== undefined &&
token?.name !== undefined &&
token?.description !== undefined &&
addressProp?.value !== undefined ? (
elementsProps?.addressProp?.value !== undefined ? (
<div>{output}</div>
) : (
<>Loading Token...</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ export interface TokenGroupCardElementsClasses {
address: ElementClasses;
}

export interface IsBeautifyingTokenGroupCardLoadingProps {
card: boolean;
}

export const TokenGroupCard = ({
address,
tokenCardsProps,
Expand All @@ -32,11 +28,7 @@ export const TokenGroupCard = ({
token={props.token}
elementsClasses={props.elementsClasses}
isBeautifyingTokenCardLoadingProps={props.isBeautifyingTokenCardLoadingProps}
balanceProp={props.balanceProp}
nameProp={props.nameProp}
descriptionProp={props.descriptionProp}
imageProp={props.imageProp}
addressProp={props.addressProp}
elementsProps={props.elementsProps}
></TokenCard>
));

Expand Down
9 changes: 9 additions & 0 deletions packages/nextjs/components/rep-tokens/types/Types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ export interface TokenElementsConfigProps {
descriptionProps?: BaseElementConfigProp;
addressProps?: BaseElementConfigProp;
}

export interface TokenCardConfigProps {
isRendering: true;
classes: {
card: string;
};
elementsProps: TokenElementsConfigProps;
isPrettyLoading: true;
}
Loading

0 comments on commit 18ce863

Please sign in to comment.