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

Migrate ApplyNow Components to shadcn/Tailwind #14046

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
90 changes: 39 additions & 51 deletions src/components/StablecoinsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { useTranslation } from "next-i18next"

import { ButtonLink } from "./ui/buttons/Button"
import { Flex } from "./ui/flex"
import {
Flex,
Image,
Table,
Tbody,
Td,
Text,
Th,
Thead,
Tr,
} from "@chakra-ui/react"

import { ButtonLink } from "./Buttons"
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "./ui/Table"

import { useRtlFlip } from "@/hooks/useRtlFlip"

Expand Down Expand Up @@ -45,68 +43,58 @@ const StablecoinsTable = ({
}

return (
<Table variant="unstyled" my={8} bg="background.base" mb={8} minW="720px">
<Thead bg="background.highlight" color="body.medium">
<Tr>
<Table className="my-8 mb-8 min-w-[720px] bg-background">
pettinarip marked this conversation as resolved.
Show resolved Hide resolved
<TableHeader className="text-body-medium">
<TableRow>
{columns.map((column, idx) => (
<Th
key={idx}
fontWeight="bold"
fontSize="md"
verticalAlign="inherit"
letterSpacing="normal"
>
<TableHead key={idx} className="p-4 text-start text-md font-bold">
{column}
</Th>
</TableHead>
))}

{content && content[0]?.url && (
<Th p={5} fontSize="md" fontWeight="normal" textAlign="end">
<Text as="span" display="inline-block" transform={flipForRtl}>
<TableHead className="p-5 text-right text-md font-normal">
<span className="inline-block" style={{ transform: flipForRtl }}>
</Text>
</Th>
</span>
</TableHead>
)}
</Tr>
</Thead>
<Tbody>
</TableRow>
</TableHeader>
<TableBody>
{hasError && (
<Tr p={4}>
<Td colSpan={4}>{t("page-stablecoins-table-error")}</Td>
</Tr>
<TableRow className="p-4">
<TableCell colSpan={4}>
{t("page-stablecoins-table-error")}
</TableCell>
</TableRow>
)}

{content.map(({ name, marketCap, image, type, url }, idx) => (
<Tr
<TableRow
key={idx}
color="text"
_hover={{
textDecoration: "none",
bg: "background.highlight",
}}
_focus={{
bg: "background.base",
color: "body.base",
}}
className="text focus:bg-background-base focus:text-body-base"
>
<Td verticalAlign="middle">
<TableCell className="p-4 align-middle">
<Flex>
{image && <Image src={image} alt="" me={4} boxSize={6} />}
{image && <img src={image} alt="" className="me-4 h-6 w-6" />}
<>{name}</>
</Flex>
</Td>
<Td verticalAlign="middle">{marketCap}</Td>
<Td verticalAlign="middle">{stablecoinsType[type]}</Td>
</TableCell>
<TableCell className="p-4 align-middle">{marketCap}</TableCell>
<TableCell className="p-4 align-middle">
{stablecoinsType[type]}
</TableCell>
{url && (
<Td textAlign="end">
<TableCell className="p-4 text-right">
<ButtonLink href={url} size="sm">
{t("page-stablecoins-go-to")} {name}
</ButtonLink>
</Td>
</TableCell>
)}
</Tr>
</TableRow>
))}
</Tbody>
</TableBody>
</Table>
)
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/Translatathon/ApplyNow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box, Flex } from "@chakra-ui/react"

import { ButtonLink } from "@/components/Buttons"
import Callout from "@/components/Callout"
0xgun marked this conversation as resolved.
Show resolved Hide resolved

import { Flex } from "../ui/flex"

import { APPLICATION_END_DATE, APPLICATION_URL } from "./constants"

import DolphinImage from "@/public/images/translatathon/translatathon_dolphin.png"
Expand All @@ -15,20 +15,20 @@ export const ApplyNow = () => {

if (dateToday < deadline) {
return (
<Box pt={12}>
<div className="pt-12">
<Callout
flex="1 1 416px"
className="flex-1 flex-shrink basis-[416px]"
image={DolphinImage}
titleKey="page-translatathon:translatathon-apply-now"
descriptionKey="page-translatathon:translatathon-apply-now-desc"
alignItems="center"
textAlign="center"
>
<Flex m="auto">
<Flex className="m-auto">
<ButtonLink href={APPLICATION_URL}>Apply now</ButtonLink>
</Flex>
</Callout>
</Box>
</div>
)
} else {
return <></>
Expand Down
Loading