Skip to content

Commit

Permalink
add alerts to styleguide
Browse files Browse the repository at this point in the history
  • Loading branch information
rstrangh committed Feb 21, 2018
1 parent 4765940 commit 4fc68ce
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 16 deletions.
23 changes: 8 additions & 15 deletions components/01-atoms/form/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
$default-btn-margin: $spacer-sm;

.btn {
@extend %base-button;
@extend %heading-font-bold;
@include hover-fill($brand-interaction, $button-color, $button-color);
display: inline-block;
position: relative;

margin-bottom: $default-btn-margin;
border: 3px solid $button-border-color;
border-radius: 0;
background-color: $button-background;
cursor: pointer;
padding: $spacer-md $spacer-base;
text-decoration: none;
line-height: $button-medium-line-height;
white-space: nowrap;
font-size: $button-medium-font-size;
user-select: none;

&:focus {
outline: none;
}

&:hover,
&:focus {
text-decoration: none;
}

&--cta {
border-color: $button-cta-border-color;
Expand Down Expand Up @@ -87,6 +74,12 @@ $default-btn-margin: $spacer-sm;
color: $button-inverted-color;
}

&--icon {
border: 0;
background-color: transparent;
padding: $spacer-xxs;
}

& + .btn {
margin-left: $default-btn-margin;
}
Expand Down
30 changes: 30 additions & 0 deletions components/02-molecules/alert/_alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$alert-color: $brand-white;

.alert {
@extend %heading-font-regular;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
padding: $container-spacer-y-sm $container-spacer-x-sm;
line-height: $alert-line-height;
color: $alert-color;
font-size: $alert-font-size;

&--info {
background-color: $brand-info;
}

&--warn {
background-color: $brand-warn;
color: darken($brand-warn, 51%); // Use accessible dark yellow
}

&--error {
background-color: $brand-danger;
}
}

.alert-btn {
@extend %base-button;
color: inherit;
}
7 changes: 7 additions & 0 deletions components/02-molecules/alert/alert--error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="alert alert--error">
<div class="alert-text"><strong>Das hat nicht geklappt!</strong> Bitte füllen Sie alle Felder aus.</div>
<button class="alert-btn" type="button">
<i class="icon icon-close"></i>
<span class="sr-only">Schließen</span>
</button>
</div>
7 changes: 7 additions & 0 deletions components/02-molecules/alert/alert--warn.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="alert alert--warn">
<div class="alert-text"><strong>Das hat nicht geklappt!</strong> Bitte füllen Sie alle Felder aus.</div>
<button class="alert-btn" type="button">
<i class="icon icon-close"></i>
<span class="sr-only">Schließen</span>
</button>
</div>
1 change: 1 addition & 0 deletions components/02-molecules/alert/alert.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
status: wip
7 changes: 7 additions & 0 deletions components/02-molecules/alert/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="alert alert--info">
<div class="alert-text"><strong>Vorsicht!</strong> Vielen Dank.</div>
<button class="alert-btn" type="button">
<i class="icon icon-close"></i>
<span class="sr-only">Schließen</span>
</button>
</div>
1 change: 1 addition & 0 deletions lib/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
@import '../components/01-atoms/text/inline/accentuation/accentuation';

// Molecules
@import '../components/02-molecules/alert/alert';
@import '../components/02-molecules/author-bio/author-bio';
@import '../components/02-molecules/button-group/button-group';
@import '../components/02-molecules/conclusion/conclusion';
Expand Down
4 changes: 3 additions & 1 deletion lib/styles/settings/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ $brand-white: #fff;
//

// State colors
$brand-danger: #f00;
$brand-danger: #f00;
$brand-info: $brand-green-75;
$brand-warn: $brand-yellow-75;

// Gradients and Shadows
$box-shadow-default: 0 4px 6px rgba(0, 0, 0, .3);
Expand Down
4 changes: 4 additions & 0 deletions lib/styles/settings/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,7 @@ $form-control-line-height: 1.375; // ~22px
// Paginator
$paginator-font-size-small: ms(0);
$paginator-font-size: ms(3);

// Alert
$alert-font-size: $companion-font-size; // 21px
$alert-line-height: $base-line-height; // 25px
20 changes: 20 additions & 0 deletions lib/styles/tools/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@
content: '';
}
}

%base-button {
display: inline-block;
position: relative;
border: 0;
background: none;
cursor: pointer;
text-decoration: none;
white-space: nowrap;
user-select: none;

&:focus {
outline: none;
}

&:hover,
&:focus {
text-decoration: none;
}
}

0 comments on commit 4fc68ce

Please sign in to comment.