Skip to content
This repository has been archived by the owner on Feb 22, 2025. It is now read-only.

Commit

Permalink
refactor(ui): Use Chip-component
Browse files Browse the repository at this point in the history
  • Loading branch information
tklein1801 committed Sep 23, 2024
1 parent 374dfc4 commit acd00b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
STOCK_SERVICE_HOST=http://localhost:7070
STOCK_SERVICE_WS_HOST=localhost:7070
POCKETBASE_URL=
MAIL_SERVICE_HOST=http://localhost:8050
16 changes: 11 additions & 5 deletions src/components/Stocks/StockPrice.component.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import {TrendingDown, TrendingUp} from '@mui/icons-material';
import {Chip} from '@mui/material';
import React from 'react';

import {LabelBadge, type TLabelBadgeProps} from '@/components/Base';
import {type TLabelBadgeProps} from '@/components/Base';
import {Formatter} from '@/services';

export type TStockPriceProps = {
price: number;
trend?: 'up' | 'down';
currency?: string;
withIcon?: boolean;
} & Pick<TLabelBadgeProps, 'boxProps'>;

export const StockPrice: React.FC<TStockPriceProps> = ({price, trend, currency = 'EUR', boxProps}) => {
export const StockPrice: React.FC<TStockPriceProps> = ({price, trend, withIcon = false, currency = 'EUR'}) => {
return (
<LabelBadge color={trend ? (trend === 'up' ? 'success' : 'error') : 'primary'} {...boxProps}>
{Formatter.formatBalance(price, currency)}
</LabelBadge>
<Chip
variant="outlined"
icon={trend && withIcon ? trend === 'up' ? <TrendingUp /> : <TrendingDown /> : undefined}
color={trend ? (trend === 'up' ? 'success' : 'error') : 'primary'}
label={Formatter.formatBalance(price, currency)}
/>
);
};
4 changes: 2 additions & 2 deletions src/style/theme/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const components: Components<Theme> = {
},
style: {
borderColor: colors.grey![200],
backgroundColor: colors.grey![100],
// backgroundColor: colors.grey![100],
[`& .${chipClasses.label}`]: {
color: colors.grey![500],
},
Expand All @@ -61,7 +61,7 @@ export const components: Components<Theme> = {
},
...theme.applyStyles('dark', {
borderColor: colors.grey![700],
backgroundColor: colors.grey![800],
// backgroundColor: colors.grey![800],
[`& .${chipClasses.label}`]: {
color: colors.grey![300],
},
Expand Down

0 comments on commit acd00b9

Please sign in to comment.