Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YH-474: add dropdown #321

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

YH-474: add dropdown #321

wants to merge 5 commits into from

Conversation

Fr1Day12
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yeahub-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 6:25pm

};

return (
<div>
Copy link
Owner

Choose a reason for hiding this comment

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

пустой див нужен?

size === 'S' ? styles['option-s'] : styles['option-l'],
);

const [selectedOption, setSelectedOption] = useState<DropdownOption | null>(null);
Copy link
Owner

Choose a reason for hiding this comment

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

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

return (
<ul ref={ref} className={`${dropdownStyle} ${positionStyle}`} role="listbox">
{options.map((option) => (
<DropdownOptions
Copy link
Owner

Choose a reason for hiding this comment

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

Option - единственное число, убрать s
DropdownOption

@@ -0,0 +1,6 @@
export interface DropdownOptionType {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Название без Type

value: string | number;
}

export type Size = 'S' | 'L';
Copy link
Collaborator

Choose a reason for hiding this comment

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

DropdownSize

setSelectedOption?: (option: DropdownOptionType) => void;
}

export const Dropdown: React.FC<DropdownProps> = ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

FC мы не используем

suffix={
suffix || (
<Arrow
className={`${isOpen ? `${styles.suffix} ${styles.active}` : styles.suffix}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут используй classNames

classNames(styles.suffix, { [styles.active]: isOpen })

isSelected: boolean;
}

const DropdownOption: React.FC<DropdownOptionProps> = ({ option, onClick, isSelected }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тоже убери FC

@@ -1 +1,3 @@
export type Size = 'L' | 'S';

export type Variant = 'input' | 'dropdown';
Copy link
Collaborator

Choose a reason for hiding this comment

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

К обоим типам добавь вначале Input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants