fix(toolbar): add and document custom properties

This commit is contained in:
Cam Wiegert
2018-08-08 11:02:49 -05:00
parent e37ff08664
commit dd114ffe15
6 changed files with 52 additions and 11 deletions

View File

@ -62,6 +62,22 @@ The mode determines which platform styles to use.
Possible values are: `"ios"` or `"md"`.
## CSS Custom Properties
| Name | Description |
| ------------------ | --------------------------------- |
| `--background` | Background of the toolbar |
| `--border-color` | Color of the toolbar border |
| `--border-style` | Style of the toolbar border |
| `--border-width` | Width of the toolbar border |
| `--color` | Color of the toolbar text |
| `--min-height` | Minimum height of the toolbar |
| `--opacity` | Opacity of the toolbar background |
| `--padding-bottom` | Bottom padding of the toolbar |
| `--padding-end` | End padding of the toolbar |
| `--padding-start` | Start padding of the toolbar |
| `--padding-top` | Top padding of the toolbar |
----------------------------------------------

View File

@ -49,11 +49,20 @@
<ion-toolbar color="dark">
<ion-title>Dark</ion-title>
</ion-toolbar>
<ion-toolbar class="custom">
<ion-title>Custom</ion-title>
</ion-toolbar>
</body>
<style>
body {
margin: 0;
}
.custom {
--background: papayawhip;
--color: crimson;
}
</style>
</html>

View File

@ -5,10 +5,9 @@
// --------------------------------------------------
:host {
--ion-color-base: #{$toolbar-ios-background-color};
--ion-color-contrast: #{$toolbar-ios-text-color};
--background: #{$toolbar-ios-background-color};
--color: #{$toolbar-ios-text-color};
--border-color: #{$toolbar-ios-border-color};
--translucent-filter: #{$toolbar-ios-translucent-filter};
--padding-top: #{$toolbar-ios-padding};
--padding-bottom: #{$toolbar-ios-padding};
--padding-start: #{$toolbar-ios-padding};

View File

@ -36,9 +36,6 @@ $toolbar-ios-button-strong-font-weight: 600 !default;
/// @prop - Fill color of the toolbar button icon
$toolbar-ios-button-icon-fill-color: currentColor !default;
/// @prop - Filter of the translucent toolbar
$toolbar-ios-translucent-filter: saturate(180%) blur(20px) !default;
// iOS Title
// --------------------------------------------------

View File

@ -5,8 +5,8 @@
// --------------------------------------------------
:host {
--ion-color-base: #{$toolbar-md-background-color};
--ion-color-contrast: #{$toolbar-md-text-color};
--background: #{$toolbar-md-background-color};
--color: #{$toolbar-md-text-color};
--border-color: #{$toolbar-md-border-color};
--padding-top: #{$toolbar-md-padding};
--padding-bottom: #{$toolbar-md-padding};
@ -14,7 +14,7 @@
--padding-end: #{$toolbar-md-padding};
--min-height: #{$toolbar-md-height};
font-family: #{$toolbar-md-font-family};
font-family: $toolbar-md-font-family;
}

View File

@ -4,9 +4,21 @@
// --------------------------------------------------
:host {
/**
* @prop --background: Background of the toolbar
* @prop --border-color: Color of the toolbar border
* @prop --border-style: Style of the toolbar border
* @prop --border-width: Width of the toolbar border
* @prop --color: Color of the toolbar text
* @prop --min-height: Minimum height of the toolbar
* @prop --opacity: Opacity of the toolbar background
* @prop --padding-bottom: Bottom padding of the toolbar
* @prop --padding-end: End padding of the toolbar
* @prop --padding-start: Start padding of the toolbar
* @prop --padding-top: Top padding of the toolbar
*/
--border-width: 0;
--border-style: solid;
--background: #{current-color(base)};
--opacity: 1;
@include font-smoothing();
@ -15,7 +27,7 @@
width: 100%;
color: #{current-color(contrast)};
color: var(--color);
contain: content;
@ -23,6 +35,14 @@
box-sizing: border-box;
}
:host(.ion-color) {
color: current-color(contrast);
}
:host(.ion-color) .toolbar-background {
background: current-color(base);
}
.toolbar-container {
@include padding(
var(--padding-top),