Skip to content

Commit 074ff56

Browse files
committed
fix: update InfoBlock component to adjust button sizes based on container size
1 parent ff080e1 commit 074ff56

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/Assets/IconV2/ic-help-outline.svg

Lines changed: 2 additions & 2 deletions
Loading

src/Shared/Components/InfoBlock/InfoBlock.component.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ComponentSizeType } from '@Shared/constants'
22
import { deriveBorderRadiusAndBorderClassFromConfig } from '@Shared/Helpers'
33
import { InfoBlockProps } from './types'
44
import {
5+
CONTAINER_SIZE_TO_BUTTON_SIZE,
56
CONTAINER_SIZE_TO_CLASS_MAP,
67
SIZE_TO_ICON_CLASS_MAP,
78
VARIANT_TO_BG_MAP,
@@ -82,7 +83,7 @@ const InfoBlock = ({
8283
{renderContent()}
8384
</div>
8485

85-
{buttonProps && <Button {...buttonProps} />}
86+
{buttonProps && <Button {...buttonProps} size={CONTAINER_SIZE_TO_BUTTON_SIZE[size]} />}
8687
</div>
8788
)
8889
}
@@ -95,7 +96,7 @@ const InfoBlock = ({
9596
{renderIcon()}
9697
</div>
9798

98-
{buttonProps && <Button {...buttonProps} />}
99+
{buttonProps && <Button {...buttonProps} size={CONTAINER_SIZE_TO_BUTTON_SIZE[size]} />}
99100
</div>
100101
)
101102
}

src/Shared/Components/InfoBlock/constants.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ReactComponent as ICSuccess } from '@Icons/ic-success.svg'
44
import { ReactComponent as ICWarningY5 } from '@Icons/ic-warning-y5.svg'
55
import { ReactComponent as ICHelp } from '@Icons/ic-help.svg'
66
import { ComponentSizeType } from '@Shared/constants'
7+
import { ButtonProps } from '../Button'
78
import { InfoBlockProps } from './types'
89

910
export const VARIANT_TO_BG_MAP: Record<InfoBlockProps['variant'], string> = {
@@ -31,3 +32,8 @@ export const SIZE_TO_ICON_CLASS_MAP: Record<InfoBlockProps['size'], string> = {
3132
[ComponentSizeType.large]: 'icon-dim-20',
3233
[ComponentSizeType.medium]: 'icon-dim-18',
3334
}
35+
36+
export const CONTAINER_SIZE_TO_BUTTON_SIZE: Record<InfoBlockProps['size'], ButtonProps['size']> = {
37+
[ComponentSizeType.large]: ComponentSizeType.medium,
38+
[ComponentSizeType.medium]: ComponentSizeType.small,
39+
}

0 commit comments

Comments
 (0)