Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

[SUGGESTION NEEDED] feat(button): added icon support#111

Closed
bmdalex wants to merge 3 commits intomasterfrom
feat/button-icon
Closed

[SUGGESTION NEEDED] feat(button): added icon support#111
bmdalex wants to merge 3 commits intomasterfrom
feat/button-icon

Conversation

@bmdalex
Copy link
Copy Markdown
Collaborator

@bmdalex bmdalex commented Jul 18, 2018

Button

A standard button.

TODO

  • Conformance test
  • Minimal doc site example
  • Stardust base theme
  • Teams Light theme
  • Teams Dark theme
  • Teams Contrast theme
  • Confirm RTL usage
  • W3 accessibility check
  • Stardust accessibility check
  • Update glossary props table
  • Update the CHANGELOG.md

API Proposal

Icon

A button can be made of only an icon.

screen shot 2018-07-18 at 17 20 15

<Button type="primary" icon="book" />

will output

<button>
  <i></i>
</button>

Labeled Icon

A button can use an icon as a label.

screen shot 2018-07-18 at 17 20 24

<Button type="primary" icon="book" content="Click me left" iconPosition="left" />
<Button type="secondary" icon="coffee" content="Click me right" iconPosition="right" />

will output

<button>
  <i></i>
  <span>Click me left</span>
</button>
<button>
  <span>Click me right</span>
  <i></i>
</button>

Circular Emphasis

A button can be circular and formatted to show different levels of emphasis.

screen shot 2018-07-18 at 17 21 09

<Button type="primary" circular icon="coffee" />
<Button type="secondary" circular icon="book" />

will output

<button>
  <i></i>
</button>
<button>
  <i></i>
</button>

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 18, 2018

Codecov Report

Merging #111 into master will increase coverage by 0.29%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #111      +/-   ##
==========================================
+ Coverage    69.8%   70.09%   +0.29%     
==========================================
  Files          75       76       +1     
  Lines        1202     1234      +32     
  Branches      228      240      +12     
==========================================
+ Hits          839      865      +26     
- Misses        358      364       +6     
  Partials        5        5
Impacted Files Coverage Δ
src/components/Button/buttonVariables.ts 100% <ø> (ø) ⬆️
src/components/Icon/iconVariables.ts 100% <ø> (ø) ⬆️
src/components/Icon/iconRules.ts 90.47% <ø> (ø) ⬆️
src/styles/customCSS.ts 100% <100%> (ø)
src/components/Button/Button.tsx 85.18% <84%> (-14.82%) ⬇️
src/components/Button/buttonRules.ts 93.93% <90.47%> (-6.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b7f612...ab457b8. Read the comment docs.

@bmdalex
Copy link
Copy Markdown
Collaborator Author

bmdalex commented Jul 18, 2018

ready for review
@levithomason
@mnajdova
@kuzhelov

@bmdalex bmdalex force-pushed the feat/button-icon branch 2 times, most recently from 4b0f985 to 008d1ce Compare July 18, 2018 19:28
Copy link
Copy Markdown
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

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

I didn't quite finish getting through the components. I will do so tomorrow. Here are some comments for now.

Comment thread CHANGELOG.md Outdated
- Add Avatar component @mnajdova ([#75](https://github.com/stardust-ui/react/pull/75))
- Add Menu `shape` property for describing the shape of the component, instead using the type property @mnajdova ([#68](https://github.com/stardust-ui/react/pull/68))
- Add Input component @alinais ([#64](https://github.com/stardust-ui/react/pull/64))
- Add Icon Button component @Bugaa92 ([#111](https://github.com/stardust-ui/react/pull/111))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggest "Add icon prop to the Button component". Some libraries have actual IconButton components.


const ButtonExampleIcon = () => (
<Button type="primary" style={{ minWidth: '32px', padding: 0 }}>
<Icon name="book" color="white" style={{ margin: 'auto' }} />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No inline styles in doc examples please. Let's show exactly what the components do.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

here is a problem with that - this is file that corresponds to Children API case. In other words, it is where Button component is unaware of its children and, thus, in contrast to shorthand case, cannot introduce any appropriate styles to provide a nice look.

At the same time, we would like the presentation of both Shorthand and Children API cases being consistent with each other, so that Button's look won't suddenly change when user is switching between them for the same example (or do we?). In this case it seems that there are no other means to make these looks consistent other than introducing inline styles.

Another possible option for us could be to remove Children API for this example.

@levithomason, please, let us know about your thoughts.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kuzhelov thanks for detailing the reasons for making the style changes in example;
@levithomason Roman explained very well why inline styles were added, what are your thoughts?

import React from 'react'
import { Button } from 'stardust'

const ButtonExampleLabeledIcon = () => (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Labeled icon means something different in Semantic, suggest calling this "Icon and Content". Buttons can have labels and they can style the icon as a label resulting in a "labeled icon button". We can save that for another discussion and PR.

</Button>
<Button type="secondary">
<span style={{ paddingRight: '10px' }}>Click me right</span>
<Icon name="coffee" style={{ margin: 'auto' }} />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reminder, no inline styles.

<ComponentExample
title="Default"
description="A default Button."
description="A standard button."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should standardize these. I'd propose "default", but would like to hear what the rest of the team thinks.

Copy link
Copy Markdown
Collaborator

@kuzhelov kuzhelov Jul 20, 2018

Choose a reason for hiding this comment

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

my vote is for default - this is consistent with the title

Comment thread src/components/Button/Button.tsx Outdated

/** Add an Icon by name, props object, or pass an <Icon />. */
icon: customPropTypes.some([
PropTypes.bool,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Boolean might be cruft here.

@bmdalex bmdalex requested a review from dvdzkwsk as a code owner July 20, 2018 13:26
@kuzhelov kuzhelov changed the title feat(button): added icon support [SUGGESTION NEEDED] feat(button): added icon support Jul 20, 2018
@kuzhelov
Copy link
Copy Markdown
Collaborator

No inline styles in doc examples please. Let's show exactly what the components do.

here is a problem with that - this is file that corresponds to Children API case. In other words, it is where Button component is unaware of its children and, thus, in contrast to shorthand case, cannot introduce any appropriate styles to provide a nice look.

At the same time, we would like the presentation of both Shorthand and Children API cases being consistent with each other, so that Button's look won't suddenly change when user is switching between them for the same example (or do we?). In this case it seems that there are no other means to make these looks consistent other than introducing inline styles.

Another possible option for us could be to remove Children API for this example.

@levithomason, please, let us know about your thoughts.

@bmdalex
Copy link
Copy Markdown
Collaborator Author

bmdalex commented Jul 25, 2018

Moved to new repo: stardust-ui/react/pull/13

@bmdalex bmdalex closed this Jul 25, 2018
@bmdalex bmdalex deleted the feat/button-icon branch July 25, 2018 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants