-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beta badges on panels
- Loading branch information
Showing
8 changed files
with
141 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiPanel, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '../../../../src/components'; | ||
|
||
const badges = [null, 'Beta', 'Lab']; | ||
|
||
const panelNodes = badges.map(function (item, index) { | ||
return ( | ||
<EuiFlexItem key={index}> | ||
<EuiPanel | ||
betaBadgeLabel={badges[index]} | ||
betaBadgeTooltipContent={badges[index] ? "This module is not GA. Please help us by reporting any bugs." : undefined} | ||
onClick={() => window.alert('Card clicked')} | ||
> | ||
I am some panel content | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
); | ||
}); | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="l"> | ||
{panelNodes} | ||
</EuiFlexGroup> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@import 'mixins'; | ||
@import 'beta_badge'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
/** | ||
* 1. Extend beta badges to at least 40% of the container's width | ||
*/ | ||
|
||
@mixin hasBetaBadge($selector, $spacing: $euiSize) { | ||
&.#{$selector}--hasBetaBadge { | ||
position: relative; | ||
|
||
.#{$selector}__betaBadgeWrapper { | ||
position: absolute; | ||
top: $euiSizeL/-2; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
z-index: 3; // get above abs positioned image | ||
min-width: 40%; /* 1 */ | ||
max-width: calc(100% - #{$spacing*2}); | ||
|
||
.euiToolTipAnchor, | ||
.#{$selector}__betaBadge { | ||
width: 100%; /* 1 */ | ||
} | ||
|
||
.#{$selector}__betaBadge { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
@import '../badge/beta_badge/mixins'; | ||
|
||
// Export basic class & modifiers | ||
@include euiPanel($selector: 'euiPanel'); | ||
|
||
.euiPanel { | ||
@include hasBetaBadge($selector: 'euiPanel'); | ||
} | ||
|
||
// Specific | ||
@each $modifier, $amount in $euiPanelPaddingModifiers { | ||
.euiPanel.euiPanel--#{$modifier} { | ||
padding: $amount; | ||
|
||
// Overwrite @hasBetaBadge max-width depending upon padding | ||
.euiPanel__betaBadgeWrapper { | ||
max-width: calc(100% - #{$amount*2}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters