Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Change the color of the date chip #1116

Merged
merged 6 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions components/identities/identityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ const IdentityCard: FunctionComponent<IdentityCardProps> = ({
const handleMouseLeave = debounce(() => setIsHovered(false), 50);
const searchParams = useSearchParams();
const minting = searchParams.get("minting") === "true";
const isDomainExpired = identity?.domainExpiry
? new Date(identity.domainExpiry * 1000) < new Date()
: false;

return (
<div className={styles.wrapper}>
<div className={styles.container}>
<div className="lg:mt-10 flex-col flex items-center lg:justify-between justify-center sm:text-center gap-3 sm:gap-5 my-2 flex-wrap lg:flex-row sm:flex-col">
<div className="flex flex-col flex-wrap items-center justify-center gap-3 my-2 lg:mt-10 lg:justify-between sm:text-center sm:gap-5 lg:flex-row sm:flex-col">
<div className="my-2 text-center">
<div
className={styles.pfpSection}
Expand Down Expand Up @@ -95,17 +98,36 @@ const IdentityCard: FunctionComponent<IdentityCardProps> = ({
</div>
{identity?.domainExpiry ? (
<Tooltip title="Expiry date of this domain" arrow>
<div className={styles.expiryContainer}>
<CalendarIcon width="16" color={theme.palette.primary.main} />
<p className={styles.expiryText}>
<div
className={
isDomainExpired
? styles.expiryContainer // Expired (red)
: styles.notExpiryContainer // Not expired (green)
}
>
<CalendarIcon
width="16"
color={
isDomainExpired
? theme.palette.error.main // Red for expired
: theme.palette.primary.main // Green for active
}
/>
<p
className={
isDomainExpired
? styles.expiryText // Red for expired text
: styles.notExpiryText // Green for active text
}
>
{timestampToReadableDate(identity.domainExpiry)}
</p>
</div>
</Tooltip>
) : null}
</div>
{minting ? (
<div className="text-left h-full py-2">
<div className="h-full py-2 text-left">
<h1 className="text-3xl font-bold font-quickZap">
Minting your identity...
</h1>
Expand Down Expand Up @@ -134,7 +156,7 @@ const IdentityCard: FunctionComponent<IdentityCardProps> = ({
<h2>{minifyAddress(identity.targetAddress)}</h2>
<CopyContent
value={identity?.targetAddress}
className="cursor-pointer ml-3"
className="ml-3 cursor-pointer"
/>
</div>
) : null}
Expand All @@ -150,7 +172,7 @@ const IdentityCard: FunctionComponent<IdentityCardProps> = ({
<h2>{minifyAddress(identity.targetAddress)}</h2>
<CopyContent
value={identity?.targetAddress}
className="cursor-pointer ml-3"
className="ml-3 cursor-pointer"
/>
</div>
) : null}
Expand Down Expand Up @@ -200,7 +222,7 @@ const IdentityCard: FunctionComponent<IdentityCardProps> = ({
</div>
<div className={styles.cardCode}>
<p>
<span >{convertNumberToFixedLengthString(tokenId)}</span>
<span>{convertNumberToFixedLengthString(tokenId)}</span>
</p>
<svg
className="w-full hidden sm:block sm:w-[200px] md:w-[300px]"
Expand Down
30 changes: 27 additions & 3 deletions styles/components/identityCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,39 @@
gap: 8px;
border-radius: 8px;
margin-top: 8px;
background: var(--primary-700, #dcf2e9);
background: var(--negative-light);

/* Small Shadow */
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.06);
}

.notExpiryContainer {
display: inline-flex;
padding: 4px 8px;
justify-content: center;
align-items: center;
gap: 8px;
border-radius: 8px;
margin-top: 8px;
background: var(--primary300);

/* Small Shadow */
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.06);
}

.expiryText {
color: var(--primary-700, #000);
color: var(--secondary);
text-align: center;

/* Body/micro/medium */
font-size: 12px;
font-style: normal;
font-weight: 500;
line-height: 16px; /* 133.333% */
}

.notExpiryText {
color: var(--black);
text-align: center;

/* Body/micro/medium */
Expand Down Expand Up @@ -363,4 +388,3 @@
padding-bottom: 0;
}
}

1 change: 1 addition & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
--dark-content: #454545;
--content600: #8c8989;
--negative: #d32f2f;
--negative-light: #f6d5d5;
--black: #000000;
--identity-card-footer-text: #e2dfde;
--identity-card-border-color: #293e28;
Expand Down
4 changes: 4 additions & 0 deletions styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const theme = createTheme({
200: "#CDCCCC",
800: "#454545",
},
error: {
main: "#d32f2f",
light: "#f6d5d5",
},
},
});

Expand Down