-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
feat(button): add circular shape as round #29161
Changes from all commits
b02881f
59621b9
233a056
76d7f45
bea547b
8be455c
43269c5
2874898
6fd9fdd
6faac2f
b2ee732
dce3c20
e3682d6
c828936
7edaf5c
233a951
9f3d1b1
2e6a531
5384747
919301a
b3b61f0
f44ceee
b58a4e2
73aa34e
ae86371
aa02181
de5ab7c
aee9c7b
0f7febf
2029f80
fa6f783
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { ComponentInterface, EventEmitter } from '@stencil/core'; | ||
import { Component, Element, Event, Host, Prop, Watch, h } from '@stencil/core'; | ||
import { Component, Element, Event, Host, Prop, Watch, State, h } from '@stencil/core'; | ||
import type { AnchorInterface, ButtonInterface } from '@utils/element-interface'; | ||
import type { Attributes } from '@utils/helpers'; | ||
import { inheritAriaAttributes, hasShadowDom } from '@utils/helpers'; | ||
|
@@ -38,6 +38,11 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf | |
|
||
@Element() el!: HTMLElement; | ||
|
||
/** | ||
* If `true`, the button only has an icon. | ||
*/ | ||
@State() isCircle: boolean = false; | ||
|
||
/** | ||
* The color to use from your application's color palette. | ||
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. | ||
|
@@ -295,6 +300,18 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf | |
this.ionBlur.emit(); | ||
}; | ||
|
||
private slotChanged = () => { | ||
/** | ||
* Ensures that the 'has-icon-only' class is properly added | ||
* or removed from `ion-button` when manipulating the | ||
* `icon-only` slot. | ||
* | ||
* Without this, the 'has-icon-only' class is only checked | ||
* or added when `ion-button` component first renders. | ||
*/ | ||
this.isCircle = this.hasIconOnly; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ~ We should explain that we are using a state variable to trigger a re-render of the Stencil component when the slotted content changes, so that I think moving that documentation here to enable the earlier documentation to be more focused on what |
||
}; | ||
|
||
render() { | ||
const mode = getIonMode(this); | ||
const { | ||
|
@@ -374,7 +391,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf | |
{...inheritedAttributes} | ||
> | ||
<span class="button-inner"> | ||
<slot name="icon-only"></slot> | ||
<slot name="icon-only" onSlotchange={this.slotChanged}></slot> | ||
<slot name="start"></slot> | ||
<slot></slot> | ||
<slot name="end"></slot> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the correct value for the large icon only button? The icon is set to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into this now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brandyscarney this is correct. The large button has a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed since the font size is being overwritten through their respective mode files.