diff --git a/packages/nextjs/components/rep-tokens-demo/Index.tsx b/packages/nextjs/components/rep-tokens-demo/Index.tsx index ca01782..8d8d995 100644 --- a/packages/nextjs/components/rep-tokens-demo/Index.tsx +++ b/packages/nextjs/components/rep-tokens-demo/Index.tsx @@ -1,28 +1,25 @@ -import { ImageProperties } from "../rep-tokens/cards/property-cards/ImageCard"; +// 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 { buildTokenGroupCard } from "../rep-tokens/utils/buildTokensCard"; -// import { BalanceProp } from "../rep-tokens/cards/token-card/BaseTokenCard"; +import { + buildTokenGroupCard, // RenderProps, TokenElementsClasses +} from "../rep-tokens/utils/buildTokensCard"; import { tokenCardPrettifyLoadingProps as isBeautifyingMainTokenCardLoadingProps, tokensCardPrettifyLoadingProps as isBeautifyingMainTokenGroupCardLoadingProps, // isRenderingTokenCardProps as isRenderingMainTokenCardProps, - // tokensCardRenderProps as isRenderingMainTokenGroupCardProps, tokenCardPropertiesClasses as mainTokenCardPropertiesClasses, tokensCardPropertiesClasses as mainTokenGroupCardElementsClassess, + tokenCardElementsProps, } from "./MainTokensCardConfig"; // import { // tokenCardPrettifyLoadingProps as isBeautifyingMainTokenCardOverlayLoadingProps, -// isRenderingTokenCardProps as isRenderingMainTokenCardOverlayProps, // tokenCardPropertiesClasses as mainNumberOverlayTokenCardPropertiesClasses, // tokensCardPropertiesClasses as mainNumberOverlayTokensCardElementsClasses, // tokensCardPrettifyLoadingProps as mainNumberOverlayTokensCardPrettifyLoadingProps, -// // tokensCardRenderProps as mainNumberOverlayTokensCardRenderProps, // } from "./MainTokensCardWithNumberOverlayConfig"; // import { // tokenCardPrettifyLoadingProps as isBeautifyingNavBarLoadingProps, // tokensCardPrettifyLoadingProps as isBeuatyingNavBarTokenGroupCardLoadingProps, -// isRenderingTokenCardProps as isRenderingNavBarCardProps, -// // tokensCardRenderProps as isRenderingNavBarTokenGroupCardProps, // tokenCardPropertiesClasses as navBarElementsClasses, // tokensCardPropertiesClasses as navBarTokenGroupCardElementsClasses, // } from "./NavBarCardConfig"; @@ -30,7 +27,7 @@ import { useAccount } from "wagmi"; export const Index = () => { // const navBarCardImageProperties = new ImageProperties("Token", 64, 64); - const mainCardImageProperties = new ImageProperties("Token", 256, 256); + // const mainCardImageProperties = new ImageProperties("Token", 256, 256); const { address } = useAccount(); @@ -42,33 +39,35 @@ export const Index = () => { // const navBarTokenCard = buildTokenGroupCard( // tokensData.tokens, - // tokensData.address, // navBarCardImageProperties, // navBarElementsClasses, - // isRenderingNavBarCardProps, // isBeautifyingNavBarLoadingProps, + // false, + // false, + // undefined, + // ); + console.log(tokenCardElementsProps); + const mainTokenGroupCard = buildTokenGroupCard( tokensData.tokens, tokensData.address, - mainCardImageProperties, + tokenCardElementsProps, mainTokenCardPropertiesClasses, - // isRenderingMainTokenCardProps, isBeautifyingMainTokenCardLoadingProps, ); // const mainNumberOverlayTokenCard = buildTokenGroupCard( // tokensData.tokens, + // true, + // true, // tokensData.address, // mainCardImageProperties, // mainNumberOverlayTokenCardPropertiesClasses, - // isRenderingMainTokenCardOverlayProps, // isBeautifyingMainTokenCardOverlayLoadingProps, // ); - console.log(mainTokenGroupCard); - return ( <> {/*
@@ -77,7 +76,6 @@ export const Index = () => { address={tokensData.address} tokenCardsProps={navBarTokenCard} elementsClasses={navBarTokenGroupCardElementsClasses} - isRenderingTokenGroupCardProps={isRenderingNavBarTokenGroupCardProps} isBeautifyingTokenGroupCardLoadingProps={isBeuatyingNavBarTokenGroupCardLoadingProps} />
@@ -89,19 +87,17 @@ export const Index = () => { address={tokensData.address} tokenCardsProps={mainTokenGroupCard} elementsClasses={mainTokenGroupCardElementsClassess} - // isRenderingTokenGroupCardProps={isRenderingMainTokenGroupCardProps} isBeautifyingTokenGroupCardLoadingProps={isBeautifyingMainTokenGroupCardLoadingProps} /> - {/* -
+ + {/*
diff --git a/packages/nextjs/components/rep-tokens-demo/MainTokensCardConfig.tsx b/packages/nextjs/components/rep-tokens-demo/MainTokensCardConfig.tsx index fccc4db..abe8a32 100644 --- a/packages/nextjs/components/rep-tokens-demo/MainTokensCardConfig.tsx +++ b/packages/nextjs/components/rep-tokens-demo/MainTokensCardConfig.tsx @@ -1,3 +1,4 @@ +import { ImageProperties } from "../rep-tokens/cards/property-cards/ImageCard"; import { IsBeautifyingTokenCardLoadingProps, IsRenderingTokenCardProps, @@ -17,6 +18,75 @@ export const tokensCardPropertiesClasses = { }, } as TokenGroupCardElementsClasses; +export interface BaseConfigProp { + isRendering: boolean; + classes: { + container: string; + value: string; + }; +} + +export interface ImageConfigProp extends BaseConfigProp { + imageProperties: ImageProperties; +} + +export interface TokenCardConfigProps { + balanceProps?: BaseConfigProp; + imageProps?: ImageConfigProp; + nameProps?: BaseConfigProp; + descriptionProps?: BaseConfigProp; + addressProps?: BaseConfigProp; +} + +export const balanceProps = { + isRendering: true, + classes: { + container: "bg-slate-300", + value: "text-4xl mx-auto text-center", + }, +} as BaseConfigProp; + +export const imageProps = { + isRendering: true, + classes: { + container: "bg-slate-300 p-1", + value: "rounded mx-auto", + }, + imageProperties: new ImageProperties("Token", 256, 256), +} as ImageConfigProp; + +export const nameProps = { + isRendering: true, + classes: { + container: "bg-slate-300", + value: "text-1xl text-center object-center mx-auto font-bold break-all", + }, +} as BaseConfigProp; + +export const descriptionProps = { + isRendering: true, + classes: { + container: "bg-slate-300", + value: "text-1xl mx-auto text-center break-words", + }, +} as BaseConfigProp; + +export const addressProps = { + isRendering: true, + classes: { + container: "flex items-center justify-center bg-slate-300", + value: "rounded mx-auto", + }, +} as BaseConfigProp; + +export const tokenCardElementsProps = { + balanceProps, + imageProps, + nameProps, + descriptionProps, + addressProps, +} as TokenCardConfigProps; + export const tokenCardPropertiesClasses = { card: "bg-slate-600 p-5 m-4 w-64", baseTokenCardElementsClasses: { diff --git a/packages/nextjs/components/rep-tokens/cards/property-cards/BalanceCard.tsx b/packages/nextjs/components/rep-tokens/cards/property-cards/BalanceCard.tsx index 2d8a62b..5e2c7b1 100644 --- a/packages/nextjs/components/rep-tokens/cards/property-cards/BalanceCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/property-cards/BalanceCard.tsx @@ -1,4 +1,4 @@ -import { ElementClasses } from "../types/Types"; +import { ElementClasses } from "../../types/Types"; type TBalanceCardProps = { value: bigint; diff --git a/packages/nextjs/components/rep-tokens/cards/property-cards/ImageCard.tsx b/packages/nextjs/components/rep-tokens/cards/property-cards/ImageCard.tsx index 2ece819..cade74b 100644 --- a/packages/nextjs/components/rep-tokens/cards/property-cards/ImageCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/property-cards/ImageCard.tsx @@ -1,5 +1,5 @@ import Image from "next/image"; -import { ElementClasses } from "../types/Types"; +import { ElementClasses } from "../../types/Types"; type TImageCardProps = { value: string; diff --git a/packages/nextjs/components/rep-tokens/cards/property-cards/StringCard.tsx b/packages/nextjs/components/rep-tokens/cards/property-cards/StringCard.tsx index 8a13c25..abe1809 100644 --- a/packages/nextjs/components/rep-tokens/cards/property-cards/StringCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/property-cards/StringCard.tsx @@ -1,4 +1,4 @@ -import { ElementClasses } from "../types/Types"; +import { ElementClasses } from "../../types/Types"; type TStringCardProps = { value: string; diff --git a/packages/nextjs/components/rep-tokens/cards/token-card/BaseTokenCard.tsx b/packages/nextjs/components/rep-tokens/cards/token-card/BaseTokenCard.tsx index d4eafed..31b14d4 100644 --- a/packages/nextjs/components/rep-tokens/cards/token-card/BaseTokenCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/token-card/BaseTokenCard.tsx @@ -1,18 +1,21 @@ import { Token } from "../../hooks/Hooks"; +import { ElementClasses } from "../../types/Types"; import { BalanceCard } from "../property-cards/BalanceCard"; import { ImageCard } from "../property-cards/ImageCard"; import { ImageProperties } from "../property-cards/ImageCard"; import { StringCard } from "../property-cards/StringCard"; -import { ElementClasses } from "../types/Types"; import { Address } from "~~/components/scaffold-eth"; export interface BaseTokenCardProps { token: Token; - address?: string; - imageProperties?: ImageProperties; - elementsClasses?: BaseTokenCardElementsClasses; - isBeautifyLoadingElementsProps?: BaseTokenCardElementsSetOfBooleans; - // isRenderingElementsProps?: BaseTokenCardElementsSetOfBooleans; + balanceProp?: BalanceProp; + nameProp?: NameProp; + descriptionProp?: DescriptionProp; + imageProp?: ImageProp; + addressProp?: AddressProp; +} + +export interface BaseTokenCardElementsProps { balanceProp?: BalanceProp; nameProp?: NameProp; descriptionProp?: DescriptionProp; @@ -51,28 +54,7 @@ export interface AddressProp { isBeautifyLoading?: boolean; } -export interface BaseTokenCardElementsClasses { - balance: ElementClasses; - name: ElementClasses; - description: ElementClasses; - image: ElementClasses; - address: ElementClasses; -} - -export interface BaseTokenCardElementsSetOfBooleans { - balance: boolean; - name: boolean; - description: boolean; - image: boolean; - address: boolean; -} - export const BaseTokenCard = ({ - // token, - address, - // imageProperties, - elementsClasses, - // isBeautifyLoadingElementsProps = { balance: false, image: false, name: false, description: false, address: false }, balanceProp, nameProp, descriptionProp, @@ -118,51 +100,7 @@ export const BaseTokenCard = ({ ) : ( <> )} - {addressProp ?
: <>} - - {/* {isRenderingElementsProps.balance ? ( - - ) : ( - <> - )} */} - - {/* {isRenderingElementsProps.image ? ( - - ) : ( - <> - )} - {isRenderingElementsProps.name ? ( - - ) : ( - <> - )} - {isRenderingElementsProps.description ? ( - - ) : ( - <> - )} - {isRenderingElementsProps.address ? ( -
- ) : ( - <> - )} */} + {addressProp ?
: <>} ); }; diff --git a/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx b/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx index 6539dfe..2f5e3ac 100644 --- a/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx @@ -1,23 +1,19 @@ import { Token } from "../../hooks/Hooks"; -import { ImageProperties } from "../property-cards/ImageCard"; +// import { ImageProperties } from "../property-cards/ImageCard"; import { AddressProp, BalanceProp, - BaseTokenCard, - BaseTokenCardElementsClasses, - BaseTokenCardElementsSetOfBooleans, + BaseTokenCard, // BaseTokenCardElementsClasses, + // BaseTokenCardElementsSetOfBooleans, DescriptionProp, ImageProp, - NameProp, + NameProp, // BaseTokenCardElementsProps } from "./BaseTokenCard"; export interface TokenCardProps { token: Token; - address?: string; - imageProperties?: ImageProperties; elementsClasses?: TokenCardElementsClasses; isBeautifyingTokenCardLoadingProps?: IsBeautifyingTokenCardLoadingProps; - // isRenderingTokenCardProps?: IsRenderingTokenCardProps; balanceProp?: BalanceProp; nameProp?: NameProp; descriptionProp?: DescriptionProp; @@ -27,31 +23,25 @@ export interface TokenCardProps { export interface TokenCardElementsClasses { card: string; - baseTokenCardElementsClasses?: BaseTokenCardElementsClasses; + // baseTokenCardElementsClasses?: BaseTokenCardElementsClasses; } export interface IsRenderingTokenCardProps { card: boolean; - isRenderingElementsProps: BaseTokenCardElementsSetOfBooleans; + // isRenderingElementsProps: BaseTokenCardElementsSetOfBooleans; } export interface IsBeautifyingTokenCardLoadingProps { card: boolean; - isBeautifyLoadingElementsProps: BaseTokenCardElementsSetOfBooleans; + // isBeautifyLoadingElementsProps: BaseTokenCardElementsSetOfBooleans; } export const TokenCard = ({ token, - address, - imageProperties, elementsClasses, - // isRenderingTokenCardProps = { - // card: true, - // isRenderingElementsProps: { balance: true, image: true, name: true, description: true, address: true }, - // }, isBeautifyingTokenCardLoadingProps = { card: false, - isBeautifyLoadingElementsProps: { balance: false, image: false, name: false, description: false, address: false }, + // isBeautifyLoadingElementsProps: { balance: false, image: false, name: false, description: false, address: false }, }, balanceProp, nameProp, @@ -63,10 +53,6 @@ export const TokenCard = ({ <> {output}
) : ( <>Loading Token... diff --git a/packages/nextjs/components/rep-tokens/cards/token-group-card/TokenGroupCard.tsx b/packages/nextjs/components/rep-tokens/cards/token-group-card/TokenGroupCard.tsx index 8fe4625..2bc90b3 100644 --- a/packages/nextjs/components/rep-tokens/cards/token-group-card/TokenGroupCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/token-group-card/TokenGroupCard.tsx @@ -1,13 +1,12 @@ +import { ElementClasses } from "../../types/Types"; import { TokenCard } from "../token-card/TokenCard"; import { TokenCardProps } from "../token-card/TokenCard"; -import { ElementClasses } from "../types/Types"; import { Address } from "~~/components/scaffold-eth"; export interface TokenGroupProps { address?: string; tokenCardsProps: TokenCardProps[]; elementsClasses?: TokenGroupCardElementsClasses; - // isRenderingTokenGroupCardProps?: IsRenderingTokenGroupCardProps; isBeautifyingTokenGroupCardLoadingProps?: IsBeautifyingTokenGroupCardLoadingProps; } @@ -27,12 +26,12 @@ export const TokenGroupCard = ({ elementsClasses, isBeautifyingTokenGroupCardLoadingProps, }: TokenGroupProps) => { + console.log(tokenCardsProps); + const components = tokenCardsProps.map((props, index) => (