-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BSD fixes #329: Create initial alert component.
- Loading branch information
Showing
4 changed files
with
122 additions
and
0 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,37 @@ | ||
{# | ||
/** | ||
* Alert component. | ||
* | ||
* Available variables: | ||
* - title: Optional string for the alert header. | ||
* - variant: String alert type: info, error, warning. | ||
* - text: A string of the alert body text. | ||
**/ | ||
#} | ||
|
||
|
||
{% set heading_type = heading_type | default("h4") %} | ||
|
||
{% if attributes is empty %} | ||
{% set attributes = create_attribute() %} | ||
{% endif %} | ||
|
||
{% set alert_classes = [ | ||
"bix-alert", | ||
(variant ? "bix-alert--" ~ variant), | ||
] | merge(additional_classes | default([])) %} | ||
|
||
<div{{ attributes.addClass(alert_classes) }}> | ||
<div class="bix-alert__body"> | ||
{% if title %} | ||
<{{ heading_type }} class="bix-alert__heading"> | ||
{{ title }} | ||
</{{ heading_type }}> | ||
{% endif %} | ||
{% if text %} | ||
<div class="bix-alert__text"> | ||
{{ text }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> |
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 @@ | ||
@use "uswds-core" as *; | ||
|
||
.bix-alert { | ||
--_alert-color: var(--alert-color, currentColor); | ||
|
||
border-left: 4px solid var(--_alert-color); | ||
|
||
&__heading { | ||
font-family: var(--font-ui); | ||
font-weight: 600; | ||
margin-top: 0; | ||
} | ||
|
||
&__body { | ||
padding: units(1.5) units(2.5); | ||
} | ||
|
||
&__text > :last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.bix-alert--info { | ||
--alert-color: var(--c-info-darker); | ||
} | ||
|
||
.bix-alert--warning { | ||
--alert-color: var(--c-warning); | ||
} |
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,46 @@ | ||
import Alert from "./alert.html.twig"; | ||
import "./alert.scss"; | ||
|
||
export default { | ||
title: "Components/Alert", | ||
tags: ["autodocs"], | ||
component: Alert, | ||
}; | ||
|
||
const defaultContent = { | ||
title: "Important Notice for Applicants", | ||
text: ` | ||
<p> | ||
At Bixal, we want to ensure a transparent and secure application process for all candidates. Please note that: | ||
</p> | ||
<ul> | ||
<li>Our recruiters will never request sensitive personal information (such as social security numbers or banking information).</li> | ||
<li>Our messages will never include requests to download applications or attachments.</li> | ||
<li>Legitimate recruitment communications will always include clear contact details and may reference our public job postings.</li> | ||
</ul> | ||
<p> | ||
If you experience any challenges with your submission or need assistance in completing your application for accessibility purposes, please reach out to us. <strong><a href="mailto:[email protected]">We're here to help</a></strong>! | ||
</p> | ||
`, | ||
}; | ||
|
||
export const Default = { | ||
args: { | ||
heading_type: null, | ||
...defaultContent, | ||
}, | ||
}; | ||
|
||
export const Info = { | ||
args: { | ||
...defaultContent, | ||
variant: "info", | ||
}, | ||
}; | ||
|
||
export const Warning = { | ||
args: { | ||
...defaultContent, | ||
variant: "warning", | ||
}, | ||
}; |