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

New LabelledButton component #11

Open
braaar opened this issue Sep 7, 2021 · 13 comments
Open

New LabelledButton component #11

braaar opened this issue Sep 7, 2021 · 13 comments

Comments

@braaar
Copy link
Contributor

braaar commented Sep 7, 2021

Requirements for the LabelledButton component we want:

  • Must support various variants (colours, border shapes, border thicknesses)
  • Must align icons with text in a proper manner (middle of the icon should align with the middle of the text?)
  • Must give the right color to the icon and the text
  • Must support icons of different kinds.

Good:
Screenshot 2021-09-07 at 10 01 30

Bad:
Screenshot 2021-09-07 at 10 02 00

@braaar
Copy link
Contributor Author

braaar commented Sep 9, 2021

New style:
Screenshot 2021-09-09 at 10 06 04

@simenandre
Copy link
Member

Can this just be a styled Button? or maybe IconButton? I don't understand the name LabelledButton.

@braaar
Copy link
Contributor Author

braaar commented Sep 9, 2021

Very true. I like IconButton. LabelledButton is basically a tautology

@braaar
Copy link
Contributor Author

braaar commented Sep 9, 2021

I'm not sure if we will be able to pull this off with just styling on the button object. We probably need a flex to align the icons properly

@simenandre
Copy link
Member

Right, let's implement a <IconButton /> where one of the inputs is an icon (ReactElement).

E.g.

<IconButton icon={<Icon />} />

Not sure about the name IconButton, considering this: https://theme-ui.com/components/icon-button/

@braaar
Copy link
Contributor Author

braaar commented Sep 10, 2021

Right, let's implement a <IconButton /> where one of the inputs is an icon (ReactElement).

E.g.

<IconButton icon={<Icon />} />

Not sure about the name IconButton, considering this: https://theme-ui.com/components/icon-button/

I like this syntax! I think it will end up being

import {Icon} from 'react-icons';

<IconButton icon={Icon} />

@braaar
Copy link
Contributor Author

braaar commented Sep 10, 2021

Brainstorming names

ButtonWithReactIcon
ReactIconButton
SymbolButton
ActionButton

@seacurrent
Copy link

ActionButton gets my vote.

@simenandre
Copy link
Member

I don't know, isn't all buttons meant to have an action? I'll do some research, see if find some other examples/names.

@braaar
Copy link
Contributor Author

braaar commented Sep 10, 2021

ButtonWithGraphic
ButtonWithSymbol
IndivButton

@simenandre
Copy link
Member

How about AffixButton? As in a button with prefix and suffix, I imagine this contract:

<AffixButton suffix={<Icon />} />
<AffixButton prefix={<Icon />} />
<AffixButton prefix={<PreIcon />} suffix={<AfterIcon />} />

What do you think?

@braaar
Copy link
Contributor Author

braaar commented Sep 24, 2021

The name has its logic, I guess, but it's not intuitive at a glance, in my opinion. Something referring to the fact that the button has an icon, graphic, visual element on it is more intuitive.

I noticed a bug in the current implementation. There is a small margin on the text label which does not trigger the onClick action and also does not show the mouse as a cursor.

Screen.Recording.2021-09-24.at.14.49.57.mov

@braaar
Copy link
Contributor Author

braaar commented Sep 24, 2021

Actually, the entire text area does not trigger the onClick.

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 a pull request may close this issue.

3 participants