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

fix(icons): removing inline styles from SVG icons #5275

Merged
merged 1 commit into from Apr 6, 2023

Conversation

wojta
Copy link
Member

@wojta wojta commented Dec 17, 2020

What:
Closes #4767

How

  • removing inline style with vertical-align: -0.125em;
  • replacing with CSS style

Additional issues:
patternfly/patternfly#3774

@wojta wojta requested a review from redallen December 17, 2020 16:27
@@ -0,0 +1,5 @@
@charset "UTF-8";

.pf-svg-vertical-align {
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know exactly where to put this CSS class. It would require manually importing this file in the every application for this to work properly.

Copy link
Contributor

@redallen redallen Jan 4, 2021

Choose a reason for hiding this comment

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

Yes, this belongs in https://github.com/patternfly/patternfly or existing applications will not get the styles.

Edit: I'd ask @mcoker where to put it. I suppose you could add it to the base styles.

Copy link
Contributor

Choose a reason for hiding this comment

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

@wojta we have a global PF class stylesheet here where you could add this class https://github.com/patternfly/patternfly/blob/master/src/patternfly/base/_common.scss. Let me know if you'd like me to create the issue/PR.

Copy link
Member Author

@wojta wojta Jan 6, 2021

Choose a reason for hiding this comment

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

@patternfly-build
Copy link
Contributor

patternfly-build commented Dec 17, 2020

@codecov-io
Copy link

codecov-io commented Jan 13, 2021

Codecov Report

Merging #5275 (f733e11) into master (c26b549) will decrease coverage by 0.05%.
The diff coverage is 46.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5275      +/-   ##
==========================================
- Coverage   51.91%   51.85%   -0.06%     
==========================================
  Files         579      579              
  Lines       11272    11321      +49     
  Branches     4184     4201      +17     
==========================================
+ Hits         5852     5871      +19     
- Misses       4683     4710      +27     
- Partials      737      740       +3     
Flag Coverage Δ
patternfly4 51.85% <46.15%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
.../components/ChartUtils/chart-interactive-legend.ts 10.00% <0.00%> (-0.26%) ⬇️
...de-editor/src/components/CodeEditor/CodeEditor.tsx 25.00% <0.00%> (ø)
...es/react-core/src/components/DataList/DataList.tsx 24.36% <0.00%> (-0.64%) ⬇️
...ages/react-core/src/components/Tooltip/Tooltip.tsx 48.35% <0.00%> (-1.10%) ⬇️
...ore/src/components/Wizard/WizardFooterInternal.tsx 100.00% <ø> (ø)
packages/react-icons/src/createIcon.tsx 73.91% <0.00%> (-1.09%) ⬇️
...t-table/src/components/Table/utils/headerUtils.tsx 95.00% <ø> (ø)
...-core/src/components/Drawer/DrawerPanelContent.tsx 30.70% <29.62%> (-1.34%) ⬇️
...ages/react-core/src/components/Spinner/Spinner.tsx 63.63% <33.33%> (-36.37%) ⬇️
...ckages/react-core/src/components/Select/Select.tsx 40.57% <42.85%> (+0.31%) ⬆️
... and 7 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 d1e8e28...f733e11. Read the comment docs.

@wojta wojta requested a review from mcoker January 14, 2021 00:01
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

I'm not seeing the styles applied - looks like this needs a core bump?

@wojta
Copy link
Member Author

wojta commented Jan 14, 2021

Yes, it needs newer @patternfly/patternfly. I'm not sure how is this done properly.

@wojta wojta changed the title [WIP] breaking change: fix/removing inline styles from SVG icons breaking change: fix/removing inline styles from SVG icons Jan 15, 2021
@wojta wojta force-pushed the issue-4767-breadcrumbs-dividers branch from d444ac8 to 6831af9 Compare January 15, 2021 20:20
@tlabaj
Copy link
Contributor

tlabaj commented Jan 19, 2021

The core version has been updated. You can rebase this PR now to get the styles

@wojta wojta force-pushed the issue-4767-breadcrumbs-dividers branch from 6831af9 to 1615259 Compare January 19, 2021 20:31
@wojta
Copy link
Member Author

wojta commented Jan 19, 2021

Rebased, demos look good, styles are there now.

@tlabaj
Copy link
Contributor

tlabaj commented Feb 3, 2021

this one has a conflict. Can you please rebase again.

@wojta wojta force-pushed the issue-4767-breadcrumbs-dividers branch from 1615259 to f733e11 Compare February 3, 2021 21:39
@mcoker
Copy link
Contributor

mcoker commented Feb 8, 2021

Everything looks good visually, though a couple of discrepancies I see that I'd like to confirm:

  • On the icons page, the vertical-align value is different. The inline style is currently -0.375em, while the .pf-svg-vertical-align class is fixed at -0.125em. However, the icons page is the only place I've seen anything other than -0.125em used as the vertical align value.
  • Spot checking a few components, it looks like we're currently applying vertical-align inline on svg's, yet in this PR, we aren't applying the .pf-svg-vertical-align class. Examples are empty state, button, and data-list.

Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

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

Since you put 'pf-svg-vertical-align' in the common styles there's no to introduce @patternfly/react-styles as a dependency. Someone might want to use icons without styles.

packages/react-icons/src/createIcon.tsx Outdated Show resolved Hide resolved
packages/react-icons/src/createIcon.tsx Outdated Show resolved Hide resolved
@wojta wojta force-pushed the issue-4767-breadcrumbs-dividers branch from f733e11 to 0585aab Compare February 9, 2021 09:18
@wojta wojta requested a review from redallen February 9, 2021 09:39
Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

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

Sorry I missed @mcoker 's comment yesterday!

packages/react-icons/src/createIcon.tsx Outdated Show resolved Hide resolved
@wojta wojta force-pushed the issue-4767-breadcrumbs-dividers branch 4 times, most recently from 72c68aa to 6bc0771 Compare February 9, 2021 17:09
@jenny-s51 jenny-s51 force-pushed the issue-4767-breadcrumbs-dividers branch 2 times, most recently from 8b2e529 to be96b98 Compare March 29, 2023 13:26
@nicolethoen
Copy link
Contributor

I added an update to this issue: #8794 to make sure the react-icons read me is updated. Once CI passes here, we can get this merged.

Copy link
Contributor

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

CI is passing - ready for review @nicolethoen !

@jenny-s51 jenny-s51 requested a review from mcoker March 31, 2023 15:48
@@ -29,7 +29,7 @@ export const CustomPreviewFileUpload: React.FunctionComponent = () => {
>
{value && (
<div className="pf-u-m-md">
<FileUploadIcon size="lg" /> Custom preview here for your {value.size}-byte file named {value.name}
<FileUploadIcon width="2em" height="2em" /> Custom preview here for your {value.size}-byte file named {value.name}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why this change, but I'm also not a React dev :-)

Copy link
Contributor

@jenny-s51 jenny-s51 Mar 31, 2023

Choose a reason for hiding this comment

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

The size prop was removed in createIcon.tsx and the default is now small, so I had to set this custom styling here to match the styling we had before @srambach - not sure if there is a better way to do this

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I see that now. 🤷‍♀️

@@ -29,7 +29,7 @@ export const CustomPreviewFileUpload: React.FunctionComponent = () => {
>
{value && (
<div className="pf-u-m-md">
<FileUploadIcon size="lg" /> Custom preview here for your {value.size}-byte file named {value.name}
<FileUploadIcon width="2em" height="2em" /> Custom preview here for your {value.size}-byte file named {value.name}
Copy link
Member

Choose a reason for hiding this comment

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

Ok, I see that now. 🤷‍♀️

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Nice job @jenny-s51! 🚀

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

LGTM Jenny!
Do we have a code mod issue for this?

Copy link
Contributor

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

@jenny-s51 We can merge this one once it is rebased

@jenny-s51 jenny-s51 force-pushed the issue-4767-breadcrumbs-dividers branch 2 times, most recently from a2fcbd8 to 9fde82a Compare April 5, 2023 14:07
@jenny-s51 jenny-s51 force-pushed the issue-4767-breadcrumbs-dividers branch from 9fde82a to 0cae3eb Compare April 5, 2023 15:08
@nicolethoen nicolethoen merged commit 1dfb69d into patternfly:v5 Apr 6, 2023
10 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@5.0.0-alpha.59
  • @patternfly/react-core@5.0.0-alpha.58
  • @patternfly/react-docs@6.0.0-alpha.63
  • @patternfly/react-icons@5.0.0-alpha.9
  • demo-app-ts@5.0.0-alpha.42
  • @patternfly/react-integration@5.0.0-alpha.20
  • @patternfly/react-table@5.0.0-alpha.59

Thanks for your contribution! 🎉

jelly added a commit to jelly/cockpit-machines that referenced this pull request Feb 28, 2024
According to the PatternFly codemod this no longer is valid, it still
works however but `orange` is not the same as
`--pf-v5-global--warning-color--100` so this was wrong anyway.

patternfly/patternfly-react#5275
jelly added a commit to jelly/cockpit-machines that referenced this pull request Feb 29, 2024
According to the PatternFly codemod this no longer is valid, it still
works however but `orange` is not the same as
`--pf-v5-global--warning-color--100` so this was wrong anyway.

patternfly/patternfly-react#5275
martinpitt pushed a commit to cockpit-project/cockpit-machines that referenced this pull request Feb 29, 2024
According to the PatternFly codemod this no longer is valid, it still
works however but `orange` is not the same as
`--pf-v5-global--warning-color--100` so this was wrong anyway.

patternfly/patternfly-react#5275
martinpitt pushed a commit to martinpitt/cockpit-machines that referenced this pull request Apr 30, 2024
According to the PatternFly codemod this no longer is valid, it still
works however but `orange` is not the same as
`--pf-v5-global--warning-color--100` so this was wrong anyway.

patternfly/patternfly-react#5275

Cherry-picked from main commit f0ba89d
martinpitt pushed a commit to cockpit-project/cockpit-machines that referenced this pull request May 1, 2024
According to the PatternFly codemod this no longer is valid, it still
works however but `orange` is not the same as
`--pf-v5-global--warning-color--100` so this was wrong anyway.

patternfly/patternfly-react#5275

Cherry-picked from main commit f0ba89d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change 💥 this change requires a major release and has API changes.
Projects
None yet