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

Upgrade to Design System v3.x #551

Merged
merged 29 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
870ff9d
- Migrated from Less to Sass
Oct 7, 2024
f73eee9
Fixed issues with imported scss files
Oct 8, 2024
b7dad93
Removed old dependencies and theme overrides
Oct 9, 2024
08cfe10
Completed initial fixes for build errors
Oct 9, 2024
2dde8f5
Completed initial fixes for build errors2
Oct 9, 2024
0b30dfd
stylelint less remove
flacoman91 Oct 10, 2024
9db64ea
Fixed config with linting
Oct 10, 2024
2415a62
Merge branch 'DATAP-1558-Upgrade-to-Design-System-v3.x' of github.com…
Oct 10, 2024
7a565ef
Fixed all linting errors
Oct 10, 2024
652faa2
Various updates
Oct 15, 2024
76070c1
Updated col classes to use mixins in new design system
Oct 15, 2024
9742a78
incorporated design system updates into App.scss
Oct 15, 2024
d472a2f
updated tbd components with BEM notation and new design system classes
Oct 16, 2024
5710390
Added licensed-font() mixin to add in fonts
Oct 16, 2024
c4bf2d5
Fixed media query syntax to work with Sass
Oct 17, 2024
bf82546
fixed media queries pt 2
Oct 17, 2024
6756925
fixed width of filter panel by adding a new class
Oct 18, 2024
f0c6bb0
Changed date range label
Oct 18, 2024
6633cdb
swapped out division to math.div() Sass function
Oct 18, 2024
e5d6d85
final cleanup
Oct 18, 2024
63834aa
production built files
Oct 18, 2024
27bea72
took out IE 11 fixes for TileChartMap styles
Oct 18, 2024
2ff7ba8
update dist
flacoman91 Oct 18, 2024
3516436
Addressed PR feedback
Oct 22, 2024
e3f08e7
Merge branch 'DATAP-1558-Upgrade-to-Design-System-v3.x' of github.com…
Oct 22, 2024
7f111b5
Addressed PR feedback #2
Oct 22, 2024
7d33c10
PR feedback updates #3
Oct 22, 2024
d0226db
Removed `from` syntax
Oct 22, 2024
a31d35b
Fixed background colors for modals
Oct 22, 2024
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
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This application allows consumers to search complaints submitted to the CFPB by

#### Technology Stack

This application is written in JavaScript and [Less](http://lesscss.org) within
This application is written in JavaScript and [Sass](https://sass-lang.com/) within
the [React](https://facebook.github.io/react/) + [Redux](http://redux.js.org/)
framework. It uses [Webpack](http://webpack.github.io/docs/) at runtime to
manage module loading.
Expand Down
21 changes: 1 addition & 20 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const CracoEsbuildPlugin = require('craco-esbuild');
const CracoLessPlugin = require('craco-less');
//const CracoLessPlugin = require('craco-less');
const path = require('path');
const {
addAfterLoader,
Expand Down Expand Up @@ -82,24 +82,5 @@ module.exports = {
skipEsbuildJest: true, // Optional. Set to true if you want to use babel for jest tests,
},
},
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
hack: `true;@import (reference) "${require.resolve(
'./src/css/base.less',
)}";`,
},
javascriptEnabled: true,
math: 'always',
paths: [
path.resolve(__dirname, 'node_modules/@cfpb/cfpb-core/src'),
],
},
},
},
},
],
};
10 changes: 2 additions & 8 deletions dist/ccdb5.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ccdb5.css.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ccdb5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ccdb5.js.map

Large diffs are not rendered by default.

