Skip to content

Commit

Permalink
Add a Segment font
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 8, 2023
1 parent a4f0168 commit a22e660
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dapp/src/DApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import theme from "./theme"
import { LedgerWalletAPIProvider, WalletContextProvider } from "./contexts"
import Header from "./components/Header"
import Overview from "./components/Overview"
import GlobalStyles from "./components/GlobalStyles"

function DApp() {
useDetectThemeMode()
Expand All @@ -24,6 +25,7 @@ function DAppProviders() {
<LedgerWalletAPIProvider>
<WalletContextProvider>
<ChakraProvider theme={theme}>
<GlobalStyles />
<DApp />
</ChakraProvider>
</WalletContextProvider>
Expand Down
47 changes: 47 additions & 0 deletions dapp/src/components/GlobalStyles/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react"
import { Global } from "@emotion/react"

import SegmentRegular from "../../fonts/Segment-Regular.otf"
import SegmentMedium from "../../fonts/Segment-Medium.otf"
import SegmentSemiBold from "../../fonts/Segment-SemiBold.otf"
import SegmentBold from "../../fonts/Segment-Bold.otf"
import SegmentBlack from "../../fonts/Segment-Black.otf"

export default function GlobalStyles() {
return (
<Global
styles={`
@font-face {
font-family: "Segment";
src: url(${SegmentRegular}) format("otf");
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: "Segment";
src: url(${SegmentMedium}) format("otf");
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: "Segment";
src: url(${SegmentSemiBold}) format("otf");
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: "Segment";
src: url(${SegmentBold}) format("otf");
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: "Segment";
src: url(${SegmentBlack}) format("otf");
font-weight: 900;
font-style: normal;
}
`}
/>
)
}
2 changes: 1 addition & 1 deletion dapp/src/components/Overview/Statistics.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { CardBody, Card, CardProps } from "@chakra-ui/react"
import { TextMd } from "../Typography"
import { TextMd } from "../shared/Typography"

export default function Statistics(props: CardProps) {
return (
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/Overview/TransactionHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { CardBody, Card, CardProps } from "@chakra-ui/react"
import { TextMd } from "../Typography"
import { TextMd } from "../shared/Typography"

export default function TransactionHistory(props: CardProps) {
return (
Expand Down
File renamed without changes.
Binary file added dapp/src/fonts/Segment-Black.otf
Binary file not shown.
Binary file added dapp/src/fonts/Segment-Bold.otf
Binary file not shown.
Binary file added dapp/src/fonts/Segment-Medium.otf
Binary file not shown.
Binary file added dapp/src/fonts/Segment-Regular.otf
Binary file not shown.
Binary file added dapp/src/fonts/Segment-SemiBold.otf
Binary file not shown.
3 changes: 2 additions & 1 deletion dapp/src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { StyleFunctionProps, Tooltip, extendTheme } from "@chakra-ui/react"
import { mode } from "@chakra-ui/theme-tools"
import Button from "./Button"
import Switch from "./Switch"
import { colors, fontSizes, fontWeights, lineHeights } from "./utils"
import { colors, fontSizes, fontWeights, fonts, lineHeights } from "./utils"

// Currently, there is no possibility to set all tooltips with hasArrow by defaultProps.
// Let's override the defaultProps as follows.
Tooltip.defaultProps = { ...Tooltip.defaultProps, hasArrow: true }

const defaultTheme = {
colors,
fonts,
fontSizes,
fontWeights,
lineHeights,
Expand Down
6 changes: 6 additions & 0 deletions dapp/src/theme/utils/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const fontSizes = {
}

export const fontWeights = {
normal: 400,
medium: 500,
semibold: 600,
bold: 700,
Expand All @@ -20,3 +21,8 @@ export const lineHeights = {
lg: "1.75rem",
xl: "1.875rem",
}

export const fonts = {
heading: "Segment, sans-serif",
body: "Segment, sans-serif",
}

0 comments on commit a22e660

Please sign in to comment.