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

CIF-1547 - [React Components] Fix CSS reusability #359

Merged
merged 4 commits into from
Aug 4, 2020

Conversation

dplaton
Copy link
Contributor

@dplaton dplaton commented Aug 3, 2020

Description

The styles used by the client-side components could not be overwritten because they were embedded in the JS bundle. This causes the styles to be added to the page using a <style> tag, which means that it took precedence over any styling that was added using custom CSS in other client libraries.

To address this I did two things:

  • drop the style-loader from the Webpack configuration and use MiniCssExtractPlugin to extract the CSS in a separate file.
  • change the name of the generated CSS classes to scope them to the component, i.e. .header__root from the minicart becomes .cmp-Minicart__header__root.

Related Issue

CIF-1547

Motivation and Context

Allow the styling of our client-side components

How Has This Been Tested?

Functional testing

Screenshots (if appropriate):

Types of changes

[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

Daniel Platon and others added 3 commits July 29, 2020 16:10
Extract the CSS in a separate file during build and use a specific element to scope classes by their component name
@dplaton dplaton requested review from mhaack and herzog31 August 3, 2020 11:43
@dplaton dplaton changed the title Bugs/cif 1547 CIF-1547 - [React Components] Fix CSS reusability Aug 3, 2020
@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #359 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #359   +/-   ##
=========================================
  Coverage     84.52%   84.52%           
  Complexity      852      852           
=========================================
  Files           174      174           
  Lines          4400     4400           
  Branches        587      587           
=========================================
  Hits           3719     3719           
  Misses          555      555           
  Partials        126      126           
Flag Coverage Δ Complexity Δ
#integration 66.86% <ø> (ø) 628.00 <ø> (ø)
#jest 77.36% <ø> (ø) 0.00 <ø> (ø)
#karma 93.93% <ø> (ø) 0.00 <ø> (ø)
#unittests 85.81% <ø> (ø) 821.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51c0f71...03bf648. Read the comment docs.

@laurentiumagureanu laurentiumagureanu merged commit f27adc5 into master Aug 4, 2020
@laurentiumagureanu laurentiumagureanu deleted the bugs/CIF-1547 branch August 4, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants