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

Add "centered" banner component variant #429

Merged
merged 2 commits into from
Mar 19, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### New Features

- Add SVG format option for favicon image. ([#424](https://github.com/18F/identity-design-system/pull/424))
- Add "centered" variant for banner component. ([#429](https://github.com/18F/identity-design-system/pull/429))

### Improvements

Expand Down
20 changes: 20 additions & 0 deletions docs/_components/banner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Banner
lead: Banners identify official websites of government organizations in the United States. They also help visitors understand whether a website is official and secure.
---

{% include helpers/base-component.html component="banner" %}

## Default

{% capture example %}
{% include banner.html id="gov-banner-default" %}
{% endcapture %}
{% include helpers/code-example.html code=example %}

## Centered

{% capture example %}
{% include banner.html centered=true id="gov-banner-centered" %}
{% endcapture %}
{% include helpers/code-example.html code=example %}
12 changes: 9 additions & 3 deletions docs/_includes/banner.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{% comment %}
include
- id (optional, default "gov-banner")
- centered (optional, default false)
{% endcomment %}
{% assign banner_id = include.id | default: 'gov-banner' %}
<section
class="usa-banner"
class="usa-banner{% if include.centered %} usa-banner--centered{% endif %}"
aria-label="Official website of the United States government"
>
<div class="usa-accordion">
Expand All @@ -25,13 +31,13 @@
type="button"
class="usa-accordion__button usa-banner__button"
aria-expanded="false"
aria-controls="gov-banner"
aria-controls="{{ banner_id }}"
>
<span class="usa-banner__button-text">Here’s how you know</span>
</button>
</div>
</header>
<div class="usa-banner__content usa-accordion__content" id="gov-banner">
<div class="usa-banner__content usa-accordion__content" id="{{ banner_id }}">
<div class="grid-row grid-gap-lg">
<div class="usa-banner__guidance tablet:grid-col-6">
<img
Expand Down
6 changes: 6 additions & 0 deletions src/scss/packages/usa-banner/src/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
}
}

.usa-banner--centered .usa-banner__inner {
@include at-media('tablet') {
justify-content: center;
}
}

.usa-accordion__button.usa-banner__button {
// Reset default accordion button border styling for banner button.
@include u-border(0);
Expand Down
Loading