Skip to content

Commit 472f498

Browse files
authored
Merge pull request #75 from input-output-hk/fix/lw-12272-simple-asset-input
fix: expand simple asset input to occupy 100% width
2 parents 6c6cdad + c8bd477 commit 472f498

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

src/design-system/asset-input/amount-input.component.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
22

3+
import cn from 'classnames';
4+
35
import { Box } from '../box';
46

57
import * as cx from './amount-input.css';
@@ -11,6 +13,8 @@ interface Props {
1113
value?: string;
1214
id: string;
1315
testId?: string;
16+
className?: string;
17+
inputClassName?: string;
1418
}
1519

1620
export const AmountInput = ({
@@ -19,11 +23,13 @@ export const AmountInput = ({
1923
value,
2024
id,
2125
testId,
26+
className,
27+
inputClassName,
2228
}: Readonly<Props>): JSX.Element => {
2329
return (
24-
<Box className={cx.amountInputSizer} data-value={value}>
30+
<Box className={cn(cx.amountInputSizer, className)} data-value={value}>
2531
<input
26-
className={cx.amountInput[alignment]}
32+
className={cn(cx.amountInput[alignment], inputClassName)}
2733
value={value}
2834
size={1}
2935
onChange={({ target }): void => onChange?.(target.value)}

src/design-system/asset-input/asset-input.stories.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ const AssetInputMainComponents = (): JSX.Element => (
3838
</Variants.Row>
3939
);
4040

41+
const SimpleAssetInputMainComponents = (): JSX.Element => (
42+
<Variants.Row>
43+
<Variants.Cell>
44+
<SimpleAssetInput
45+
state={validState('1')}
46+
balanceLabel="Balance Available"
47+
/>
48+
</Variants.Cell>
49+
</Variants.Row>
50+
);
51+
4152
const AssetInputUIStates = (): JSX.Element => (
4253
<>
4354
<Variants.Row>
@@ -94,9 +105,12 @@ export const Overview = (): JSX.Element => (
94105
<Divider my="$64" />
95106

96107
<Section title="Main components">
97-
<ColorSchemaTable headers={['Rest']}>
108+
<ColorSchemaTable headers={['Asset Input']}>
98109
<AssetInputMainComponents />
99110
</ColorSchemaTable>
111+
<ColorSchemaTable headers={['Simple Asset Input']}>
112+
<SimpleAssetInputMainComponents />
113+
</ColorSchemaTable>
100114
</Section>
101115

102116
<Divider my="$64" />

src/design-system/asset-input/simple-asset-input.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export const SimpleAssetInput = ({
3131
onAmountChange?.(state.asset, value);
3232
}}
3333
testId={testId}
34+
className={cx.amountInputContainer}
35+
inputClassName={cx.amountInput}
3436
/>
3537
</Box>
3638
<Box className={cx.balance}>

src/design-system/asset-input/simple-asset-input.css.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export const root = style([
2020

2121
export const amountBox = style({ gridArea: 'amount' });
2222

23+
export const amountInputContainer = style({ display: 'flex' });
24+
25+
export const amountInput = style({ width: '100%' });
26+
2327
export const balance = style({ gridArea: 'balance' });
2428

2529
export const error = style({ gridArea: 'error' });

0 commit comments

Comments
 (0)