-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e18d411
commit e47cde5
Showing
7 changed files
with
167 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
packages/nextjs/components/rep-tokens/cards/stylized-cards/Stylized.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
export type Color = "lime" | "slate" | "violet" | "red" | "teal" | "pink" | "white" | "black" | "cyan"; | ||
export type Color = | ||
| "lime" | ||
| "slate" | ||
| "violet" | ||
| "red" | ||
| "teal" | ||
| "pink" | ||
| "white" | ||
| "black" | ||
| "cyan" | ||
| "yellow" | ||
| "blue"; |
22 changes: 22 additions & 0 deletions
22
packages/nextjs/components/rep-tokens/cards/stylized-cards/StylizedAddressCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Color } from "./Stylized"; | ||
import { Address } from "~~/components/scaffold-eth"; | ||
|
||
type AddressCardProps = { | ||
address: string; | ||
color?: Color; | ||
textColor?: Color; | ||
isGroup?: boolean; | ||
}; | ||
|
||
export const StylizedAddressCard = ({ | ||
address, | ||
color = "slate", | ||
textColor = "black", | ||
isGroup = false, | ||
}: AddressCardProps) => { | ||
return ( | ||
<div className={`rounded-lg flex items-center justify-center bg-${color}-300 ${isGroup ? "mx-4 mt-4" : ""}`}> | ||
<Address address={address} textColor={textColor} /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 91 additions & 2 deletions
93
packages/nextjs/components/rep-tokens/cards/stylized-cards/StylizedTokenGroupCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,98 @@ | ||
import { Color } from "./Stylized"; | ||
import { StylizedAddressCard } from "./StylizedAddressCard"; | ||
import { StylizedBalanceCard } from "~~/components/rep-tokens/cards/stylized-cards/StylizedBalanceCard"; | ||
import { StylizedImageCard } from "~~/components/rep-tokens/cards/stylized-cards/StylizedImageCard"; | ||
import { StylizedStringCard } from "~~/components/rep-tokens/cards/stylized-cards/StylizedStringCard"; | ||
import { StylizedTokenCard } from "~~/components/rep-tokens/cards/stylized-cards/StylizedTokenCard"; | ||
|
||
export interface TokenCardInternalProps { | ||
tokens: any[]; | ||
components?: ReputationComponent[]; | ||
color?: Color; | ||
} | ||
|
||
export const StylizedTokenGroupCard = ({ color = "slate", children }: any) => { | ||
return <div className={`text-white rounded-lg bg-${color}-900 flex flex-col items-center p-5`}>{children}</div>; | ||
export type ReputationComponent = | ||
| "Balance" | ||
| "Image" | ||
| "Name" | ||
| "Description" | ||
| "Address" | ||
| "IsSoulbound" | ||
| "IsRedeemable" | ||
| "MaxMintAmountPerTx"; | ||
|
||
export const StylizedTokenGroupCard = ({ | ||
tokens, | ||
components = [ | ||
"Balance", | ||
"Image", | ||
"Name", | ||
"Description", | ||
"Address", | ||
"IsSoulbound", | ||
"IsRedeemable", | ||
"MaxMintAmountPerTx", | ||
], | ||
color = "slate", | ||
|
||
children, | ||
}: any) => { | ||
const output: any[] = []; | ||
|
||
for (let i = 0; i < tokens?.length; i++) { | ||
const cardContent: any[] = []; | ||
|
||
for (let j = 0; j < components?.length; j++) { | ||
if (components[j] === "Balance") { | ||
cardContent.push(<StylizedBalanceCard key={j} value={Number(tokens[i]?.balance)} />); | ||
} | ||
|
||
if (components[j] === "Image") { | ||
cardContent.push(<StylizedImageCard key={j} src={tokens[i]?.image} />); | ||
} | ||
|
||
if (components[j] === "Name") { | ||
cardContent.push(<StylizedStringCard key={j} value={tokens[i]?.name} type="bold" />); | ||
} | ||
|
||
if (components[j] === "Description") { | ||
cardContent.push(<StylizedStringCard key={j} value={tokens[i]?.description} />); | ||
} | ||
|
||
if (components[j] === "IsSoulbound") { | ||
cardContent.push( | ||
<StylizedStringCard key={j} value={`Soulbound: ${tokens[i]?.properties.isSoulbound.toString()}`} />, | ||
); | ||
} | ||
|
||
if (components[j] === "IsRedeemable") { | ||
cardContent.push( | ||
<StylizedStringCard key={j} value={`Redeemable: ${tokens[i]?.properties.isRedeemable.toString()}`} />, | ||
); | ||
} | ||
|
||
if (components[j] === "MaxMintAmountPerTx") { | ||
cardContent.push( | ||
<StylizedStringCard | ||
key={j} | ||
value={`Max Mint Amount Per Tx: ${tokens[i]?.properties.maxMintAmountPerTx.toString()}`} | ||
/>, | ||
); | ||
} | ||
|
||
if (components[j] === "Address") { | ||
cardContent.push(<StylizedAddressCard key={j} address={tokens[i].address} />); | ||
} | ||
} | ||
|
||
const card = <StylizedTokenCard key={i}>{cardContent}</StylizedTokenCard>; | ||
output.push(card); | ||
} | ||
|
||
return ( | ||
<div className={`bg-${color}-800 flex flex-col rounded-lg`}> | ||
{children} | ||
<div className={`flex justify-center`}>{output}</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters