From f674bb34aad4b2a870a7f827793d10ba5435ecdd Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 16 Jan 2023 21:57:34 +0800 Subject: [PATCH] Style tweaks for the emails list --- packages/web/components/elements/InfoLink.tsx | 15 +++-- packages/web/pages/settings/emails.tsx | 66 +++++++++++-------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/packages/web/components/elements/InfoLink.tsx b/packages/web/components/elements/InfoLink.tsx index 0424f0b2e..ba9e50355 100644 --- a/packages/web/components/elements/InfoLink.tsx +++ b/packages/web/components/elements/InfoLink.tsx @@ -1,6 +1,6 @@ import Link from 'next/link' import { Info } from 'phosphor-react' -import { Box } from '../elements/LayoutPrimitives' +import { Box, VStack } from '../elements/LayoutPrimitives' import { theme } from '../tokens/stitches.config' import { TooltipWrapped } from './Tooltip' @@ -15,8 +15,14 @@ const TooltipStyle = { export function InfoLink(props: InfoLinkProps): JSX.Element { return ( - - + - - + ) } diff --git a/packages/web/pages/settings/emails.tsx b/packages/web/pages/settings/emails.tsx index ad4e40f1a..29fa58c85 100644 --- a/packages/web/pages/settings/emails.tsx +++ b/packages/web/pages/settings/emails.tsx @@ -18,7 +18,7 @@ import { } from '../../components/elements/LayoutPrimitives' import { useCopyLink } from '../../lib/hooks/useCopyLink' import { Toaster } from 'react-hot-toast' -import { useCallback } from 'react' +import { useCallback, useMemo } from 'react' import { StyledText } from '../../components/elements/StyledText' import { applyStoredTheme } from '../../lib/themeUpdater' import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers' @@ -71,16 +71,6 @@ const TableHeading = styled(Box, { }, }) -const Input = styled('input', { - backgroundColor: 'transparent', - color: '$grayTextContrast', - marginTop: '5px', - marginLeft: '38px', - '&[disabled]': { - border: 'none', - }, -}) - const CopyTextBtnWrapper = styled(Box, { background: '$grayBgActive', borderRadius: '6px', @@ -197,6 +187,16 @@ export default function EmailsPage(): JSX.Element { revalidate() showSuccessToast('Email Deleted') } + + const sortedEmailAddresses = useMemo(() => { + return emailAddresses + .sort((a, b) => a.createdAt.localeCompare(b.createdAt)) + .map((em) => { + em.confirmationCode = '123445' + return em + }) + }, [emailAddresses]) + return ( - {emailAddresses && - emailAddresses.map((email, i) => { - const isLastChild = i === emailAddresses.length - 1 + {sortedEmailAddresses && + sortedEmailAddresses.map((email, i) => { + const isLastChild = i === sortedEmailAddresses.length - 1 return ( - + {email.confirmationCode && ( <> - + + {`Gmail: ${email.confirmationCode}`} + )} - +