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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(item-option): add styling for slots other than icon-only #17711

Merged
merged 15 commits into from Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 28 additions & 2 deletions core/src/components/item-option/item-option.scss
Expand Up @@ -38,6 +38,8 @@
@include text-inherit();
@include padding(0, .7em);

display: inline-block;

position: relative;

width: 100%;
Expand All @@ -51,13 +53,14 @@

cursor: pointer;
appearance: none;

box-sizing: border-box;
}

.button-inner {
display: flex;

flex-direction: column;
flex-flow: row nowrap;
flex-flow: column nowrap;
flex-shrink: 0;
align-items: center;
justify-content: center;
Expand All @@ -66,6 +69,29 @@
height: 100%;
}

.horizontal-wrapper {
display: flex;

flex-flow: row nowrap;
flex-shrink: 0;
align-items: center;
justify-content: center;

width: 100%;
}

::slotted(*) {
flex-shrink: 0;
}

::slotted([slot="start"]) {
@include margin(0, 5px, 0, 0);
}

::slotted([slot="end"]) {
@include margin(0, 0, 0, 5px);
}

::slotted([slot="icon-only"]) {
@include padding(0);
@include margin(0, 10px);
Expand Down
14 changes: 8 additions & 6 deletions core/src/components/item-option/item-option.tsx
Expand Up @@ -80,12 +80,14 @@ export class ItemOption implements ComponentInterface {
href={this.href}
>
<span class="button-inner">
<slot name="start"></slot>
<slot name="top" />
<slot name="icon-only" />
<slot></slot>
<slot name="bottom" />
<slot name="end"></slot>
<slot name="top"></slot>
<div class="horizontal-wrapper">
<slot name="start"></slot>
<slot name="icon-only"></slot>
<slot></slot>
<slot name="end"></slot>
</div>
<slot name="bottom"></slot>
</span>
{this.mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
</TagType>
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/item-sliding/item-sliding.tsx
Expand Up @@ -319,10 +319,10 @@ export class ItemSliding implements ComponentInterface {

function swipeShouldReset(isResetDirection: boolean, isMovingFast: boolean, isOnResetZone: boolean): boolean {
// The logic required to know when the sliding item should close (openAmount=0)
// depends on three booleans (isCloseDirection, isMovingFast, isOnCloseZone)
// depends on three booleans (isResetDirection, isMovingFast, isOnResetZone)
// and it ended up being too complicated to be written manually without errors
// so the truth table is attached below: (0=false, 1=true)
// isCloseDirection | isMovingFast | isOnCloseZone || shouldClose
// isResetDirection | isMovingFast | isOnResetZone || shouldClose
// 0 | 0 | 0 || 0
// 0 | 0 | 1 || 1
// 0 | 1 | 0 || 0
Expand Down