Skip to content

Commit

Permalink
fix: FormItem noPadding with removable
Browse files Browse the repository at this point in the history
  • Loading branch information
SevereCloud committed Feb 3, 2025
1 parent d0fb8bd commit 61d744f
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export const FormItemPlayground = (props: ComponentPlaygroundProps) => {
children: [<Input key={0} placeholder="Введите ваше значение" />],
required: [true],
},
{
noPadding: [true],
removable: [undefined, true],
children: [<Input key={0} placeholder="Введите ваше значение" />],
},
]}
>
{(props: FormItemProps) => <FormItem {...props} style={{ maxWidth: '300px' }} />}
Expand Down
1 change: 1 addition & 0 deletions packages/vkui/src/components/FormItem/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const FormItem: React.FC<FormItemProps> & {
}}
removePlaceholder={removePlaceholder}
indent={removable === 'indent'}
noPadding={noPadding}
>
<div className={classNames(styles.removable, 'vkuiInternalFormItem__removable')}>
{wrappedChildren}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/vkui/src/components/Removable/Removable.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
position: relative;
display: flex;
align-items: center;
padding-inline-start: var(--vkui--size_base_padding_horizontal--regular);
transform: translateX(
calc(
-1px * var(--vkui_internal_Removable_remove_offset) *
Expand All @@ -14,6 +13,10 @@
--vkui_internal_Removable_remove_offset_direction: 1;
}

.withPadding {
padding-inline-start: var(--vkui--size_base_padding_horizontal--regular);
}

.rtl {
--vkui_internal_Removable_remove_offset_direction: -1;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/vkui/src/components/Removable/Removable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ interface RemovableOwnProps
* @since 5.4.0
*/
indent?: boolean;
/**
* Убирает базовые отступы для базовой платформы
*/
noPadding?: boolean;
children?: React.ReactNode | ((renderProps: RemovableIosRenderProps) => React.ReactNode);
}

Expand All @@ -173,6 +177,7 @@ export const Removable = ({
toggleButtonTestId,
removeButtonTestId,
disabled,
noPadding,
...restProps
}: RemovableOwnProps): React.ReactNode => {
const platform = usePlatform();
Expand All @@ -188,6 +193,7 @@ export const Removable = ({
<RootComponent
{...restProps}
baseClassName={classNames(
!noPadding && styles.withPadding,
platform === 'ios' && styles.ios,
align === 'start' && styles.alignStart,
indent && styles.indent,
Expand Down

0 comments on commit 61d744f

Please sign in to comment.