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

Panel's expandIcon and collapseIcon Properties Accept Only Strings, Not Elements #2437

Closed
joedotchin opened this issue Nov 15, 2021 · 2 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@joedotchin
Copy link

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)
Please fork the codesandbox below and create a case demonstrating your bug report. Issues without a codesandbox have much less possibility to be reviewed.

https://codesandbox.io/s/thirsty-golick-s1ohk?file=/src/demo/PanelDemo.js

Current behavior
Panel component will allow a string like 'pi pi-chevron-up' but not an element like , as your other components allow.

Expected behavior
Panel component should accept an element like for its collapseIcon and expandIcon properties.

Please tell us about your environment:

  • React version:
    17.0.1

  • PrimeReact version:
    7.0.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
@melloware
Copy link
Member

melloware commented Nov 15, 2021

Yikes! I see you are using FontAwesome React which is way overbloated.

Instead of

const toggleIcon = options.collapsed ? (
      <FontAwesomeIcon icon={faChevronDown} />
    ) : (
      <FontAwesomeIcon icon={faChevronUp} />
    );

Just

const toggleIcon = options.collapsed ? 'fas fa-chevron-up' : 'fas fa-chevron-down`;

Just add fontawesome to your package.json like this...
@fortawesome/fontawesome-free": "5.15.4"

And in your app class just import it...

import 'primereact/resources/primereact.min.css';
import 'primeicons/primeicons.css';
import 'primeflex/primeflex.min.css';
import '@fortawesome/fontawesome-free/css/all.min.css';
import './App.scss';


const App = () => {

Then anywhere you see pi pi-search you can use FontAwesome fas fa-search...

@melloware
Copy link
Member

@joedotchin any update on this? Those <FontAwesomeIcon icon={faChevronDown} /> render full tags like <i class="fas fa-search></i> which is not really what you want right?

@mertsincan mertsincan self-assigned this Dec 13, 2021
@mertsincan mertsincan added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Dec 13, 2021
@mertsincan mertsincan added this to the 8.0.0 milestone Dec 13, 2021
@mertsincan mertsincan modified the milestones: 8.0.0, 7.1.0 Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

3 participants