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

Add ButtonIcon #194

Closed
wants to merge 2 commits into from
Closed

Add ButtonIcon #194

wants to merge 2 commits into from

Conversation

KlonD90
Copy link
Contributor

@KlonD90 KlonD90 commented Nov 9, 2023

According figma files.

But it's kinda not super at focus but work

@KlonD90 KlonD90 requested a review from ukorvl November 9, 2023 10:38
@@ -0,0 +1,35 @@
import { useStyletron } from "baseui";
Copy link
Member

Choose a reason for hiding this comment

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

forwardRef will be very helpful

@@ -0,0 +1,130 @@
import { StyleObject } from "styletron-standard";
Copy link
Member

Choose a reason for hiding this comment

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

Is there possibility to reuse Button component with overrides and not to copy all of that? Probably there are reasons for that, but imho looks weird

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see reason for me to reuse Button. Because it's kinda non-trivial will be support and lead to worse maintainability of component because of some changes in button will affect this component. I want to make it simple as possible because we already took a path form base web so simplicity is the main point now for me.

Copy link
Member

@ukorvl ukorvl Nov 12, 2023

Choose a reason for hiding this comment

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

Ok, i got your point. Probably then can we create a table of common styles for buttons? Because there is a lot of common styles, and - i guess IconButton will always have the same kinds as Button. Additional styles will be written in particular components, but this we can place inside shared and reuse in both of them.
Something like getButtonKindStyles(), and it is supposed that we will reuse BUTTON_KIND as well.

onClick,
disabled = false,
tabIndex,
href,
Copy link
Member

Choose a reason for hiding this comment

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

Better to restrict href prop if role is button

Copy link
Member

Choose a reason for hiding this comment

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

and if role is link - at least target and rel would be helpful as props

src/components/button-icon/types.ts Show resolved Hide resolved
danger = "danger",
}

export enum BUTTON_ICON_SIZE {
Copy link
Member

Choose a reason for hiding this comment

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

You can omit mini size of usual button, and use BUTTON_SIZE in order not to increase amount of enums

role?: "button" | "link";
href?: string;
icon: ReactElement;
onClick?: (e: MouseEvent) => void;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe its better to use here MouseEvent from react itself (it is generic)

icon: ReactElement;
onClick?: (e: MouseEvent) => void;
disabled?: boolean;
kind?: BUTTON_ICON_KIND;
Copy link
Member

Choose a reason for hiding this comment

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

The same, i suggest to use BUTTON_KIND

@ukorvl
Copy link
Member

ukorvl commented Nov 9, 2023

In general not all requested changes are mandatory. But forward ref, some props changes and reuse code from Button i guess would be helpful.

@ukorvl ukorvl marked this pull request as draft November 23, 2023 09:05
@KlonD90
Copy link
Contributor Author

KlonD90 commented Apr 18, 2024

Don't be actual

@KlonD90 KlonD90 closed this Apr 18, 2024
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.

2 participants