Skip to content

Commit

Permalink
feat: icon refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SHolleworth committed Feb 6, 2025
1 parent 20e7bfd commit 877d159
Show file tree
Hide file tree
Showing 61 changed files with 269 additions and 748 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { exhaustMap } from "rxjs/operators"

import { Button } from "@/client/components/Button"
import { BinIcon } from "@/client/components/icons/BinIcon"
import { CheckCircle } from "@/client/components/icons/CheckCircle"
import { CheckCircleIcon } from "@/client/components/icons/CheckCircleIcon"
import { Typography } from "@/client/components/Typography"
import { ACCEPTED_QUOTE_STATE, RfqState } from "@/generated/TradingGateway"
import {
Expand Down Expand Up @@ -49,7 +49,7 @@ export const AcceptedFooterContent = ({

return (
<>
<CheckCircle />
{CheckCircleIcon}
<Typography
variant="Text xxs/Regular"
color="Colors/Text/text-success-primary (600)"
Expand Down Expand Up @@ -81,7 +81,7 @@ export const TerminatedFooterContent = ({
state: RfqState
}) => (
<CloseRfqButton onClick={() => removeRfqs([rfqId])}>
<BinIcon />
{BinIcon}
<Typography
variant="Text xxs/Regular"
color="Colors/Text/text-secondary (700)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSignal } from "@react-rxjs/utils"
import { exhaustMap } from "rxjs/operators"

import { CheckCircle } from "@/client/components/icons/CheckCircle"
import { CheckCircleIcon } from "@/client/components/icons/CheckCircleIcon"
import { Typography } from "@/client/components/Typography"
import { Color } from "@/client/theme/types"
import {
Expand Down Expand Up @@ -128,7 +128,7 @@ export const Quote = ({
passed={passed}
priced={priced}
>
{accepted && <CheckCircle />}
{accepted && CheckCircleIcon}
<Typography
variant={accepted ? "Text sm/Medium" : "Text sm/Regular"}
color={getPriceColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const Price = styled(Typography)<RowFieldProps>`
`}
svg {
fill: ${({ theme }) =>
color: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-success-primary (600)"]};
margin-right: 4px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export const CardFooterWrapper = styled(FlexBox)`
padding: ${({ theme }) => theme.newTheme.spacing.md};
background: ${({ theme }) =>
theme.newTheme.color["Colors/Background/bg-secondary_subtle"]};
color: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-success-primary (600)"]};
svg {
fill: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-success-primary (600)"]};
margin-right: ${({ theme }) => theme.newTheme.spacing.xs};
}
`
Expand Down Expand Up @@ -124,11 +124,8 @@ export const CloseRfqButton = styled(FooterButton)`
padding: ${({ theme }) => theme.newTheme.spacing.xs}
${({ theme }) => theme.newTheme.spacing.md};
border-radius: ${({ theme }) => theme.newTheme.radius.xs};
svg {
fill: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-brand-tertiary (600)"]};
margin-right: ${({ theme }) => theme.newTheme.spacing.md};
}
color: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-brand-tertiary (600)"]};
`

export const QuantityTypography = styled(Typography)`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import styled from "styled-components"

import { BinIcon } from "@/client/components/icons/BinIcon"
import { TabBar, TabBarActionConfig } from "@/client/components/TabBar"
import { removeRfqs, useExecutedRfqIds } from "@/services/credit"
Expand All @@ -10,19 +8,14 @@ import {
useSelectedRfqsTab,
} from "./selectedRfqsTab"

const BinButton = styled(BinIcon)`
fill: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-quaternary (500)"]};
`

export const CreditRfqsHeader = () => {
const rfqState = useSelectedRfqsTab()
const executedRfqIds = useExecutedRfqIds()

const actions: TabBarActionConfig = [
{
name: "clearRfqs",
inner: <BinButton />,
inner: BinIcon,
onClick: () => removeRfqs(executedRfqIds),
disabled: executedRfqIds.length === 0,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { bind } from "@react-rxjs/core"
import { useCombobox } from "downshift"
import { forwardRef, useMemo, useState } from "react"
import { FaSearch } from "react-icons/fa"
import { map, withLatestFrom } from "rxjs/operators"

import { TextInput } from "@/client/components/Form/TextInput"
import { SearchIcon } from "@/client/components/icons"
import { Typography } from "@/client/components/Typography"
import {
creditInstrumentsByCusip$,
Expand Down Expand Up @@ -55,9 +55,7 @@ export const CreditInstrumentSearch = () => {
<SearchBox onChange={setInstrumentId} ref={inputRef} />
)}
</InputWrapper>
<IconWrapper onClick={showAndResetInput}>
<FaSearch size="0.75em" />
</IconWrapper>
<IconWrapper onClick={showAndResetInput}>{SearchIcon}</IconWrapper>
</InstrumentSearchWrapper>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ export const IconWrapper = styled.div`
margin-left: 5px;
height: 30px;
width: 30px;
color: ${({ theme }) => theme.secondary[5]};
color: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-quaternary (500)"]};
&:hover {
cursor: pointer;
color: ${({ theme }) => theme.accents.primary.base};
color: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-brand-primary (900)"]};
}
`

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/client/App/Footer/Aeron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export const Aeron = () => (
>
Powered by
</Typography>
<AeronLogo height={10} />
{AeronLogo}
</AeronLogoWrapper>
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ export const MainBanner = styled.div<{ isHidden: boolean }>`
`

export const CrossButton = styled.div`
color: ${({ theme }) => theme.newTheme.color["Colors/Text/text-primary_alt"]};
svg {
height: 10px;
fill: ${({ theme }) =>
theme.newTheme.color["Colors/Text/text-primary_alt"]};
}
&:hover {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const PWAInstallBanner = ({

return (
<MainBanner isHidden={isHidden}>
<CrossButton onClick={closeBanner}>{<CrossIcon />}</CrossButton>
<CrossButton onClick={closeBanner}>{CrossIcon}</CrossButton>
<Typography
variant="Text md/Semibold"
color="Colors/Text/text-primary_alt"
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { withTheme } from "styled-components"
import { IconContainer, SwitchContainer } from "@/client/components/Switch"
import { Theme, ThemeName, useTheme } from "@/client/theme"

import DarkThemeIcon from "./DarkThemeIcon"
import LightThemeIcon from "./LightThemeIcon"
import { DarkThemeIcon, LightThemeIcon } from "../../../components/icons"

export type ThemeStorageSwitchProps = Partial<ReactSwitchProps>

Expand Down Expand Up @@ -49,14 +48,10 @@ const ThemeStorageSwitch = ({
onChange={handleChange}
checked={isDarkTheme}
checkedIcon={
<IconContainer hover={hover}>
<DarkThemeIcon />
</IconContainer>
<IconContainer hover={hover}>{DarkThemeIcon}</IconContainer>
}
uncheckedIcon={
<IconContainer hover={hover}>
<LightThemeIcon />
</IconContainer>
<IconContainer hover={hover}>{LightThemeIcon}</IconContainer>
}
handleDiameter={props.handleDiameter || 15}
offColor={theme.newTheme.color["Colors/Background/bg-secondary"]}
Expand All @@ -70,9 +65,7 @@ const ThemeStorageSwitch = ({
{...props}
/>
) : (
<IconContainer hover={hover}>
<Icon />
</IconContainer>
<IconContainer hover={hover}>{Icon}</IconContainer>
)}
</SwitchContainer>
)
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/client/App/LiveRates/LiveRatesCore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@/client/notifications"
import { WithChildren } from "@/client/utils/utilityTypes"

import { MainHeader, mainHeader$ } from "./MainHeader"
import { LiveRatesHeader, mainHeader$ } from "./LiveRatesHeader"
import { Tiles, tiles$ } from "./Tiles"

export const liveRates$ = merge(tiles$, mainHeader$)
Expand All @@ -25,7 +25,7 @@ const LiveRates = ({ children }: WithChildren) => {
<Region
source$={liveRates$}
fallback={children}
Header={<MainHeader />}
Header={<LiveRatesHeader />}
Body={<Tiles />}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { map } from "rxjs/operators"

import { supportsTearOut } from "@/client/App/TearOutSection/supportsTearOut"
import { TearOutComponent } from "@/client/App/TearOutSection/TearOutComponent"
import { ChartIcon } from "@/client/components/icons"
import { TabBar, TabBarActionConfig } from "@/client/components/TabBar/TabBar"
import { currencyPairs$ } from "@/services/currencyPairs"
import { useIsLimitCheckerRunning } from "@/services/limitChecker/limitChecker"
Expand All @@ -19,7 +20,6 @@ import {
useSelectedTileView,
} from "../selectedView"
import { LimitCheckerIndicator } from "./LimitCheckerIndicator"
import { ChartIcon } from "./ToggleView/ChartIcon"

const [useCurrencies, mainHeader$] = bind(
currencyPairs$.pipe(
Expand All @@ -33,7 +33,7 @@ const [useCurrencies, mainHeader$] = bind(

export { mainHeader$ }

export const MainHeader = () => {
export const LiveRatesHeader = () => {
const currencies = useCurrencies()
const currency = useSelectedCurrency()
const isLimitCheckerRunning = useIsLimitCheckerRunning()
Expand All @@ -43,7 +43,7 @@ export const MainHeader = () => {
const actions: TabBarActionConfig = [
{
name: "toggleTileView",
inner: <ChartIcon />,
inner: ChartIcon,
active: tileView === TileView.Analytics,
onClick: onToggleSelectedView,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ccppMock } from "@/services/currencyPairs/__mocks__/_ccpp"

import { liveRates$ } from "../../LiveRatesCore"
import { Tiles } from "../../Tiles"
import { MainHeader } from ".."
import { LiveRatesHeader } from ".."

vi.mock("@/services/currencyPairs/currencyPairs")
vi.mock("../../Tile/Tile.tsx")
Expand Down Expand Up @@ -36,7 +36,7 @@ const renderComponent = async () =>
render(
<TestThemeProvider>
<Subscribe source$={liveRates$} fallback="No data">
<MainHeader />
<LiveRatesHeader />
<Tiles />
</Subscribe>
</TestThemeProvider>,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./LiveRatesHeader"

This file was deleted.

This file was deleted.

Loading

0 comments on commit 877d159

Please sign in to comment.