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

Update fonts and typography styles for dApp #35

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/inter": "^5.0.15",
"@ledgerhq/wallet-api-client": "^1.2.1",
"@ledgerhq/wallet-api-client-react": "^1.1.2",
"framer-motion": "^10.16.4",
Expand Down
28 changes: 28 additions & 0 deletions dapp/src/components/Typography/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react"
import { Text, TextProps } from "@chakra-ui/react"

export function BodySm(props: TextProps) {
return (
<Text
as="p"
fontWeight="400"
fontSize="14px"
lineHeight="24px"
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
)
}

export function BodyMd(props: TextProps) {
return (
<Text
as="p"
fontWeight="400"
fontSize="16px"
lineHeight="24px"
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
)
}
11 changes: 11 additions & 0 deletions dapp/src/theme/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ import { mode } from "@chakra-ui/theme-tools"
import type { StyleFunctionProps } from "@chakra-ui/styled-system"

const Button = {
baseStyle: {
fontWeight: "500",
},
sizes: {
md: {
fontSize: "14px",
},
lg: {
fontSize: "16px",
},
},
variants: {
solid: (props: StyleFunctionProps) => ({
backgroundColor: mode("black", "purple")(props),
Expand Down
2 changes: 2 additions & 0 deletions dapp/src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { extendTheme } from "@chakra-ui/react"
import Button from "./Button"
import { colors } from "./utils"
import { fonts } from "./utils/fonts"

const defaultTheme = {
fonts,
colors,
components: {
Button,
Expand Down
4 changes: 4 additions & 0 deletions dapp/src/theme/utils/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const fonts = {
heading: "Inter, sans-serif",
body: "Inter, sans-serif",
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we import fonts as they mentioned in docs?

Then import the relevant font weights and styles into the theme file you created or the same root file you import ChakraProvider into.

Looks like it works OK w/o imports but maybe we should add them just in case 😄. WDYT?

}
5 changes: 5 additions & 0 deletions dapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,11 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.53.0.tgz#bea56f2ed2b5baea164348ff4d5a879f6f81f20d"
integrity sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==

"@fontsource/inter@^5.0.15":
version "5.0.15"
resolved "https://registry.yarnpkg.com/@fontsource/inter/-/inter-5.0.15.tgz#c01d160cd02bde1a4ce09f2c38b2063b66caf870"
integrity sha512-/IoWYEXl8lqJEx50JqNPT+bI4VNwxb/bg2oOfvG8PiEsDsmHRFvWBVHlohBNn1+QdBf+KbAjU/gb4vlGOSsVWw==

"@humanwhocodes/config-array@^0.11.13":
version "0.11.13"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297"
Expand Down
Loading