33 changes: 10 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"analyze": "craco build; source-map-explorer '../static/js/*.js'",
"build": "NODE_ENV=production ./scripts/build.sh",
"eject": "react-scripts eject",
"lint": "yarn prettier \"src/**/*.{js,jsx,ts,tsx,json,md}\" --write && yarn eslint ./src --fix && yarn stylelint \"src/**/*.{css,less}\" --fix && yarn lint:cypress",
"lint": "yarn prettier \"src/**/*.{js,jsx,ts,tsx,json,md}\" --write && yarn eslint ./src --fix && yarn stylelint \"src/**/*.{css,scss}\" --fix && yarn lint:cypress",
"lint:cypress": "yarn eslint ./cypress --fix",
"prepare": "husky",
"release": "yarn run build && release-it --npm.skipChecks",
Expand All @@ -38,20 +38,10 @@
"@babel/preset-react": "^7.24.7",
"@babel/runtime": "^7.24.7",
"@cfpb/browserslist-config": "0.0.2",
"@cfpb/cfpb-atomic-component": "1.2.0",
"@cfpb/cfpb-buttons": "1.3.0",
"@cfpb/cfpb-core": "1.2.0",
"@cfpb/cfpb-design-system": "^1.3.2",
"@cfpb/cfpb-expandables": "^1.2.0",
"@cfpb/cfpb-forms": "1.3.0",
"@cfpb/cfpb-grid": "1.2.0",
"@cfpb/cfpb-icons": "^1.2.0",
"@cfpb/cfpb-layout": "1.3.0",
"@cfpb/cfpb-notifications": "1.3.0",
"@cfpb/cfpb-pagination": "1.3.0",
"@cfpb/cfpb-tables": "1.2.0",
"@cfpb/cfpb-typography": "1.3.2",
"@cfpb/cfpb-design-system": "^3.2.2",
"@craco/craco": "^7.1.0",
"@csstools/postcss-sass": "^5.1.1",
"@csstools/sass-import-resolve": "^1.0.0",
"@reduxjs/toolkit": "^2.2.7",
"@testing-library/cypress": "^10.0.2",
"@testing-library/dom": "^10.4.0",
Expand All @@ -62,7 +52,6 @@
"britecharts": "git+https://github.com/cfpb/britecharts.git#v2.4.2",
"coveralls": "^3.0.9",
"craco-esbuild": "^0.6.1",
"craco-less": "^3.0.1",
"cypress": "^13.11.0",
"d3": "^7.9.0",
"dayjs": "^1.11.10",
Expand All @@ -79,17 +68,14 @@
"intro.js": "^7.2.0",
"intro.js-react": "1.0.0",
"jest-fetch-mock": "^3.0.3",
"less": "^4.2.0",
"less-loader": "^12.2.0",
"less-plugin-clean-css": "^1.5.1",
"lint-staged": "^15.2.7",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.9.0",
"mockdate": "^3.0.5",
"postcss": "^8.4.38",
"postcss-less": "^6.0.0",
"postcss-preset-env": "^9.5.13",
"postcss-safe-parser": "^7.0.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.3.1",
"prop-types": "^15.5.10",
"query-string": "^9.0.0",
Expand All @@ -103,13 +89,14 @@
"react-scripts": "^5.0.1",
"react-test-renderer": "^18.2.0",
"release-it": "^17.3.0",
"sass": "^1.79.4",
"string-replace-loader": "^3.1.0",
"stylelint": "^16.5.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-less": "^3.0.1"
"stylelint-config-standard-scss": "^13.1.0"
},
"lint-staged": {
"src/**/*.{css,less}": [
"src/**/*.{css,scss}": [
"stylelint --fix"
],
"{cypress,src}/**/*.{js,jsx,ts,tsx,json,md}": [
Expand Down Expand Up @@ -144,10 +131,10 @@
"text-summary"
],
"moduleNameMapper": {
"\\.(css|less)$": "identity-obj-proxy"
"\\.(css|scss)$": "identity-obj-proxy"
},
"transformIgnorePatterns": [
"^.+\\.module\\.(css|less)$"
"^.+\\.module\\.(css|scss)$"
]
},
"publishConfig": {
Expand Down
4 changes: 4 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { pluginProcessIcons } = require('./postcss/postcss-process-icons');
module.exports = {
plugins: [require('autoprefixer'), pluginProcessIcons],
};
48 changes: 48 additions & 0 deletions postcss/postcss-process-icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// modified from
// https://github.com/cfpb/design-system/blob/main/esbuild/plugins/postcss-process-icons.js

const { readFileSync } = require('fs');
const path = require('path');

const currentDir = path.dirname(__filename);

const pluginProcessIcons = () => {
const stripQuotes = (str) => str.replace(/['"]+/g, '');

return {
postcssPlugin: 'process-icons',
Declaration: {
'--cfpb-background-icon-svg': async (decl) => {
const props = decl.value.split(' ');
const iconName = stripQuotes(props[0]);
const iconColor = props.length > 1 ? stripQuotes(props[1]) : '';

const pathToSVG =
currentDir +
'/../node_modules/@cfpb/cfpb-design-system/src/components/cfpb-icons/icons/' +
iconName +
'.svg';
const rawSVG = await readFileSync(pathToSVG, 'utf8', (err, data) => {
// eslint-disable-next-line no-console
if (err) console.log(err);

return data;
});

let cleanSVG = rawSVG;
if (iconColor !== '') {
cleanSVG = rawSVG.replace(
/class="cf-icon-svg .+" /,
`fill="${iconColor}" `,
);
}

decl.prop = 'background-image';
decl.value = `url('data:image/svg+xml;charset=UTF-8,${cleanSVG}')`;
},
},
};
};
pluginProcessIcons.postcss = true;

module.exports = { pluginProcessIcons };
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './css/App.less';
import './css/App.scss';
import { Route, BrowserRouter as Router, Routes } from 'react-router-dom';
import { ComplaintDetail } from './components/ComplaintDetail/ComplaintDetail';
import { SearchComponents } from './components/Search/SearchComponents';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './ActionBar.less';
import './ActionBar.scss';
import { useDispatch, useSelector } from 'react-redux';
import getIcon from '../iconMap';
import { sendAnalyticsEvent } from '../../utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
@use '@cfpb/cfpb-design-system/src/utilities' as *;
@import '../../css/base';

.action-bar {
border: 1px solid var(--gray-40);
border-left: 0; // Don't double the border with the filters
background-color: var(--green-20);
padding: @gutter-normal @grid_gutter-width;
padding: $gutter-normal $grid-gutter-width;

h2 {
margin: 0;

@media @phone {
padding: @gutter-normal;
@media screen and (max-width: $layout-breakpoint-phone-max) {
padding: $gutter-normal;
}
}

.export-results {
padding-top: @gutter-minimum;
padding-top: $gutter-minimum;
margin: 0;
margin-bottom: @gutter-minimum;
margin-bottom: $gutter-minimum;
.a-btn {
margin-right: @gutter-normal;
font-size: @size-v;
margin-right: $gutter-normal;
font-size: $size-v;

svg {
margin-right: @gutter-minimum;
margin-right: $gutter-minimum;
}
}
}
Expand All @@ -44,15 +48,15 @@
}
}

@media @phone {
@media screen and (max-width: $layout-breakpoint-phone-max) {
padding-left: 0;
border: 1px solid var(--gray-40);
.export-results {
margin-left: 15px;
}
}

@media @superwide {
@media screen and (min-width: $layout-breakpoint-superwide-min){
padding-left: 40px;
}
}
2 changes: 1 addition & 1 deletion src/components/Charts/ChartWrapper/ChartWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './ChartWrapper.less';
import './ChartWrapper.scss';
import { ErrorBlock } from '../../Warnings/Error';
import PropTypes from 'prop-types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/LineChart/LineChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './LineChart.less';
import './LineChart.scss';
import * as d3 from 'd3';
import line from 'britecharts/dist/umd/line.min';
import tooltip from 'britecharts/dist/umd/tooltip.min';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
display: none;
}
}
//line on hover for the tooltip.

// line on hover for the tooltip.
.vertical-marker {
stroke: var(--gray-20);
stroke-width: 2px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/RowChart/RowChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './RowChart.less';
import './RowChart.scss';
import * as d3 from 'd3';
import { max } from 'd3-array';
import { miniTooltip, row } from 'britecharts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
@import '../../../css/base';

.row-chart-section {
margin-top: @grid_gutter-width;
margin-left: @grid_gutter-width;
margin-top: $grid-gutter-width;
margin-left: $grid-gutter-width;

p {
max-width: none;
}
}

@media @phone {
@media screen and (max-width: $layout-breakpoint-phone-max) {
.row-chart-section {
margin-left: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/StackedAreaChart/StackedAreaChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './StackedAreaChart.less';
import './StackedAreaChart.scss';
import * as d3 from 'd3';
import { stackedArea } from 'britecharts';
import { useEffect, useMemo } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/TooltipWrapper/TooltipWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './TooltipWrapper.less';
import './TooltipWrapper.scss';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import PropTypes from 'prop-types';
import Tooltip from 'react-bootstrap/Tooltip';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ComplaintDetail/ComplaintDetail.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './ComplaintDetail.less';
import './ComplaintDetail.scss';
import { useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
Expand Down
Loading
Loading