Skip to content

Commit

Permalink
review: resolve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
inomdzhon committed Nov 7, 2024
1 parent d90fbc6 commit 9a72112
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
8 changes: 5 additions & 3 deletions packages/vkui/src/components/Clickable/Clickable.module.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
.realClickable {
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}

.resetButtonStyle {
/* stylelint-disable selector-max-type */
button.realClickable {
appearance: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-drag: none;
}

.resetLinkStyle {
a.realClickable {
appearance: none;
-webkit-tap-highlight-color: transparent;
text-decoration: none;
}
/* stylelint-enable selector-max-type */

.host:focus,
.host:focus-visible {
Expand Down
16 changes: 1 addition & 15 deletions packages/vkui/src/components/Clickable/Clickable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,6 @@ function component<T>({
return {};
}

const getUserAgentResetClassName = (Component?: React.ElementType) => {
if (Component === 'a') {
return styles.resetLinkStyle;
}
if (Component === 'button') {
return styles.resetButtonStyle;
}
return;
};

/**
* Базовый кликабельный корневой компонент.
*
Expand All @@ -204,11 +194,7 @@ export const Clickable = <T,>({
}: ClickableProps<T>): React.ReactNode => {
const commonProps = component(restProps);
const isClickable = checkClickable(restProps);
const baseClassName = classNames(
baseClassNameProp,
getUserAgentResetClassName(commonProps.Component),
styles.host,
);
const baseClassName = classNames(baseClassNameProp, styles.host);

if (isClickable) {
return (
Expand Down

0 comments on commit 9a72112

Please sign in to comment.