-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
849 additions
and
6 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 |
---|---|---|
|
@@ -86,6 +86,7 @@ | |
} | ||
|
||
select { | ||
font-size: 0.875rem; | ||
appearance: none; | ||
} | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,94 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { browser, element, by } from 'protractor'; | ||
import { colors, alertSizes as sizes } from './component-shared'; | ||
import { waitFor } from './e2e-helper'; | ||
|
||
let alerts: any[] = []; | ||
|
||
function prepareAlerts() { | ||
const result: any[] = []; | ||
|
||
let elementNumber: number = 1; | ||
for (const { colorKey, color } of colors) { | ||
for (const { sizeKey, height } of sizes) { | ||
result.push({ | ||
size: sizeKey, | ||
height: height, | ||
colorKey, | ||
color, | ||
elementNumber, | ||
}); | ||
elementNumber++; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
function prepareAccentAlerts(regularCardsOffset) { | ||
function generateAccentAlerts(accentCardsOffset, colorKey, color) { | ||
return colors.map((c, i) => ({ | ||
name: colorKey, | ||
colorKey, | ||
color, | ||
accentColor: c.color, | ||
accentKey: c.colorKey, | ||
elementNumber: regularCardsOffset + accentCardsOffset + i, | ||
})); | ||
} | ||
|
||
return colors.reduce((accentCards, { colorKey, color }) => { | ||
return accentCards.concat(generateAccentAlerts(accentCards.length, colorKey, color)); | ||
}, []); | ||
} | ||
|
||
describe('nb-alert', () => { | ||
|
||
alerts = prepareAlerts(); | ||
|
||
beforeEach((done) => { | ||
browser.get('#/alert/alert-test.component').then(() => done()); | ||
}); | ||
|
||
alerts.forEach(c => { | ||
|
||
it(`should display ${c.colorKey} alert with ${c.size} size`, () => { | ||
waitFor(`nb-alert:nth-child(${c.elementNumber})`); | ||
expect(element(by.css(`nb-alert:nth-child(${c.elementNumber})`)) | ||
.getText()).toContain('Success message!'); | ||
|
||
element(by.css(`nb-alert:nth-child(${c.elementNumber})`)).getCssValue('height').then(height => { | ||
expect(height).toEqual(c.height); | ||
}); | ||
|
||
element(by.css(`nb-alert:nth-child(${c.elementNumber})`)) | ||
.getCssValue('background-color').then(bgColor => { | ||
expect(bgColor).toEqual(c.color); | ||
}); | ||
}); | ||
}); | ||
|
||
const accentAlerts = prepareAccentAlerts(alerts.length); | ||
accentAlerts.forEach(c => { | ||
it(`should display ${c.colorKey} alert with ${c.accentKey} accent`, () => { | ||
element.all(by.css(`nb-alert`)) | ||
.get(c.elementNumber) | ||
.getCssValue('border-top-color').then(borderColor => { | ||
expect(borderColor).toEqual(c.accentColor, 'Accent is not correct'); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should react on close click', () => { | ||
const all: any = element.all(by.css('nb-alert')); | ||
all.count().then(allCount => { | ||
element(by.css('nb-alert:nth-child(1) > .close')).click(); | ||
expect(all.count()).toEqual(allCount - 1); | ||
}); | ||
}); | ||
}); |
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
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
127 changes: 127 additions & 0 deletions
127
src/framework/theme/components/alert/_alert.component.theme.scss
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,127 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
@mixin nb-alert-header() { | ||
padding: nb-theme(alert-padding); | ||
border-bottom: 1px solid nb-theme(alert-separator); | ||
border-top-left-radius: nb-theme(alert-border-radius); | ||
border-top-right-radius: nb-theme(alert-border-radius); | ||
color: nb-theme(alert-fg-heading); | ||
|
||
|
||
|
||
@include nb-headings(); | ||
} | ||
|
||
@mixin nb-alert-theme() { | ||
nb-alert { | ||
font-size: nb-theme(alert-font-size); | ||
line-height: nb-theme(alert-line-height); | ||
font-weight: nb-theme(alert-font-weight); | ||
|
||
background: nb-theme(alert-bg); | ||
color: nb-theme(alert-fg); | ||
// TODO: move alert margin style to layout | ||
margin-bottom: nb-theme(alert-margin); | ||
border-radius: nb-theme(alert-border-radius); | ||
box-shadow: nb-theme(alert-shadow); | ||
padding: nb-theme(alert-padding); | ||
|
||
@include nb-scrollbars( | ||
nb-theme(scrollbar-fg), | ||
nb-theme(scrollbar-bg), | ||
nb-theme(scrollbar-width)); | ||
|
||
&.xxsmall-alert { | ||
height: nb-theme(alert-height-xxsmall); | ||
} | ||
&.xsmall-alert { | ||
height: nb-theme(alert-height-xsmall); | ||
} | ||
&.small-alert { | ||
height: nb-theme(alert-height-small); | ||
} | ||
&.medium-alert { | ||
height: nb-theme(alert-height-medium); | ||
} | ||
&.large-alert { | ||
height: nb-theme(alert-height-large); | ||
} | ||
&.xlarge-alert { | ||
height: nb-theme(alert-height-xlarge); | ||
} | ||
&.xxlarge-alert { | ||
height: nb-theme(alert-height-xxlarge); | ||
} | ||
|
||
&.active-alert { | ||
background-color: nb-theme(alert-active-bg); | ||
} | ||
&.disabled-alert { | ||
background-color: nb-theme(alert-disabled-bg); | ||
color: nb-theme(alert-disabled-fg); | ||
} | ||
&.primary-alert { | ||
background-color: nb-theme(alert-primary-bg); | ||
} | ||
&.info-alert { | ||
background-color: nb-theme(alert-info-bg); | ||
} | ||
&.success-alert { | ||
background-color: nb-theme(alert-success-bg); | ||
} | ||
&.warning-alert { | ||
background-color: nb-theme(alert-warning-bg); | ||
} | ||
&.danger-alert { | ||
background-color: nb-theme(alert-danger-bg); | ||
} | ||
|
||
&.accent { | ||
border-top-style: solid; | ||
border-top-width: nb-theme(alert-border-radius); | ||
|
||
& nb-alert-header { | ||
border-radius: 0; | ||
} | ||
} | ||
|
||
&.accent-active { | ||
border-top-color: nb-theme(alert-active-bg); | ||
} | ||
&.accent-disabled { | ||
border-top-color: nb-theme(alert-disabled-bg); | ||
} | ||
&.accent-primary { | ||
border-top-color: nb-theme(alert-primary-bg); | ||
} | ||
&.accent-success { | ||
border-top-color: nb-theme(alert-success-bg); | ||
} | ||
&.accent-info { | ||
border-top-color: nb-theme(alert-info-bg); | ||
} | ||
&.accent-warning { | ||
border-top-color: nb-theme(alert-warning-bg); | ||
} | ||
&.accent-danger { | ||
border-top-color: nb-theme(alert-danger-bg); | ||
} | ||
|
||
.close { | ||
padding: nb-theme(alert-padding); | ||
font-size: 1.5rem; | ||
line-height: 1; | ||
cursor: pointer; | ||
font-family: monospace; | ||
} | ||
|
||
&.closable { | ||
padding-right: nb-theme(alert-closable-padding); | ||
} | ||
} | ||
} | ||
|
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,21 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
} | ||
|
||
.close { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
color: inherit; | ||
background-color: transparent; | ||
border: 0; | ||
-webkit-appearance: none; | ||
} |
Oops, something went wrong.