Skip to content
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

Design/error alert #1937

Merged
merged 8 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/nervous-glasses-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudfour/patterns': minor
---

Add new Error alert, sad face emoji for the Error alert. There has also been new color tokens added, and a new Status section for those colors.
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions src/assets/icons/sad-emoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/components/alert/alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@
transform: scale(scale.$effect-shrink);
}
}

.c-alert__error {
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
.c-alert__extra {
background-color: color.$status-error-light;
color: color.$status-error-dark;
}
}
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions src/components/alert/alert.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,29 @@ Alerts work well even when displayed at full width. Their contents will constrai
</Story>
</Canvas>

<!-- TODO: Right now the icon needs to be set to the sad emoji.
// As of right now, I don't know how to automatically add the icon on it's own.
// That is a created issue but not a launch blocker.
-->
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved

## Error
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved

The class `c-alert__error` will override the orange default color and make the icon and background red. As of right now, the icon needs to be set to `sad-emoji`. An issue has been created to add it automatically.

AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
<Canvas>
<Story
name="Error"
args={{
message: 'Oops! Something went wrong',
dismissable: true,
class: 'c-alert__error',
icon: 'sad-emoji',
}}
>
{(args) => template(args)}
</Story>
</Canvas>

## Icon

An option to add an icon to the alert. You can add any icon name from our library in the `icon` property. Right now, the color is hardcoded to orange to satisfy the current use case of our offline notification, but it would be nice to add more color options in the future.
Expand Down
17 changes: 17 additions & 0 deletions src/design/colors.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,20 @@ We design and build with accessibility in mind. Color contrast for text should m
colors={[colors.text.action.value]}
/>
</ColorPalette>

## Status Colors

Includes colors that can reflect the status of elements.
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved

<ColorPalette>
<ColorItem
title="$status-error-dark"
subtitle="For errors, intended to be used for the foreground"
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
colors={[colors.status.error_dark.value]}
/>
<ColorItem
title="$status-error-light"
subtitle="For erros, intended for backgrounds"
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
colors={[colors.status.error_light.value]}
/>
</ColorPalette>
12 changes: 12 additions & 0 deletions src/tokens/color/status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"color": {
"status": {
"error_dark": {
"value": "#b50000"
},
"error_light": {
"value": "#ffbdbd"
}
}
}
}