Skip to content

Commit

Permalink
maryia/92124/fix: add long text support to AccumulatorsInfoDisplay (#…
Browse files Browse the repository at this point in the history
…8080)

* fix: add long text support to AccumulatorsInfoDisplay

* chore: improve Maximum ticks by showing 0 if undefined

---------

Co-authored-by: hirad-deriv <hirad@re-work.dev>
  • Loading branch information
maryia-deriv and hirad-deriv committed May 17, 2023
1 parent c252fb4 commit ea7f586
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,27 @@ import { Money, Text } from '@deriv/components';
import classNames from 'classnames';

const AccumulatorsInfoDisplay = ({ currency, maximum_payout, maximum_ticks }) => {
const labels = [localize('Maximum payout'), localize('Maximum ticks')].map((label, index) => (
<Text key={index} size='xxs' weight='bold'>
{label}
</Text>
));

const values = [
<Money key={0} amount={maximum_payout} show_currency currency={currency} />,
localize('{{maximum_ticks}} {{ticks}}', {
maximum_ticks,
ticks: maximum_ticks === 1 ? 'tick' : 'ticks',
}),
].map((value_component, index) => (
<Text key={index} size='xxs' align='right'>
{value_component}
</Text>
));
const content = [
{
label: localize('Maximum payout'),
value: <Money amount={maximum_payout} show_currency currency={currency} />,
},
{
label: localize('Maximum ticks'),
value: `${maximum_ticks || 0} ${maximum_ticks === 1 ? localize('tick') : localize('ticks')}`,
},
];

return (
<Fieldset className={classNames('trade-container__fieldset', 'accu-info-display')}>
{[labels, values].map((text, index) => (
<div key={index} className='accu-info-display__column'>
{text}
{content.map(({ label, value }) => (
<div key={label} className='accu-info-display__row'>
<Text size='xxs' weight='bold' line_height='xxs'>
{label}
</Text>
<Text size='xxs' align='right'>
{value}
</Text>
</div>
))}
</Fieldset>
Expand Down
12 changes: 10 additions & 2 deletions packages/trader/src/sass/app/modules/trading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,21 @@
&.accu-info-display {
height: 7rem;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 1.5rem 1.6rem;

.accu-info-display__column {
.accu-info-display__row {
display: flex;
flex-direction: column;
height: 2rem;
justify-content: space-between;
align-items: center;
span {
line-height: 1rem;
&:not(:first-child) {
flex-shrink: 0;
}
}
}
}
.dc-datepicker {
Expand Down

1 comment on commit ea7f586

@vercel
Copy link

@vercel vercel bot commented on ea7f586 May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

binary.sx
deriv-app.binary.sx
deriv-app-git-master.binary.sx
deriv-app.vercel.app

Please sign in to comment.