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

Consolidate packages into cfpb-design-system #2005

Merged
merged 3 commits into from
Aug 8, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ and one that does not require media query support.
Instructions for developers who've received a new or updated icon from a designer:

1. Place SVG file (named with its canonical name, i.e., `canonical.svg`)
in [`packages/cfpb-icons/src/icons`](tree/main/packages/cfpb-icons/src/icons/)
in [`packages/cfpb-design-system/src/components/cfpb-icons/icons`](tree/main/packages/cfpb-design-system/src/components/cfpb-icons/icons/)
1. If it has a `-round` or `-square` version, ensure those are in place as well
1. Run `yarn process-icon-svgs` from the root of the repository
- This script compresses and standardizes the SVG code for all of our icons
- It should be a no-op for icons that have not changed
1. From the repo root, copy the icons into the docs site with `yarn copy-assets'

1. If adding a new icon or updating any names, update the tables on both
[`packages/cfpb-icons/usage.md`](tree/main/packages/cfpb-icons/usage.md)
[`packages/cfpb-design-system/src/components/cfpb-icons/usage.md`](tree/main/packages/cfpb-design-system/src/components/cfpb-icons/usage.md)
and [`docs/pages/iconography.md`](tree/main/docs/pages/iconography.md)
accordingly
1. If any icons were deleted, be sure to delete them from both
`packages/cfpb-icons/src/icons/` and `docs/_includes/icons/`
`packages/cfpb-design-system/src/components/cfpb-icons/icons/` and `docs/_includes/icons/`
2 changes: 1 addition & 1 deletion docs/_includes/search-scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
];
})();
</script>
<script src="{{ site.baseurl }}/dist/js/search.js"></script>
<script src="{{ site.baseurl }}/dist/search.js"></script>
6 changes: 3 additions & 3 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ "/dist/css/main.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/dist/main.css" | relative_url }}">
<script>
// Confirm availability of JS and remove no-js class from html
var docElement = document.documentElement;
Expand All @@ -35,7 +35,7 @@
{% if page.url != 'search/index' and page.url != '/index' %}
{% include footer.html %}
{% endif %}
<script src="{{ "/dist/js/main.js" | relative_url }}" charset="utf-8"></script>
<script src="{{ "/dist/main.js" | relative_url }}" charset="utf-8"></script>

{% if page.is_interstitial %}
<script>
Expand All @@ -55,7 +55,7 @@
{%- endif -%}
{%- endfor -%}
</script>
<script src="{{ "/dist/js/interstitial.js" | relative_url }}" charset="utf-8"></script>
<script src="{{ "/dist/interstitial.js" | relative_url }}" charset="utf-8"></script>
{% endif %}

</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="../dist/js/admin/netlify-cms.js"></script>
<script src="../dist/admin/netlify-cms.js"></script>
<!-- Google Tag Manager code -->
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-WH4L8LB"
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/css/color-swatches.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use 'sass:math';
@import '@cfpb/cfpb-core/src/vars';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

/* Color swatches for Identity/Color page
========================================================================== */
Expand Down
3 changes: 1 addition & 2 deletions docs/assets/css/global-eyebrow.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use 'sass:math';
@import '@cfpb/cfpb-core/src/vars';
@import '@cfpb/cfpb-grid/src/cfpb-grid';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

// Taken from global-eyebrow.scss in cfgov.
.m-global-eyebrow {
Expand Down
1 change: 1 addition & 0 deletions docs/assets/css/grid-demo.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

/* ==========================================================================
Grid Demo
Expand Down
1 change: 1 addition & 0 deletions docs/assets/css/header.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

/* ==========================================================================
Header
Expand Down
3 changes: 2 additions & 1 deletion docs/assets/css/layout.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Taken from enhancements/layout.scss in cfgov-refresh
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

// Taken from enhancements/layout.scss in cfgov-refresh
.wrapper--match-content {
// Tablet and above.
@include respond-to-min($bp-sm-min) {
Expand Down
2 changes: 2 additions & 0 deletions docs/assets/css/main-content.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/utilities' as *;

/* ==========================================================================
Main content
Expand Down
53 changes: 22 additions & 31 deletions docs/assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,31 @@
Design System
========================================================================== */

// Webfont variables
// This is the path for self-hosted fonts.
$cf-fonts-path: '/design-system/fonts';

// Import Design System packages.
@import '@cfpb/cfpb-atomic-component/src/cfpb-atomic-component';
@import '@cfpb/cfpb-core/src/cfpb-core';
@import '@cfpb/cfpb-grid/src/cfpb-grid';
@import '@cfpb/cfpb-icons/src/cfpb-icons';
@import '@cfpb/cfpb-typography/src/cfpb-typography';
@import '@cfpb/cfpb-layout/src/cfpb-layout';
@import '@cfpb/cfpb-buttons/src/cfpb-buttons';
@import '@cfpb/cfpb-forms/src/cfpb-forms';
@import '@cfpb/cfpb-notifications/src/cfpb-notifications';
@import '@cfpb/cfpb-pagination/src/cfpb-pagination';
@import '@cfpb/cfpb-expandables/src/cfpb-expandables';
@import '@cfpb/cfpb-tables/src/cfpb-tables';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/base' as *;
@use '@cfpb/cfpb-design-system/dist/index.css' as *;

// Custom modules.
@import 'sidebar';
@import 'footer';
@import 'skip-nav';
@import 'global-eyebrow';
@import 'layout';
@import 'header';
@import 'main-content';
@import 'code';
@import 'grid-demo';
@import 'netlify';
@import 'tabs';
@import 'toggle-code-button';
@import 'variation';
@import 'color-swatches';
@import 'search';
@use 'sidebar' as *;
@use 'footer' as *;
@use 'skip-nav' as *;
@use 'global-eyebrow' as *;
@use 'layout' as *;
@use 'header' as *;
@use 'main-content' as *;
@use 'code' as *;
@use 'grid-demo' as *;
@use 'netlify' as *;
@use 'tabs' as *;
@use 'toggle-code-button' as *;
@use 'variation' as *;
@use 'color-swatches' as *;
@use 'search' as *;

// Webfont
// This is the path for self-hosted fonts.
@include licensed-font('/design-system/fonts');

// Documentation specific stlyes
html,
Expand Down
2 changes: 2 additions & 0 deletions docs/assets/css/netlify.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

.o-editor {
position: fixed;
bottom: 60px;
Expand Down
2 changes: 2 additions & 0 deletions docs/assets/css/sidebar.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

.ds-nav a {
border-bottom-color: transparent;

Expand Down
2 changes: 2 additions & 0 deletions docs/assets/css/skip-nav.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/components/cfpb-buttons/vars' as *;

/* ==========================================================================
cfgov-refresh
Expand Down
4 changes: 4 additions & 0 deletions docs/assets/css/tabs.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/base' as *;
@use '@cfpb/cfpb-design-system/src/utilities' as *;

// All screen sizes.
.m-tabs {
&__list {
Expand Down
2 changes: 2 additions & 0 deletions docs/assets/css/variation.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/utilities' as *;

/* ==========================================================================
Variation page template
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/admin/netlify-cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ CMS.registerPreviewTemplate('special-pages', genericPreviewTemplate);
CMS.registerPreviewTemplate('pages', pagePreviewTemplate);
CMS.registerPreviewTemplate('side-navigation', navigationPreviewTemplate);

CMS.registerPreviewStyle('/design-system/dist/css/main.css');
CMS.registerPreviewStyle('/design-system/dist/main.css');
7 changes: 3 additions & 4 deletions docs/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import {
ExpandableGroup,
Summary,
SummaryMinimal,
} from '@cfpb/cfpb-expandables';
import { Multiselect } from '@cfpb/cfpb-forms';
import {
Multiselect,
FlyoutMenu,
AlphaTransition,
MaxHeightTransition,
MoveTransition,
} from '@cfpb/cfpb-atomic-component';
} from '@cfpb/cfpb-design-system';
import Tabs from './Tabs.js';
import redirectBanner from './redirect-banner.js';
import sidebar from './sidebar.js';
export * as MainStyles from '../css/main.scss';

redirectBanner.init();
sidebar.init();
Expand Down
8 changes: 5 additions & 3 deletions docs/pages/banner-notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ variation_groups:
</div>
</div>
</div>
variation_description: The warning banner is used to display high-priority
variation_description:
The warning banner is used to display high-priority
system or product level notifications that are not specific to an
immediate task.
variation_name: Warning banner
Expand Down Expand Up @@ -80,7 +81,8 @@ variation_groups:
</div>
</div>
variation_name: Archived content banner
variation_description: The archived content banner is used to identify website
variation_description:
The archived content banner is used to identify website
pages that are outdated and should no longer be referenced for
guidance. These pages may have historical value or significance to
researchers, historians, and the public.
Expand All @@ -100,5 +102,5 @@ redirect_from:
- /banners
last_updated: 2020-01-28T15:55:47.394Z
title: Banner (notification)
behavior: ""
behavior: ''
---
11 changes: 0 additions & 11 deletions docs/pages/helper-classes-mixins.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,6 @@ variation_groups:
variation_group_name: Helper classes
- variation_group_name: Mixins
variations:
- variation_name: '"Align with button" mixin'
variation_description: >-
Align an element vertically with the text within a button that may be
to either side.
_Pass `font-size` as the argument for calculating spacing, default value is `@base-font-size-px`._
`.u-align-with-btn(@font-size: @base-font-size-px);`
variation_code_snippet: ''
- variation_name: '"Flexible proportional containers" mixin'
variation_description: >-
Utilize intrinsic ratios to create a flexible container that retains
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/iconography.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ description: >-
<a class="a-link"
href="https://github.com/cfpb/design-system/tree/main/packages/cfpb-icons/src/icons">
href="https://github.com/cfpb/design-system/tree/main/packages/cfpb-design-system/src/components/cfpb-icons/icons">
<span class="a-link__text">View on GitHub</span>
{% include icons/download.svg %}
</a>
Expand All @@ -663,7 +663,7 @@ description: >-
<a class="a-link"
href="https://github.com/cfpb/design-system/blob/main/packages/cfpb-icons/src/font/CFPBIcons-Regular.otf?raw=true">
href="https://github.com/cfpb/design-system/blob/main/packages/cfpb-design-system/src/components/cfpb-icons/src/font/CFPBIcons-Regular.otf?raw=true">
<span class="a-link__text">Download font</span>
{% include icons/download.svg %}
</a>
Expand All @@ -675,7 +675,7 @@ behavior: >-
### SVG icon basics
The [cfpb-icons](https://github.com/cfpb/design-system/tree/main/packages/cfpb-icons/src/icons) component provides Scalable Vector Graphic (SVG) icons. The filenames of the SVGs included with cfpb-icons match the names in the [icon library](https://cfpb.github.io/design-system/foundation/iconography#icon-library-1) section. We encourage using your templating system to inject the SVG icon files, as opposed to copying and pasting the raw SVG.
The [cfpb-icons](https://github.com/cfpb/design-system/tree/main/packages/cfpb-design-system/src/components/cfpb-icons/icons) component provides Scalable Vector Graphic (SVG) icons. The filenames of the SVGs included with cfpb-icons match the names in the [icon library](https://cfpb.github.io/design-system/foundation/iconography#icon-library-1) section. We encourage using your templating system to inject the SVG icon files, as opposed to copying and pasting the raw SVG.
Note: Jinja2, the templating language that consumerfinance.gov uses, has a near-identical syntax for includes, but it requires that the path be enclosed in quotation marks, like so: `{% include 'icons/download.svg' %}`.
Expand All @@ -684,7 +684,7 @@ behavior: >-
#### What the SCSS is doing
If you look in [cfpb-icons.scss](https://github.com/cfpb/design-system/blob/main/packages/cfpb-icons/src/cfpb-icons.scss) you can see that we have encoded `class="cf-icon-svg"` in the root element of each of our SVG icons. As a result, the CSS rule gets applied to all of the SVGs on the page,
If you look in [cfpb-icons.scss](https://github.com/cfpb/design-system/blob/main/packages/cfpb-design-system/src/components/cfpb-icons/src/cfpb-icons.scss) you can see that we have encoded `class="cf-icon-svg"` in the root element of each of our SVG icons. As a result, the CSS rule gets applied to all of the SVGs on the page,
just like any other HTML element.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ variation_groups:
Override this variable in order to specify a font stack other than the
CFPB's default brand font and fallback.
`@font-stack: 'Avenir Next', Arial, sans-serif;`
`--font-stack: 'Avenir Next', Arial, sans-serif;`
- variation_name: '@font-face file path'
variation_description: >-
Use this variable to point to the file containing your `@font-face`
Expand Down
12 changes: 4 additions & 8 deletions esbuild/docs/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import esbuild from 'esbuild';

import { pluginEsbuildLiquid } from '../plugins/plugin-esbuild-liquid.js';
import { scripts, jsPaths } from './scripts.js';
import { styles, cssPaths } from './styles.js';
import { scripts } from './scripts.js';

const baseConfig = {
logLevel: 'info',
Expand All @@ -15,25 +14,22 @@ const baseConfig = {
'.svg': 'text',
},
outdir: './docs/dist/',
outbase: './docs/assets/',
outbase: './docs/assets/js/',
plugins: [pluginEsbuildLiquid],
};

const arg = process.argv.slice(2)[0];

(async function () {
const scriptsConfig = scripts(baseConfig);
const stylesConfig = styles(baseConfig);
const mergedConfig = { ...scriptsConfig, ...stylesConfig };
mergedConfig.entryPoints = jsPaths.concat(cssPaths);

const ctx = await esbuild.context(scriptsConfig);
if (arg === 'watch') {
const ctx = await esbuild.context(mergedConfig);
await ctx.watch();
// Not disposing context here as the user will ctrl+c to end watching.
} else {
const ctx = await esbuild.context(mergedConfig);
await ctx.rebuild();
await ctx.dispose();
}
//await copy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably delete this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! Removed in 2c0940d

})();
10 changes: 9 additions & 1 deletion esbuild/docs/scripts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { pluginPostCssSass } from '../plugins/plugin-postcss-sass.js';
import autoprefixer from 'autoprefixer';

const jsPaths = [
'./docs/assets/js/interstitial.js',
'./docs/assets/js/main.js',
Expand All @@ -14,7 +17,12 @@ function scripts(baseConfig) {
...baseConfig,
entryPoints: jsPaths,
target: 'es6',
plugins: baseConfig.plugins.concat([
pluginPostCssSass({
plugins: [autoprefixer],
}),
]),
};
}

export { scripts, jsPaths };
export { scripts };
Loading