Skip to content

Commit

Permalink
Add the basic styles of the Link component
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Jan 19, 2024
1 parent f786ea2 commit af0b403
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dapp/src/components/shared/ViewInBlockExplorer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import React from "react"
import { Chain, ExplorerDataType } from "#/types"
import { Link } from "@chakra-ui/react"
import { Link, LinkProps } from "@chakra-ui/react"
import { createLinkToBlockExplorerForChain } from "#/utils"

type ViewInBlockExplorerProps = {
text?: string
id: string
type: ExplorerDataType
chain?: Chain
}
} & Omit<LinkProps, "isExternal">

function ViewInBlockExplorer({
text,
id,
type,
chain = "ethereum",
...linkProps
}: ViewInBlockExplorerProps) {
const { link, title } = createLinkToBlockExplorerForChain(chain, id, type)

return (
// TODO: Use a button link
<Link href={link} isExternal>
<Link href={link} isExternal {...linkProps}>
{text ?? title}
</Link>
)
Expand Down
15 changes: 15 additions & 0 deletions dapp/src/theme/Link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineStyle, defineStyleConfig } from "@chakra-ui/react"

const baseStyle = defineStyle({
fontWeight: "semibold",
fontSize: "sm",
lineHeight: "sm",

_hover: {
textDecoration: "none",
},
})

export const linkTheme = defineStyleConfig({
baseStyle,
})
2 changes: 2 additions & 0 deletions dapp/src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { spinnerTheme } from "./Spinner"
import { tableTheme } from "./Table"
import { currencyIconTheme } from "./CurrencyIcon"
import { statusInfoTheme } from "./StatusInfo"
import { linkTheme } from "./Link"

const defaultTheme = {
colors,
Expand Down Expand Up @@ -60,6 +61,7 @@ const defaultTheme = {
Table: tableTheme,
CurrencyIcon: currencyIconTheme,
StatusInfo: statusInfoTheme,
Link: linkTheme,
},
}

Expand Down

0 comments on commit af0b403

Please sign in to comment.