Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit b2f5a9f

Browse files
Googlernshahan
authored andcommitted
Add tooltip multi-sections mixin to material_tooltip directory.
Seems like a common pattern where the normal paper tooltip padding is 24px, but the horizontal divider only has 16px padding above and below. PiperOrigin-RevId: 259836104
1 parent 2700c1f commit b2f5a9f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

angular_components/lib/material_tooltip/_mixins.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,29 @@
8080
}
8181
}
8282
}
83+
84+
$paper-tooltip-default-section-padding: $mat-grid * 3;
85+
$paper-tooltip-midsection-vertical-padding: $mat-grid * 2;
86+
$paper-tooltip-section-border: 1px solid $mat-gray-300;
87+
88+
// Mixin for a multi-section paper tooltip.
89+
//
90+
// This mixin should be applied on the selector for each section.
91+
// For single-section tooltips, the padding is 24px. If a section is
92+
// followed by another section, the bottom padding is 16px and a border
93+
// is drawn between the 2 sections. If a section is preceded by another
94+
// section, the top padding is 16px.
95+
@mixin paper-tooltip-section {
96+
padding: $paper-tooltip-default-section-padding;
97+
98+
&:not(:first-child) {
99+
padding-top: $paper-tooltip-midsection-vertical-padding;
100+
}
101+
102+
// Only show the border when there's a section after the current section.
103+
&:not(:last-child) {
104+
border-bottom: $paper-tooltip-section-border;
105+
padding-bottom: $paper-tooltip-midsection-vertical-padding;
106+
}
107+
}
108+

angular_components/lib/src/material_tooltip/paper_tooltip.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@import 'package:angular_components/css/material/material';
6+
@import 'package:angular_components/material_tooltip/mixins';
67

78
.paper-container {
89
background-color: $mat-white;
@@ -11,7 +12,7 @@
1112
max-height: $mat-grid * 50;
1213
max-width: $mat-grid * 50;
1314
min-width: $mat-grid * 20;
14-
padding: $mat-grid * 3;
15+
padding: $paper-tooltip-default-section-padding;
1516

1617
@media(max-width: $mat-grid * 56) { // account for padding
1718
max-width: 100vw;

0 commit comments

Comments
 (0)