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

perf: add support of css-variables to redwood #5

Merged
merged 13 commits into from
Aug 9, 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 jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = createConfig('jest', {
modulePathIgnorePatterns: [
'/src/pages-and-resources/utils.test.jsx',
],
testTimeout: 30000,
});
1,754 changes: 1,338 additions & 416 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"start": "fedx-scripts webpack-dev-server --progress",
"start:with-theme": "paragon install-theme && npm start && npm install",
"test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests",
"types": "tsc --noEmit"
"types": "tsc --noEmit",
"replace-variables": "paragon replace-variables -p src -t usage"
},
"husky": {
"hooks": {
Expand All @@ -42,11 +43,11 @@
"@dnd-kit/utilities": "^3.2.2",
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-ai-translations": "^2.0.0",
"@edx/frontend-component-footer": "^13.0.2",
"@edx/frontend-component-header": "^5.1.0",
"@edx/frontend-component-footer": "npm:@edunext/frontend-component-footer@13.0.4-alpha.1",
"@edx/frontend-component-header": "npm:@edunext/[email protected]",
"@edx/frontend-enterprise-hotjar": "^2.0.0",
"@edx/frontend-lib-content-components": "^2.1.7",
"@edx/frontend-platform": "7.0.1",
"@edx/frontend-lib-content-components": "npm:@edunext/[email protected]",
"@edx/frontend-platform": "npm:@edunext/[email protected].1",
"@edx/openedx-atlas": "^0.6.0",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
Expand All @@ -64,8 +65,8 @@
"@openedx-plugins/course-app-teams": "file:plugins/course-apps/teams",
"@openedx-plugins/course-app-wiki": "file:plugins/course-apps/wiki",
"@openedx-plugins/course-app-xpert_unit_summary": "file:plugins/course-apps/xpert_unit_summary",
"@openedx/frontend-plugin-framework": "^1.1.0",
"@openedx/paragon": "^22.2.1",
"@openedx/frontend-plugin-framework": "github:edunext/frontend-plugin-framework#ednx-release/css-variables-1.2.2",
"@openedx/paragon": "23.0.0-alpha.1",
"@reduxjs/toolkit": "1.9.7",
"@tanstack/react-query": "4.36.1",
"classnames": "2.2.6",
Expand Down Expand Up @@ -98,11 +99,11 @@
},
"devDependencies": {
"@edx/browserslist-config": "1.2.0",
"@edx/react-unit-test-utils": "^2.0.0",
"@edx/react-unit-test-utils": "npm:@edunext/react-unit-test-utils@2.0.0-alpha.1",
"@edx/reactifex": "^1.0.3",
"@edx/stylelint-config-edx": "2.3.0",
"@edx/typescript-config": "^1.0.1",
"@openedx/frontend-build": "13.1.0",
"@openedx/frontend-build": "github:edunext/frontend-build#ednx-release/css-variables-13.1.4",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "^8.0.1",
Expand Down
296 changes: 120 additions & 176 deletions plugins/course-apps/proctoring/Settings.test.jsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@import "~@edx/brand/paragon/variables";
@import "~@openedx/paragon/scss/core/utilities-only";

.summary-radio {
display: flex;
align-items: center;
width: 100%;
border-width: $border-width;
border-color: $border-color;
border-radius: $border-radius;
border-width: var(--pgn-size-border-width);
border-color: var(--pgn-color-gray-500);
border-radius: var(--pgn-size-border-radius-base);
border-style: solid;

&:has(input:checked) {
Expand All @@ -27,10 +24,10 @@
}

.reset-units-button {
color: $link-color;
border-width: $border-width;
border-color: $border-color;
border-radius: $border-radius;
color: var(--pgn-color-info-base);
border-width: var(--pgn-size-border-width);
border-color: var(--pgn-color-gray-500);
border-radius: var(--pgn-size-border-radius-base);
border-style: solid;
}

Expand Down
24 changes: 12 additions & 12 deletions src/advanced-settings/scss/AdvancedSettings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
bottom: 0;
width: 100%;
padding: 0 .625rem;
z-index: $zindex-modal;
z-index: var(--pgn-elevation-modal-zindex);
}

.alert-proctoring-error {
Expand Down Expand Up @@ -66,13 +66,13 @@
.setting-sidebar-supplementary {
.setting-sidebar-supplementary-about {
.setting-sidebar-supplementary-about-title {
font: normal $font-weight-bold 1.125rem/1.5rem $font-family-base;
color: $headings-color;
font: normal var(--pgn-typography-font-weight-bold) 1.125rem/1.5rem var(--pgn-typography-font-family-base);
color: var(--pgn-color-headings-base);
margin-bottom: 1.25rem;
}

.setting-sidebar-supplementary-about-descriptions {
font: normal $font-weight-normal .875rem/1.5rem $font-family-base;
font: normal var(--pgn-typography-font-weight-normal) .875rem/1.5rem var(--pgn-typography-font-family-base);
color: $text-color-base;
}
}
Expand All @@ -81,16 +81,16 @@
list-style: none;

.setting-sidebar-supplementary-other-link {
font: normal $font-weight-normal .875rem/1.5rem $font-family-base;
font: normal var(--pgn-typography-font-weight-normal) .875rem/1.5rem var(--pgn-typography-font-family-base);
line-height: 1.5rem;
color: $info-500;
color: var(--pgn-color-info-500);
margin-bottom: .5rem;
}
}

.setting-sidebar-supplementary-other-title {
font: normal $font-weight-bold 1.125rem/1.5rem $font-family-base;
color: $headings-color;
font: normal var(--pgn-typography-font-weight-bold) 1.125rem/1.5rem var(--pgn-typography-font-family-base);
color: var(--pgn-color-headings-base);
margin-bottom: 1.25rem;
}
}
Expand All @@ -102,7 +102,7 @@
display: inline-block;
margin-right: 5px;
margin-bottom: 5px;
color: $danger;
color: var(--pgn-color-danger-base);
}

.modal-error-item-title {
Expand All @@ -113,12 +113,12 @@

.modal-popup-content {
max-width: 200px;
color: $white;
background-color: $black;
color: var(--pgn-color-white);
background-color: var(--pgn-color-black);
filter: drop-shadow(0 2px 4px rgba(0 0 0 / .15));
font-weight: 400;
}

.pgn__modal-popup__arrow::after {
border-top-color: $black;
border-top-color: var(--pgn-color-black);
}
2 changes: 1 addition & 1 deletion src/advanced-settings/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$text-color-base: $gray-700;
$text-color-base: var(--pgn-color-gray-700);
2 changes: 1 addition & 1 deletion src/advanced-settings/setting-card/SettingCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const SettingCard = ({
iconAs={Icon}
alt={intl.formatMessage(messages.helpButtonText)}
variant="primary"
className=" ml-1 mr-2"
className="flex-shrink-0 ml-1 mr-2"
/>
<ModalPopup
hasArrow
Expand Down
50 changes: 25 additions & 25 deletions src/assets/scss/_form.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.form-group-custom {
.pgn__form-label {
font: normal $font-weight-bold .75rem/1.25rem $font-family-base;
color: $gray-500;
font: normal var(--pgn-typography-font-weight-bold) .75rem/1.25rem var(--pgn-typography-font-family-base);
color: var(--pgn-color-gray-500);
margin-bottom: .5rem;
}

.pgn__form-control-description,
.pgn__form-text {
font: normal $font-weight-normal .75rem/1.25rem $font-family-base;
color: $gray-500;
font: normal var(--pgn-typography-font-weight-normal) .75rem/1.25rem var(--pgn-typography-font-family-base);
color: var(--pgn-color-gray-500);
margin-top: .5rem;
}

Expand All @@ -19,12 +19,12 @@

.form-group-custom_isInvalid {
input {
border-color: $form-feedback-invalid-color;
border-color: var(--pgn-color-form-feedback-invalid);
}
}

.feedback-error {
color: $form-feedback-invalid-color;
color: var(--pgn-color-form-feedback-invalid);
}
}

Expand All @@ -34,40 +34,40 @@
.datepicker-custom-control {
display: block;
width: 100%;
font-size: $input-font-size;
font-weight: $input-font-weight;
line-height: $input-line-height;
background: $input-bg;
border-color: $input-border-color;
border-width: $input-border-width;
box-shadow: $input-box-shadow;
border-radius: $input-border-radius;
color: $input-color;
padding: $input-padding-y $input-padding-x;
height: $input-height;
font-size: var(--pgn-typography-form-input-font-size-base);
font-weight: var(--pgn-typography-form-input-font-weight);
line-height: var(--pgn-typography-form-input-line-height-base);
background: var(--pgn-color-form-input-bg-base);
border-color: var(--pgn-color-form-input-border);
border-width: var(--pgn-size-form-input-width-border);
box-shadow: var(--pgn-elevation-form-input-base);
border-radius: var(--pgn-size-form-input-radius-border-base);
color: var(--pgn-color-form-input-base);
padding: var(--pgn-spacing-form-input-padding-y-base) var(--pgn-spacing-form-input-padding-x-base);
height: var(--pgn-size-form-input-height-base);
resize: none;

&:focus,
:focus-visible {
color: $input-focus-color;
background-color: $input-bg;
border-color: $input-focus-border-color;
box-shadow: $input-focus-box-shadow;
color: var(--pgn-color-form-input-focus-base);
background-color: var(--pgn-color-form-input-bg-base);
border-color: var(--pgn-color-form-input-focus-border);
box-shadow: var(--pgn-elevation-form-input-focus);
outline: 0;
}

&::placeholder {
color: $input-placeholder-color;
color: var(--pgn-color-form-input-placeholder);
}
}

.datepicker-custom-control_readonly {
border-color: transparent;
background: $input-disabled-bg;
background: var(--pgn-color-form-input-bg-disabled);
}

.datepicker-custom-control_isInvalid {
border-color: $form-feedback-invalid-color;
border-color: var(--pgn-color-form-feedback-invalid);
}

.datepicker-custom-control-icon {
Expand All @@ -76,6 +76,6 @@
right: 1.188rem;
top: 50%;
transform: translateY(-50%);
color: $black;
color: var(--pgn-color-black);
}
}
2 changes: 1 addition & 1 deletion src/assets/scss/_utilities.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.text-black {
color: $black;
color: var(--pgn-color-black);
}

.h-200px {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$text-color-base: $gray-700;
$text-color-base: var(--pgn-color-gray-700);
$text-color-weak: #3E3E3C;
8 changes: 4 additions & 4 deletions src/certificates/layout/header-buttons/HeaderButtons.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ describe('HeaderButtons Component', () => {
expect(previewLink).toHaveAttribute('href', expect.stringContaining(certificatesDataMock.courseModes[0]));

const dropdownButton = getByRole('button', { name: certificatesDataMock.courseModes[0] });
await userEvent.click(dropdownButton);
userEvent.click(dropdownButton);

const verifiedMode = await getByRole('button', { name: certificatesDataMock.courseModes[1] });
await userEvent.click(verifiedMode);
userEvent.click(verifiedMode);

await waitFor(() => {
expect(previewLink).toHaveAttribute('href', expect.stringContaining(certificatesDataMock.courseModes[1]));
Expand All @@ -78,7 +78,7 @@ describe('HeaderButtons Component', () => {
const { getByRole, queryByRole } = renderComponent();

const activationButton = getByRole('button', { name: messages.headingActionsActivate.defaultMessage });
await userEvent.click(activationButton);
userEvent.click(activationButton);

axiosMock.onPost(
getUpdateCertificateApiUrl(courseId, certificatesDataMock.certificates[0].id),
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('HeaderButtons Component', () => {
const { getByRole, queryByRole } = renderComponent();

const deactivateButton = getByRole('button', { name: messages.headingActionsDeactivate.defaultMessage });
await userEvent.click(deactivateButton);
userEvent.click(deactivateButton);

axiosMock.onPost(
getUpdateCertificateApiUrl(courseId, certificatesDataMock.certificates[0].id),
Expand Down
8 changes: 4 additions & 4 deletions src/certificates/scss/Certificates.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.certificates {
.section-title {
color: $black;
color: var(--pgn-color-black);
}

.sub-header-actions {
Expand All @@ -11,7 +11,7 @@

.certificate-details {
.certificate-details__info {
color: $black;
color: var(--pgn-color-black);
justify-content: space-between;
align-items: baseline;
}
Expand All @@ -22,7 +22,7 @@

.certificate-details__info-paragraph-course-number {
flex: 1;
color: $gray-700;
color: var(--pgn-color-gray-700);
text-align: right;
}
}
Expand Down Expand Up @@ -74,7 +74,7 @@
}
}

@media (max-width: map-get($grid-breakpoints, "xl")) {
@media (--pgn-size-breakpoint-max-width-xl) {
.signatory {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion src/content-tags-drawer/ContentTagsCollapsible.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

.add-tags-button:not([disabled]):hover {
background-color: transparent;
color: $info-900 !important;
color: var(--pgn-color-info-900) !important;
}

.react-select-add-tags__control {
Expand Down
Loading
Loading