Files
ionic-framework/core/src/components/fab-button/fab-button.scss
Brandy Carney a7f1f4daa7 refactor(components): update to use shadow DOM and work with css variables
- updates components to use shadow DOM or scoped if they require css variables
- moves global styles to an external stylesheet that needs to be imported
- adds support for additional colors and removes the Sass loops to generate colors for each component
- several property renames, bug fixes, and test updates

Co-authored-by: Manu Mtz.-Almeida <manu.mtza@gmail.com>
Co-authored-by: Adam Bradley <adambradley25@gmail.com>
Co-authored-by: Cam Wiegert <cam@camwiegert.com>
2018-07-09 12:57:21 -04:00

143 lines
2.7 KiB
SCSS
Executable File

@import "./fab-button.vars";
// Floating Action Buttons
// --------------------------------------------------
:host {
--ion-color-base: #{ion-color(primary, base)};
--ion-color-contrast: #{ion-color(primary, contrast)};
--ion-color-tint: #{ion-color(primary, tint)};
--size: #{$fab-size};
--background: #{current-color(base)};
--transition: background-color, opacity 100ms linear;
--padding-start: calc((#{$fab-size} - var(--size)) / 2);
--padding-end: calc((#{$fab-size} - var(--size)) / 2);
--padding-top: calc((#{$fab-size} - var(--size)) / 2);
--padding-bottom: calc((#{$fab-size} - var(--size)) / 2);
font-size: 14px;
color: #{current-color(contrast)};
}
:host(.activated) {
--background: #{current-color(tint)};
}
.fab-button-native {
@include margin(
var(--padding-top),
var(--padding-end),
var(--padding-bottom),
var(--padding-start)
);
text-align: center;
@include border-radius(50%);
position: relative;
z-index: 0;
display: block;
overflow: hidden;
width: var(--size);
height: var(--size);
border: 0;
font-size: inherit;
font-weight: inherit;
line-height: var(--size);
text-overflow: ellipsis;
text-transform: none;
white-space: nowrap;
color: inherit;
background: var(--background);
box-shadow: var(--box-shadow);
cursor: pointer;
transform: var(--transform);
transition: var(--transition);
background-clip: padding-box;
font-kerning: none;
user-select: none;
contain: strict;
appearance: none;
&:active,
&:focus {
outline: none;
}
}
::slotted(ion-icon) {
line-height: 1;
}
.fab-button-inner {
@include position(0, 0, null, 0);
position: absolute;
display: flex;
flex-flow: row nowrap;
flex-shrink: 0;
align-items: center;
justify-content: center;
align-items: center;
justify-content: center;
height: 100%;
transition: all ease-in-out 300ms;
transition-property: transform, opacity;
}
// FAB Mini
// --------------------------------------------------
:host([mini]) {
--size: #{$fab-mini-size};
}
// FAB Close Icon
// --------------------------------------------------
.fab-button-close-icon {
@include position(0, 0, null, 0);
position: absolute;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
opacity: 0;
transform: scale(.4) rotateZ(-45deg);
transition: all ease-in-out 300ms;
transition-property: transform, opacity;
}
// FAB Animation
// --------------------------------------------------
:host(.fab-button-close-active) .fab-button-close-icon {
opacity: 1;
transform: scale(1) rotateZ(0deg);
}
:host(.fab-button-close-active) .fab-button-inner {
opacity: 0;
transform: scale(.4) rotateZ(45deg);
}
ion-ripple-effect {
color: var(--ripple-color);
}