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

Add a basic typography #61

Merged
merged 2 commits into from
Dec 6, 2023
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
33 changes: 33 additions & 0 deletions dapp/src/components/Typography/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react"
import { Text, TextProps } from "@chakra-ui/react"

export function TextXl(props: TextProps) {
return (
<Text as="p" fontWeight="medium" fontSize="xl" lineHeight="xl" {...props} />
)
}

export function TextLg(props: TextProps) {
return (
<Text as="p" fontWeight="medium" fontSize="lg" lineHeight="lg" {...props} />
)
}

export function TextMd(props: TextProps) {
return (
<Text as="p" fontWeight="medium" fontSize="md" lineHeight="md" {...props} />
)
}

export function TextSm(props: TextProps) {
return (
<Text as="p" fontWeight="medium" fontSize="sm" lineHeight="sm" {...props} />
)
}

export function TextXs(props: TextProps) {
return (
<Text as="p" fontWeight="medium" fontSize="xs" lineHeight="xs" {...props} />
)
}
5 changes: 4 additions & 1 deletion dapp/src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { StyleFunctionProps, extendTheme } from "@chakra-ui/react"
import { mode } from "@chakra-ui/theme-tools"
import Button from "./Button"
import { colors } from "./utils"
import { colors, fontSizes, fontWeights, lineHeights } from "./utils"

const defaultTheme = {
colors,
fontSizes,
fontWeights,
lineHeights,
styles: {
global: (props: StyleFunctionProps) => ({
body: {
Expand Down
22 changes: 22 additions & 0 deletions dapp/src/theme/utils/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const fontSizes = {
xs: "0.75rem",
sm: "0.875rem",
md: "1rem",
lg: "1.125rem",
xl: "1.25rem",
}

export const fontWeights = {
medium: 500,
semibold: 600,
bold: 700,
black: 900,
}

export const lineHeights = {
xs: "1.125rem",
sm: "1.25rem",
md: "1.5rem",
lg: "1.75rem",
xl: "1.875rem",
}
1 change: 1 addition & 0 deletions dapp/src/theme/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./colors"
export * from "./fonts"
Loading