mirror of
https://github.com/joinmarket-webui/jam.git
synced 2026-08-16 13:01:05 +02:00
refactor: rename getLogo to currencySymbol
This commit is contained in:
parent
d953e83433
commit
2911172e06
5 changed files with 12 additions and 10 deletions
|
|
@ -15,7 +15,7 @@ export default function JamLanding() {
|
|||
toggleDisplayMode,
|
||||
isPrivate,
|
||||
formatAmount,
|
||||
getLogo,
|
||||
currencySymbol,
|
||||
jars,
|
||||
totalBalance,
|
||||
isLoading,
|
||||
|
|
@ -40,7 +40,7 @@ export default function JamLanding() {
|
|||
>
|
||||
{formatAmount(totalBalance)}{' '}
|
||||
</span>
|
||||
<span className="flex min-h-[48px] items-center">{getLogo('lg')}</span>
|
||||
<span className="flex min-h-[48px] items-center">{currencySymbol('lg')}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ interface NavbarProps {
|
|||
theme: string
|
||||
toggleTheme: () => void
|
||||
formatAmount: (amount: number) => string
|
||||
getLogo: (size: 'sm' | 'lg') => React.ReactNode
|
||||
currencySymbol: (size: 'sm' | 'lg') => React.ReactNode
|
||||
jars: Jar[]
|
||||
isLoading?: boolean
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ const WithActivityIndicator = ({ active, children }: PropsWithChildren<{ active:
|
|||
)
|
||||
}
|
||||
|
||||
export function Navbar({ theme, toggleTheme, formatAmount, getLogo, jars, isLoading = false }: NavbarProps) {
|
||||
export function Navbar({ theme, toggleTheme, formatAmount, currencySymbol, jars, isLoading = false }: NavbarProps) {
|
||||
const { t } = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
const jmSessionState = useStore(jmSessionStore, (state) => state.state)
|
||||
|
|
@ -71,7 +71,7 @@ export function Navbar({ theme, toggleTheme, formatAmount, getLogo, jars, isLoad
|
|||
) : (
|
||||
<>
|
||||
<div className="tabular-nums">{formatAmount(totalBalance)}</div>
|
||||
{getLogo('sm')}
|
||||
{currencySymbol('sm')}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ export function Layout({ children }: LayoutProps) {
|
|||
togglePrivacyMode,
|
||||
toggleDisplayMode,
|
||||
formatAmount,
|
||||
getLogo: (size: 'sm' | 'lg' = 'lg') => <CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />,
|
||||
currencySymbol: (size: 'sm' | 'lg' = 'lg') => (
|
||||
<CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />
|
||||
),
|
||||
jars,
|
||||
totalBalance,
|
||||
walletName,
|
||||
|
|
@ -42,7 +44,7 @@ export function Layout({ children }: LayoutProps) {
|
|||
theme={resolvedTheme || 'dark'}
|
||||
toggleTheme={toggleTheme}
|
||||
formatAmount={formatAmount}
|
||||
getLogo={(size) => <CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />}
|
||||
currencySymbol={displayModeValue.currencySymbol}
|
||||
jars={jars}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export interface DisplayModeContextType {
|
|||
togglePrivacyMode: () => void
|
||||
toggleDisplayMode: () => void
|
||||
formatAmount: (amount: number) => string
|
||||
getLogo: (size?: 'sm' | 'lg') => ReactNode
|
||||
currencySymbol: (size?: 'sm' | 'lg') => ReactNode
|
||||
jars: Jar[]
|
||||
totalBalance: number
|
||||
walletName: string | null
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default meta
|
|||
type Story = StoryObj<typeof Navbar>
|
||||
|
||||
const mockFormatAmount = (amount: number) => `${amount} sats`
|
||||
const mockGetLogo = (size: 'sm' | 'lg') => <Bitcoin size={size === 'sm' ? 18 : 32} />
|
||||
const mockCurrencySymbol = (size: 'sm' | 'lg') => <Bitcoin size={size === 'sm' ? 18 : 32} />
|
||||
const mockJars = [
|
||||
{ name: 'Apricot', balance: 12345, color: '#e2b86a' as JarColor },
|
||||
{ name: 'Blueberry', balance: 67890, color: '#3b5ba9' as JarColor },
|
||||
|
|
@ -32,7 +32,7 @@ export const Default: Story = {
|
|||
theme: 'light',
|
||||
toggleTheme: () => alert('Theme toggled!'),
|
||||
formatAmount: mockFormatAmount,
|
||||
getLogo: mockGetLogo,
|
||||
currencySymbol: mockCurrencySymbol,
|
||||
jars: mockJars,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue