// Copyright 2021, University of Colorado Boulder

/**
 * Button in the NavigationBar that opens the PreferencesDialog.
 *
 * @author Jesse Greenberg (PhET Interactive Simulations)
 */

import UserCog from '../../../sherpa/js/fontawesome-5/solid/UserCog.js';
import Tandem from '../../../tandem/js/Tandem.js';
import joist from '../joist.js';
import JoistButton from '../JoistButton.js';
import joistStrings from '../joistStrings.js';
import PreferencesDialog from './PreferencesDialog.js';

class NavigationBarPreferencesButton extends JoistButton {

  /**
   * @param {PreferencesConfiguration} preferencesConfiguration
   * @param {PreferencesProperties} preferencesProperties
   * @param {LookAndFeel} lookAndFeel
   * @param {Property.<boolean>} simSoundProperty
   * @param {Tandem} tandem
   */
  constructor( preferencesConfiguration, preferencesProperties, lookAndFeel, simSoundProperty ) {

    const icon = new UserCog( {
      fill: lookAndFeel.navigationBarTextFillProperty,
      maxWidth: 25
    } );

    let preferencesDialog = null;
    super( icon, lookAndFeel.navigationBarFillProperty, Tandem.OPT_OUT, {
      listener: () => {
        if ( !preferencesDialog ) {
          preferencesDialog = new PreferencesDialog( preferencesConfiguration, preferencesProperties, simSoundProperty, {
            tandem: Tandem.OPT_OUT
          } );
        }

        preferencesDialog.show();
        preferencesDialog.focusSelectedTab();
      },
      highlightExtensionWidth: 5,
      highlightExtensionHeight: 10,

      // pdom
      innerContent: joistStrings.preferences.title
    } );
  }
}

joist.register( 'NavigationBarPreferencesButton', NavigationBarPreferencesButton );
export default NavigationBarPreferencesButton;
@@ -186,23 +186,87 @@
 %0Aimport 
-UserCog
+Path from '../../../scenery/js/nodes/Path.js';%0Aimport userCogSolidShape
  from '.
@@ -301,21 +301,25 @@
 e-5/
-solid/UserCog
+userCogSolidShape
 .js'
@@ -987,16 +987,32 @@
 new 
-UserCog(
+Path( userCogSolidShape,
  %7B%0A 

Convert fontawesome 5 to use string and Shape files, see https://github.com/phetsims/sherpa/issues/83