Skip to content

Commit

Permalink
lib/utils: rm getTitleFromChildren()
Browse files Browse the repository at this point in the history
  • Loading branch information
eugpoloz committed Dec 5, 2023
1 parent 35fa778 commit 8cac8b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/vkui/src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Icon16Cancel } from '@vkontakte/icons';
import { classNames, hasReactNode, noop } from '@vkontakte/vkjs';
import { useAdaptivity } from '../../hooks/useAdaptivity';
import { getTitleFromChildren } from '../../lib/utils';
import { getTextFromChildren } from '../../lib/children';
import { HTMLAttributesWithRootRef } from '../../types';
import { RootComponent } from '../RootComponent/RootComponent';
import { Tappable } from '../Tappable/Tappable';
Expand Down Expand Up @@ -58,7 +58,7 @@ export const Chip = ({
},
[onRemove, value],
);
const title = getTitleFromChildren(children);
const title = getTextFromChildren(children);

return (
<RootComponent
Expand Down
12 changes: 0 additions & 12 deletions packages/vkui/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ export function multiRef<T>(...refs: Array<React.Ref<T> | undefined>): React.Ref
};
}

export function getTitleFromChildren(children: React.ReactNode): string {
let label = '';

React.Children.map(children, (child) => {
if (typeof child === 'string') {
label += ' ' + child;
}
});

return label.trim();
}

export const stopPropagation = <T extends React.SyntheticEvent>(event: T) =>
event.stopPropagation();

Expand Down

0 comments on commit 8cac8b5

Please sign in to comment.