Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
feat: use a wrapper for Icon component (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
samerbuna authored Aug 24, 2022
1 parent 7ecf357 commit 70a0773
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { useState } from "react"

import { Icon } from "@galoymoney/react"

import useMainQuery from "hooks/use-main-query"
import { translate, useAuthContext, useAppState } from "store/index"

Expand All @@ -10,6 +8,7 @@ import Link from "components/link"
import LoginLink from "components/login-link"
import LogoutLink from "components/logout-link"
import DiscardableMessage from "components/discardable-message"
import Icon from "components/icon"

const headerNavPages = ["home"] as const

Expand Down
7 changes: 7 additions & 0 deletions src/components/icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IconName, Icon as DefaultIcon } from "@galoymoney/react"

const Icon: React.FC<{ name: IconName }> = ({ name }) => {
return <DefaultIcon name={name} />
}

export default Icon
2 changes: 1 addition & 1 deletion src/components/login-link.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { translate } from "store/index"
import { Icon } from "@galoymoney/react"

import Link from "components/link"
import Icon from "components/icon"

const LoginLink = () => (
<Link to="/login">
Expand Down
4 changes: 3 additions & 1 deletion src/components/login/auth-code.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ChangeEvent, useState } from "react"

import { Icon, Spinner } from "@galoymoney/react"
import { Spinner } from "@galoymoney/react"

import { config, translate, history, useRequest, useAuthContext } from "store/index"

import Icon from "components/icon"

type FCT = React.FC<{ phoneNumber: string }>

const AuthCode: FCT = ({ phoneNumber }) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/logout-link.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useResetClient } from "@galoymoney/client"
import { Icon } from "@galoymoney/react"

import { translate, useAuthContext, NoPropsFCT } from "store/index"

import Icon from "components/icon"

const LogoutLink: NoPropsFCT = () => {
const { setAuthSession } = useAuthContext()

Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/contacts.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { truncatedDisplay, useQuery } from "@galoymoney/client"
import { Icon, Spinner } from "@galoymoney/react"
import { Spinner } from "@galoymoney/react"

import { translate, history, useAuthContext, NoPropsFCT } from "store/index"

import ErrorMessage from "components/error-message"
import Header from "components/header"
import Icon from "components/icon"

const ContactsList: NoPropsFCT = () => {
const { loading, errorsMessage, data } = useQuery.contacts()
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/login-email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { config, translate, history, useAuthContext } from "store/index"

import Link from "components/link"
import { Messages } from "components/kratos"
import { Icon } from "@galoymoney/react"
import Icon from "components/icon"

type FCT = React.FC<{
flowData?: KratosFlowData
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {

import Link from "components/link"
import { Messages } from "components/kratos"
import { Icon } from "@galoymoney/react"
import Icon from "components/icon"

type FCT = React.FC<{
flowData?: KratosFlowData
Expand Down
4 changes: 2 additions & 2 deletions src/components/settings/color-theme.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ChangeEvent, useEffect, useState } from "react"

import { Icon } from "@galoymoney/react"

import {
translate,
ColorTheme,
Expand All @@ -11,6 +9,8 @@ import {
storage,
} from "store/index"

import Icon from "components/icon"

const ColorThemeSetting: NoPropsFCT = () => {
const [colorTheme, setColorThemeState] = useState<ColorTheme>("DEFAULT")

Expand Down
4 changes: 2 additions & 2 deletions src/components/settings/email.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon } from "@galoymoney/react"

import { translate, useAuthContext } from "store/index"

import Icon from "components/icon"

type FCT = React.FC<{ guestView: boolean }>

const EmailSetting: FCT = ({ guestView }) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/settings/language.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ChangeEvent } from "react"

import { useMutation } from "@galoymoney/client"
import { Icon } from "@galoymoney/react"

import useMainQuery from "hooks/use-main-query"
import { setLocale, translate, useAppState } from "store/index"

import Icon from "components/icon"

const languageLabels = {
"DEFAULT": "Default (OS)",
"en-US": "English",
Expand Down
5 changes: 3 additions & 2 deletions src/components/settings/username.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useMutation } from "@galoymoney/client"
import { Icon, Spinner } from "@galoymoney/react"
import { Spinner } from "@galoymoney/react"

import { translate } from "store/index"

import useMainQuery from "hooks/use-main-query"

import Icon from "components/icon"

const UsernameInput: React.FC<{ lightningAddressDomain: string }> = ({
lightningAddressDomain,
}) => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/transactions/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import {
GaloyGQL,
truncatedDisplay,
} from "@galoymoney/client"
import { Icon, SatFormat } from "@galoymoney/react"
import { SatFormat } from "@galoymoney/react"

import { config, translate, getLocale } from "store/index"

import Icon from "components/icon"

export const BLOCKCHAIN_EXPLORER_URL = "https://mempool.space/tx/"

const typeDisplay = (type: GaloyGQL.SettlementVia["__typename"]) => {
Expand Down

0 comments on commit 70a0773

Please sign in to comment.