Skip to content

Commit

Permalink
fix: minor PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruminat committed Jun 7, 2024
1 parent d9c1f8e commit 8675b22
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/components/Reactions/Reaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React from 'react';
import {Button, ButtonSize, PaletteOption, PopoverProps, Popup} from '@gravity-ui/uikit';

import {block} from '../utils/cn';
import {useStableCallback} from '../utils/useStableCallback';

import {useReactionsContext} from './context';
import {useReactionsPopup} from './hooks';

export interface ReactionProps extends PaletteOption {
export interface ReactionProps
extends Pick<PaletteOption, 'disabled' | 'title' | 'value' | 'content'> {
/**
* Should be true when the user used this reaction.
*/
Expand Down Expand Up @@ -64,7 +64,7 @@ export function Reaction(props: ReactionInnerProps) {
const {value, disabled, selected, content, counter, tooltip} = props.reaction;
const {size, onClick} = props;

const onClickCallback = useStableCallback(() => onClick?.(value));
const onClickCallback = React.useCallback(() => onClick?.(value), [onClick, value]);

const buttonRef = React.useRef<HTMLButtonElement>(null);
const {onMouseEnter, onMouseLeave} = useReactionsPopup(props.reaction, buttonRef);
Expand Down
10 changes: 5 additions & 5 deletions src/components/Reactions/Reactions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ $block: '.#{variables.$ns}reactions';
}

&__reaction-button-text_size_xs {
font-size: 10px;
font-size: var(--g-text-caption-1-font-size);
}
&__reaction-button-text_size_s {
font-size: 12px;
font-size: var(--g-text-caption-2-font-size);
}
&__reaction-button-text_size_m {
font-size: 13px;
font-size: var(--g-text-body-1-font-size);
}
&__reaction-button-text_size_l {
font-size: 14px;
font-size: var(--g-text-subheader-1-font-size);
}
&__reaction-button-text_size_xl {
font-size: 16px;
font-size: var(--g-text-subheader-2-font-size);
}
}
2 changes: 1 addition & 1 deletion src/components/Reactions/__stories__/Reactions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Flex, Text} from '@gravity-ui/uikit';
import {Meta, StoryFn} from '@storybook/react';

import {Reactions} from '../Reactions';
import {useMockReactions} from '../mock/mockHooks';
import {useMockReactions} from '../__tests__/mock/mockHooks';

export default {
title: 'Components/Reactions',
Expand Down
5 changes: 3 additions & 2 deletions src/components/Reactions/__tests__/Reactions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import {ButtonSize} from '@gravity-ui/uikit';
import userEvent from '@testing-library/user-event';

import {render, screen, within} from '../../../../test-utils/utils';
import {reactionsPalletteMockOption as option} from '../mock/mockData';
import {TestReactions} from '../mock/mockHooks';

import {reactionsPalletteMockOption as option} from './mock/mockData';
import {TestReactions} from './mock/mockHooks';

const qaId = 'reactions-component';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable no-param-reassign */
import React from 'react';

import {Flex, Text, User} from '@gravity-ui/uikit';

import {ReactionProps} from '../Reaction';
import {Reactions, ReactionsProps} from '../Reactions';
import {ReactionProps} from '../../Reaction';
import {Reactions, ReactionsProps} from '../../Reactions';

import {
ReactionsMockUser,
Expand Down

0 comments on commit 8675b22

Please sign in to comment.