Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

[FRNT-495] implement accordion component #105

Merged
merged 4 commits into from
May 7, 2021

Conversation

Irinaristova
Copy link
Contributor

No description provided.

@Irinaristova Irinaristova requested review from tatinacher and sergeysova and removed request for tatinacher April 28, 2021 11:51
@github-actions github-actions bot added @atoms Changes inside atoms @molecules labels Apr 28, 2021
src/ui/molecules/accordeon/index.tsx Outdated Show resolved Hide resolved
src/ui/molecules/accordeon/index.tsx Outdated Show resolved Hide resolved
src/ui/molecules/accordeon/index.tsx Outdated Show resolved Hide resolved
src/ui/atoms/input/usage.mdx Show resolved Hide resolved
Comment on lines +4 to +8
if (document.activeElement?.tagName === LI_TAG) {
(document.activeElement?.nextElementSibling as HTMLElement)?.focus();
} else {
(listNode?.firstChild as HTMLElement)?.focus();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще, очень плохо, что handler on key down полагается нас внутреннюю структуру списка. То есть фактически может быть использован только в одном месте — в списке

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Но наверное, это замечание не к этому ПР

const AccordionBase: React.FC<AccordionProps & Variant> = ({
children,
className,
isOpen = true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isOpen = true,
isOpened = true,

open это глагол, он не может описывать состояние. В русском аналогично, нельзя использовать "открыть" для описания состояния, мы используем специальную форму "открыто", в английском аналогично is opened

<div className={className} data-variant={variant}>
<div
data-header
data-open={isContentVisible}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data-open={isContentVisible}
data-opened={isContentVisible}

}) => {
const [isContentVisible, setContentVisible] = React.useReducer((is) => !is, isOpen);

const onKeyDown = React.useCallback(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аккордеон имеет много элементов, смотря на название этой переменной невозможно понять на какой элемент будет добавлен этот хендлер.

Вдруг глобально?

Suggested change
const onKeyDown = React.useCallback(
const onHeaderKeyDown = React.useCallback(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тогда наверно это правило лучше использовать для всех элементов, у которых может быть вложенность ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вопрос не во вложенности, а в качестве именования

@sergeysova sergeysova merged commit e4e2edf into master May 7, 2021
@sergeysova sergeysova deleted the feat/FRNT-495-implement-accordion-component branch May 7, 2021 12:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@atoms Changes inside atoms @molecules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants