Skip to content

Commit

Permalink
Apply new text components to token kit
Browse files Browse the repository at this point in the history
  • Loading branch information
kyhyco committed Jun 13, 2024
1 parent e04f9ee commit c207985
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 24 deletions.
13 changes: 13 additions & 0 deletions src/text/TextBody.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';

type TextBodyReact = {
children: ReactNode;
};

export function TextBody({ children }: TextBodyReact) {
return (
<span className="text-sans text-base leading-normal text-black">
{children}
</span>
);
}
11 changes: 11 additions & 0 deletions src/text/TextCaption.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ReactNode } from 'react';

type TextCaptionReact = {
children: ReactNode;
};

export function TextCaption({ children }: TextCaptionReact) {
return (
<span className="text-sans text-bold text-xs leading-4">{children}</span>
);
}
13 changes: 13 additions & 0 deletions src/text/TextHeadline.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';

type TextHeadlineReact = {
children: ReactNode;
};

export function TextHeadline({ children }: TextHeadlineReact) {
return (
<span className="text-sans text-base leading-normal text-bold text-[#0A0B0D]">
{children}
</span>
);
}
13 changes: 13 additions & 0 deletions src/text/TextLabel1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';

type TextLabel1React = {
children: ReactNode;
};

export function TextLabel1({ children }: TextLabel1React) {
return (
<span className="text-sans text-bold text-sm leading-5 text-[#0A0B0D]">
{children}
</span>
);
}
13 changes: 13 additions & 0 deletions src/text/TextLabel2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';

type TextLabel2React = {
children: ReactNode;
};

export function TextLabel2({ children }: TextLabel2React) {
return (
<span className="text-sans text-sm leading-5 text-[#0A0B0D]">
{children}
</span>
);
}
9 changes: 9 additions & 0 deletions src/text/TextLegal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ReactNode } from 'react';

type TextLegalReact = {
children: ReactNode;
};

export function TextLegal({ children }: TextLegalReact) {
return <span className="text-sans text-xs leading-4">{children}</span>;
}
9 changes: 4 additions & 5 deletions src/token/components/TokenChip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { TokenChipReact } from '../types';
import { TextBody } from "../../text/TextBody";
import type { TokenChipReact } from "../types";

/**
* Small button that display a given token symbol and image.
Expand All @@ -13,10 +14,8 @@ export function TokenChip({ token, onClick }: TokenChipReact) {
className="flex w-fit items-center rounded-2xl bg-[#eef0f3] py-1 pr-3 pl-1 hover:active:bg-[#bfc1c3] hover:bg-[#cacbce]"
onClick={() => onClick?.(token)}
>
<img className="mr-2 h-6 w-6" src={token.image || ''} />
<span className="font-medium text-base text-black leading-4">
{token.symbol}
</span>
<img className="mr-2 h-6 w-6" src={token.image || ""} />
<TextBody>{token.symbol}</TextBody>
</button>
);
}
13 changes: 6 additions & 7 deletions src/token/components/TokenRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { memo } from 'react';
import type { TokenRowReact } from '../types';
import { formatAmount } from '../core/formatAmount';
import { TokenImage } from './TokenImage';
import { memo } from "react";
import type { TokenRowReact } from "../types";
import { formatAmount } from "../core/formatAmount";
import { TokenImage } from "./TokenImage";
import { TextHeadline } from "../../text/TextHeadline";

export const TokenRow = memo(function TokenRow({
token,
Expand All @@ -19,9 +20,7 @@ export const TokenRow = memo(function TokenRow({
<span className="flex items-center gap-3">
{!hideImage && <TokenImage token={token} size={48} />}
<span className="flex flex-col items-start">
<span className="font-medium text-[#0A0B0D] leading-normal">
{token.name}
</span>
<TextHeadline>{token.name}</TextHeadline>
{!hideSymbol && (
<span className="font-normal text-[#5B616E] leading-normal">
{token.symbol}
Expand Down
20 changes: 8 additions & 12 deletions src/token/components/TokenSelectButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type ForwardedRef, forwardRef } from 'react';
import type { TokenSelectButtonReact } from '../types';
import { TokenImage } from './TokenImage';
import { type ForwardedRef, forwardRef } from "react";
import type { TokenSelectButtonReact } from "../types";
import { TokenImage } from "./TokenImage";
import { TextBody } from "../../text/TextBody";

function CaretUp() {
return (
Expand Down Expand Up @@ -40,7 +41,7 @@ function CaretDown() {

export const TokenSelectButton = forwardRef(function TokenSelectButton(
{ onClick, token, isOpen }: TokenSelectButtonReact,
ref: ForwardedRef<HTMLButtonElement>,
ref: ForwardedRef<HTMLButtonElement>
) {
return (
<button
Expand All @@ -52,17 +53,12 @@ export const TokenSelectButton = forwardRef(function TokenSelectButton(
{token ? (
<>
<TokenImage token={token} size={16} />
<span
data-testid="ockTokenSelectButton_Symbol"
className="font-medium text-[#0a0b0d] text-base leading-normal"
>
<TextBody data-testid="ockTokenSelectButton_Symbol">
{token.symbol}
</span>
</TextBody>
</>
) : (
<span className="font-medium text-[#0a0b0d] text-base leading-normal">
Select
</span>
<TextBody>Select</TextBody>
)}
{isOpen ? <CaretUp /> : <CaretDown />}
</button>
Expand Down

0 comments on commit c207985

Please sign in to comment.