Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(button): added fluid prop #6

Merged
merged 2 commits into from Jul 25, 2018
Merged

feat(button): added fluid prop #6

merged 2 commits into from Jul 25, 2018

Conversation

bmdalex
Copy link
Collaborator

@bmdalex bmdalex commented Jul 24, 2018

Button (fluid prop)

This PR will introduce possibility to specify fluid buttons

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

fluid

fluid will allow a button to take the width of its container.

fluid

[The circular prop is one of many shapes. Proposing shapes be grouped as enums under the shape prop.]

<Button fluid content="Fits to Container" />
<button class="ui-button">Fits to Container</button>

@bmdalex
Copy link
Collaborator Author

bmdalex commented Jul 24, 2018

@levithomason
@kuzhelov
@mnajdova
ready for revew

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #6 into master will increase coverage by 0.14%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   84.08%   84.22%   +0.14%     
==========================================
  Files          58       58              
  Lines         779      786       +7     
  Branches      157      158       +1     
==========================================
+ Hits          655      662       +7     
  Misses        120      120              
  Partials        4        4
Impacted Files Coverage Δ
src/components/Button/buttonRules.ts 100% <100%> (ø) ⬆️
src/components/Button/Button.tsx 100% <100%> (ø) ⬆️
src/components/Layout/layoutRules.ts 100% <0%> (ø) ⬆️
src/components/Layout/Layout.tsx 86.95% <0%> (ø) ⬆️
src/components/Chat/chatMessageRules.ts 80% <0%> (ø) ⬆️

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 1cb3b38...5bac54d. Read the comment docs.

class Button extends UIComponent<any, any> {
static displayName = 'Button'
class Button extends UIComponent<IButtonProps, any> {
public static displayName = 'Button'
Copy link
Member

Choose a reason for hiding this comment

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

TS uses public by default in classes. Let's keep the code concise.

Copy link
Collaborator Author

@bmdalex bmdalex Jul 24, 2018

Choose a reason for hiding this comment

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

@levithomason - I'm aware, but I don't like that feature; I feel that with public by default developers are prone to exposing methods that should be private just because the habit of adding a modifier is not enforced; I don't mind reverting tho'

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Want to make sure it is addressed properly as well. If you feel very strongly for this topic, please raise an RFC and let's have some good conversation around it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One other benefit of explicitly deciding we want to declare public is that for an open source project it's going to be easier for contributors to pick up on what should or should not be public. Not sure if there is a tslint rule for this actually, which would be great.

I am still new to TS and I was not aware of the default public nature. Always declaring public/private is probably going to help new contributors.

ElementType,
classes,
rest,
}: IRenderResultConfig<IButtonProps>): ReactNode {
Copy link
Member

Choose a reason for hiding this comment

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

This should already be typed by extension of the UIComponent, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image
doesn't look like it...

root: ({ props, variables }: { props: IButtonProps; variables: IButtonVariables }) => {
const { children, circular, content, fluid, type } = props
const primary = type === 'primary'
const secondary = type === 'secondary'
Copy link
Member

Choose a reason for hiding this comment

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

👍

@levithomason levithomason merged commit 2043af5 into master Jul 25, 2018
@levithomason levithomason deleted the feat/button-fluid branch July 25, 2018 01:12
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.

None yet

3 participants