Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions docs/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
CfpbLabel,
CfpbList,
CfpbListItem,
CfpbTagline,
CfpbTagFilter,
CfpbTagTopic,
CfpbTagGroup,
Expand Down Expand Up @@ -57,6 +58,7 @@ CfpbFormSearchInput.init();
CfpbLabel.init();
CfpbList.init();
CfpbListItem.init();
CfpbTagline.init();
CfpbTagFilter.init();
CfpbTagTopic.init();
CfpbTagGroup.init();
Expand Down
21 changes: 21 additions & 0 deletions docs/pages/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ status: Released
description: These components are custom elements (web components).
variation_groups:
- variations:
- variation_is_deprecated: false
variation_name: Tagline
variation_description: A US gov branded tagline.
variation_code_snippet_rendered: >-
<div>
<cfpb-tagline></cfpb-tagline>

<br>

<cfpb-tagline islarge></cfpb-tagline>

<br>

<cfpb-tagline>USA</cfpb-tagline>
</div>
variation_code_snippet: >-
<div>
<cfpb-tagline></cfpb-tagline>
<cfpb-tagline islarge></cfpb-tagline>
<cfpb-tagline>USA</cfpb-tagline>
</div>
- variation_is_deprecated: false
variation_name: Icon and Text
variation_description: A basic pairing of an SVG icon and text.
Expand Down
2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/index.css

Large diffs are not rendered by default.

1,392 changes: 717 additions & 675 deletions packages/cfpb-design-system/dist/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:host {
display: inline-block;

// Standard flag size.
width: 24px;
height: 13px;

// 48px x 25px USA flag image.
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAZCAMAAABAf11LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAE5QTFRF////sxlC7MbQ2YyhxlNxCjFhR2WJV3GSKUt1dYumOFh/GT5rhZiwwszYsr/OlKW6Zn6c0djh8PL1iR9Ko7LE4OXrl0pttKC0pXWRtYKbSuJhRQAAANFJREFUeNrkkctuwyAUREnSuW/ApHYf//+jBVdZVcJi3aORgAXcMyLBAAJEzsVG3m8TkifyI3zfPQ6nJJLo421CArSBmkgjNEWtQE4zXJmClXuCWIlU5hdQxCqbqnE1KdIz79CVDvBwZxyKfQfmHTyzl01UZSvOWSTbhZLSWeDMufWLC/1ls3amT4qQq394EjIjApxBT+/nr8eEBNuKcB9SWMpmEXalNOylmlUZNTr4vE/4VdKhpC+leQf6y/e0wzL3RdJtkfUJyzwW+ZcdfgQYAJmJD3zerW6OAAAAAElFTkSuQmCC');
background-size: contain;
background-repeat: no-repeat;
}
14 changes: 14 additions & 0 deletions packages/cfpb-design-system/src/elements/cfpb-flag-usa/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { LitElement } from 'lit';
import styles from './cfpb-flag-usa.component.scss';

/**
* @element cfpb-flag-usa
*/
export class CfpbFlagUsa extends LitElement {
static styles = styles;

static init() {
globalThis.customElements.get('cfpb-flag-usa') ??
globalThis.customElements.define('cfpb-flag-usa', CfpbFlagUsa);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/elements/abstracts' as *;

:host {
.a-tagline {
font-size: math.div(12px, $base-font-size-px) + rem;

display: grid;
grid-template-columns: 22px 1fr;
column-gap: 10px;

&__text {
// Needed for browsers with legacy/no grid support (e.g. IE11).
display: inline-block;
}

& cfpb-flag-usa {
margin-top: 1px;
}

&--large {
font-size: math.div(16px, $base-font-size-px) + rem;

& cfpb-flag-usa {
margin-top: 4px;
}
}
}

.u-nowrap {
white-space: nowrap;
}
}
51 changes: 51 additions & 0 deletions packages/cfpb-design-system/src/elements/cfpb-tagline/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { html, LitElement } from 'lit';
import { CfpbFlagUsa } from '../cfpb-flag-usa';
import styles from './cfpb-tagline.component.scss';

/**
* @element cfpb-icon-text
* @slot - The main content for the text and icon.
*/
export class CfpbTagline extends LitElement {
static styles = styles;

/**
* @property {boolean} disabled - Apply disabled styles or not.
* @returns {object} The map of properties.
*/
static properties = {
isLarge: { type: Boolean, reflect: true },
};

constructor() {
super();
this.isLarge = false;
}

render() {
const baseClasses = ['a-tagline'];
if (this.isLarge) baseClasses.push('a-tagline--large');

return html`
<div
class="${baseClasses.join(' ')}"
aria-label="Official website of the United States government"
>
<cfpb-flag-usa></cfpb-flag-usa>
<div class="a-tagline__text">
<slot>
An official website of the
<span class="u-nowrap">United States government</span>
</slot>
</div>
</div>
`;
}

static init() {
CfpbFlagUsa.init();

globalThis.customElements.get('cfpb-tagline') ??
globalThis.customElements.define('cfpb-tagline', CfpbTagline);
}
}
1 change: 1 addition & 0 deletions packages/cfpb-design-system/src/elements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './cfpb-list';
export * from './cfpb-list-item';
export * from './cfpb-form-search';
export * from './cfpb-form-search-input';
export * from './cfpb-tagline';
export * from './cfpb-tag-filter';
export * from './cfpb-tag-topic';
export * from './cfpb-tag-group';
Expand Down
Loading