Skip to content

Commit 1012b12

Browse files
fix: review comments
1 parent 0fd4d52 commit 1012b12

File tree

6 files changed

+18
-50
lines changed

6 files changed

+18
-50
lines changed

apps/main/src/dex/components/PagePool/components/DetailInfoEstLpTokens.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const DetailInfoEstLpTokens = ({
3434
isBold
3535
loading={formLpTokenExpected.loading}
3636
loadingSkeleton={[85, 23]}
37-
className={formLpTokenExpected.expected.length > 20 ? 'isRow' : ''}
3837
label={t`Minimum LP Tokens:`}
3938
tooltip={
4039
showTooltip ? (

apps/main/src/loan/components/PageCrvUsdStaking/Statistics/AdvancedDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const AdvancedDetails = () => (
2020
label={t`Vault Contract Address`}
2121
value={shortenAddress(SCRVUSD_VAULT_ADDRESS)}
2222
link={networks[Chain.Ethereum].scanAddressPath(SCRVUSD_VAULT_ADDRESS)}
23-
copy
23+
copyValue={SCRVUSD_VAULT_ADDRESS}
2424
copiedTitle={t`Vault contract address copied!`}
2525
/>
2626
</Stack>

apps/main/src/loan/components/PagePegKeepers/components/PegKeeperAdvancedDetails.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export const PegKeeperAdvancedDetails = ({
5353
label={t`Pool`}
5454
value={shortenAddress(poolAddress, { digits: 2 })}
5555
link={getInternalUrl('dex', 'ethereum', `${DEX_ROUTES.PAGE_POOLS}/${poolId}/deposit`)}
56-
copy
5756
copyValue={poolAddress}
5857
testId={`${testId}-action-info-pool`}
5958
/>
@@ -62,7 +61,6 @@ export const PegKeeperAdvancedDetails = ({
6261
label={t`Contract`}
6362
value={shortenAddress(address, { digits: 2 })}
6463
link={`https://etherscan.io/address/${address}`}
65-
copy
6664
copyValue={address}
6765
testId={`${testId}-action-info-contract`}
6866
/>

packages/curve-ui-kit/src/shared/ui/ActionInfo.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const MOCK_SKELETON = 10 // Mock value for skeleton to infer some width
2525

2626
export type ActionInfoSize = 'small' | 'medium' | 'large'
2727

28-
export type ActionInfoProps = Pick<StackProps, 'sx' | 'className'> & {
28+
export type ActionInfoProps = {
2929
/** Label displayed on the left side */
3030
label: ReactNode
3131
/** Custom color for the label text */
@@ -46,11 +46,7 @@ export type ActionInfoProps = Pick<StackProps, 'sx' | 'className'> & {
4646
prevValueColor?: TypographyProps['color']
4747
/** URL to navigate to when clicking the external link button */
4848
link?: string
49-
/** Whether the value can be copied. It also requires a `copyValue` or `value` to be a string */
50-
copy?: boolean
51-
/** Value to be copied.
52-
* Example: copy the full address or amount when `value` is formatted.
53-
* Defaults to the original value (if it's a string!). */
49+
/** Value to be copied (will display a copy button). */
5450
copyValue?: string
5551
/** Message displayed in the snackbar title when the value is copied */
5652
copiedTitle?: string
@@ -66,6 +62,8 @@ export type ActionInfoProps = Pick<StackProps, 'sx' | 'className'> & {
6662
error?: boolean | Error | null
6763
/** Test ID for the component */
6864
testId?: string
65+
/** Additional styles */
66+
sx?: StackProps['sx']
6967
}
7068

7169
const labelSize = {
@@ -98,24 +96,22 @@ const ActionInfo = ({
9896
valueTooltip = '',
9997
link,
10098
size = 'medium',
101-
copy = false,
102-
copyValue: givenCopyValue,
99+
copyValue,
103100
copiedTitle,
104101
loading = false,
105102
error = false,
106103
testId = 'action-info',
107-
...styleProps // sx, className
104+
sx,
108105
}: ActionInfoProps) => {
109106
const [isSnackbarOpen, openSnackbar, closeSnackbar] = useSwitch(false)
110-
const copyValue = (givenCopyValue ?? (typeof value === 'string' ? value : '')).trim()
111107

112108
const copyAndShowSnackbar = useCallback(() => {
113-
void copyToClipboard(copyValue)
109+
void copyToClipboard(copyValue!.trim())
114110
openSnackbar()
115111
}, [copyValue, openSnackbar])
116112

117113
return (
118-
<Stack direction="row" alignItems="center" gap={Spacing.sm} data-testid={testId} {...styleProps}>
114+
<Stack direction="row" alignItems="center" gap={Spacing.sm} data-testid={testId} sx={sx}>
119115
<Typography flexGrow={1} variant={labelSize[size]} color={labelColor ?? 'textSecondary'} textAlign="start">
120116
{label}
121117
</Typography>
@@ -169,7 +165,7 @@ const ActionInfo = ({
169165
</Stack>
170166
</Tooltip>
171167

172-
{copy && copyValue && (
168+
{copyValue && (
173169
<IconButton size="extraSmall" title={copyValue} onClick={copyAndShowSnackbar} color="primary">
174170
<ContentCopy />
175171
</IconButton>

packages/curve-ui-kit/src/shared/ui/stories/ActionInfo.stories.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const meta: Meta<typeof ActionInfo> = {
4545
control: 'text',
4646
description: 'The URL to navigate to when clicking the external link button',
4747
},
48-
copy: {
49-
control: 'boolean',
50-
description: 'Whether or not the value can be copied',
48+
copyValue: {
49+
control: 'text',
50+
description: 'The value to be copied (will display a copy button)',
5151
},
5252
copiedTitle: {
5353
control: 'text',
@@ -73,7 +73,7 @@ const meta: Meta<typeof ActionInfo> = {
7373
valueColor: 'textPrimary',
7474
valueTooltip: 'Contract address',
7575
link: 'https://etherscan.io/address/0x0655977feb2f289a4ab78af67bab0d17aab84367',
76-
copy: true,
76+
copyValue: '',
7777
copiedTitle: 'Contract address copied!',
7878
size: 'small',
7979
loading: false,
@@ -172,7 +172,6 @@ export const WithEmptyValueAndSwitch: Story = {
172172
value: '',
173173
valueRight: <Switch size="small" />,
174174
link: '',
175-
copy: false,
176175
size: 'medium',
177176
},
178177
parameters: {
@@ -202,7 +201,6 @@ export const WithError: Story = {
202201
args: {
203202
error: new Error('Failed to load contract address'),
204203
size: 'medium',
205-
copy: false,
206204
link: '',
207205
},
208206
parameters: {

packages/ui/src/DetailInfo/DetailInfo.tsx

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const VariantToColorMap = {
2525

2626
type Props = {
2727
children: ReactNode
28-
className?: string
2928
isBold?: boolean | null
3029
isDivider?: boolean
3130
isMultiLine?: boolean
@@ -36,19 +35,9 @@ type Props = {
3635
variant?: Variant
3736
}
3837

39-
const OldDetailInfo = ({
40-
className,
41-
isBold,
42-
isDivider,
43-
label,
44-
loading,
45-
loadingSkeleton,
46-
tooltip,
47-
variant,
48-
children,
49-
}: Props) => (
38+
const OldDetailInfo = ({ isBold, isDivider, label, loading, loadingSkeleton, tooltip, variant, children }: Props) => (
5039
<Wrapper
51-
className={`${className} ${isDivider ? 'divider' : ''}`}
40+
className={isDivider ? 'divider' : ''}
5241
grid
5342
gridAutoFlow="column"
5443
gridColumnGap={2}
@@ -67,30 +56,18 @@ const OldDetailInfo = ({
6756
</Wrapper>
6857
)
6958

70-
const NewDetailInfo = ({
71-
className,
72-
isBold,
73-
isDivider,
74-
label,
75-
loading,
76-
loadingSkeleton,
77-
tooltip,
78-
variant,
79-
children,
80-
}: Props) => (
59+
const NewDetailInfo = ({ isBold, isDivider, label, loading, loadingSkeleton, tooltip, variant, children }: Props) => (
8160
<>
8261
{isDivider && <Divider sx={{ marginBlock: Spacing.sm }} />}
8362
<ActionInfo
84-
className={className}
8563
label={label}
8664
value={children || '-'}
8765
valueColor={VariantToColorMap[variant || '']}
8866
valueTooltip={tooltip}
89-
copy={typeof children === 'string'}
9067
error={variant === 'error'}
9168
loading={loading && (loadingSkeleton || true)}
9269
copyValue={typeof children === 'string' ? children : ''}
93-
size={isBold ? 'large' : 'medium'}
70+
{...(isBold && { sx: { '& .MuiTypography-root': { '&': { fontWeight: 'bold' } } } })}
9471
/>
9572
</>
9673
)

0 commit comments

Comments
 (0)