Skip to content

feat(): Introduce alert component #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/_includes/components/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div markdown="div" class="alert alert--{{ include.type }}" role="alert">
{% include_relative assets/icons/alerts/{{ include.type }}.svg %}
{{ include.content }}
</div>
1 change: 1 addition & 0 deletions src/_sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $color-values: (
secondary: #1f477d,
secondary-dark: #435a6f,
gray-light: #f7f9fa,
gray-lighter: #f9fafb,
gray: #a5b0ba,
code-gray: #435a6f,
code-green: #52bd95,
Expand Down
48 changes: 48 additions & 0 deletions src/_sass/components/_alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.alert {
background-color: color(gray-lighter);
border-radius: 4px;
font-size: 14px;
line-height: 1.57;
padding: 15px 20px 15px 50px;
position: relative;

&::before {
content: "";
border-radius: 2px;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 3px;
}

svg {
position: absolute;
left: 20px;
top: 22px;
}

&--info {
&::before {
background-color: color(info);
}
}

&--success {
&::before {
background-color: color(success);
}
}

&--warning {
&::before {
background-color: color(warning);
}
}

&--error {
&::before {
background-color: color(error);
}
}
}
1 change: 1 addition & 0 deletions src/_sass/segment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@import "components/logo";
@import "components/note";
@import "components/button-link";
@import "components/alert";

// Pages
// =================================================
Expand Down
3 changes: 3 additions & 0 deletions src/assets/icons/alerts/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/alerts/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/alerts/success.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/alerts/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ layout: page
Server-side data management is when tag sends data into your web server, then your web server passes that data to the destination system/server.
{% endcapture %}
{% include components/note.html title="Server-side tracking" content=server_side_tracking buttonTitle="Find out more" buttonHref="https://segment.com" %}

{% include components/alert.html type="info" content="This is my sample note." %}
{% include components/alert.html type="success" content="This is my sample note." %}
{% include components/alert.html type="warning" content="This is my sample note." %}
{% include components/alert.html type="error" content="This is my sample note." %}