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

Remove <Fa /> component #67

Closed
kopax opened this issue Jan 4, 2019 · 3 comments
Closed

Remove <Fa /> component #67

kopax opened this issue Jan 4, 2019 · 3 comments
Labels
dependency enhancement New feature or request

Comments

@kopax
Copy link
Contributor

kopax commented Jan 4, 2019

v4

Font awesome released a V5 version and this time, they improved the use case for webpack and react.

They now have dedicated components, font, svg, and react component, making our interface obselete.

This ticket consist of testing the V5 in our project, and replacing V4 to V5.

important

They are some breaking change, read the Upgrade guide for more info.

@kopax
Copy link
Contributor Author

kopax commented Jan 4, 2019

This is an example of usage of the v5:

It is possible to use a configuration file to keep using string when using an icon:

fontawesome.config.js:

// `library` is needed for injecting the icon it the fontawesome engine
import { library } from '@fortawesome/fontawesome-svg-core';
// Regular icon
import { faAddressCard } from '@fortawesome/free-regular-svg-icons';
// Basic icon svg
import {
  faServer
} from '@fortawesome/free-solid-svg-icons';
// Brand icon svg
import {
  faFacebookSquare,
  faTwitterSquare,
  faLinkedin,
  faGithub,
  faDocker,
  faPython,
  faReact,
  faCss3Alt,
  faHtml5,
  faJava,
  faJs,
  faJsSquare,
} from '@fortawesome/free-brands-svg-icons';
// Initialize icon, this will be allowed anywhere in the app using icon="server", 
// or icon={'fab', 'java'} for brand icon
library.add(
  faFacebookSquare,
  faTwitterSquare,
  faLinkedin,
  faGithub,
  faDocker,
  faPython,
  faReact,
  faCss3Alt,
  faHtml5,
  faJava,
  faJs,
  faJsSquare,
);

Just import this file in App.js, this allow to configure icon globally and import the strictly necessary at one place instead of everywhere.

Otherwise, it is possible to pass the import to <FontAwesomeIcon icon={faFacebookSquare} />, but this requires to import faFacebookSquare every time you need to use it.

It can be use with react:

import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
<FontAwesomeIcon className="my-4" size="4x" icon={['fab', 'java']} />

note that fab prefix is used as new prefix for brand icon

The size props still exist and doesn't require any migration: see: https://github.com/FortAwesome/react-fontawesome/blob/master/src/components/FontAwesomeIcon.js#L126

This also means fontawesome 5 doesn't need anymore webpack configuration.

To install:

$ npm install --save \
  @fortawesome/fontawesome-svg-core \
  @fortawesome/free-brands-svg-icons \
  @fortawesome/free-regular-svg-icons  \
  @fortawesome/free-solid-svg-icons \
  @fortawesome/react-fontawesome

In case you wonder what is @fortawesome: it is the official namespace for fontawesome v5.

@kopax
Copy link
Contributor Author

kopax commented Jan 4, 2019

/cc @santaclauze can we state where is fontawesome actually used ?

  • @bootstrap-styled/rsg-components
  • @bootstrap-styled/navigation-bar ?

@kopax kopax added enhancement New feature or request dependency labels Feb 1, 2019
kopax pushed a commit that referenced this issue Feb 2, 2019
To upgrade your Fa component, we recommend that you use FontAwesome 5, you can read how on #67

BREAKING CHANGE: Fa and FaStacked are removed

#67
kopax pushed a commit that referenced this issue Feb 2, 2019
# [3.0.0](v2.0.22...v3.0.0) (2019-02-02)

### Bug Fixes

* **Fa:** Remove Fa from v4 as it is not bootstrap related at all ([66a1f7d](66a1f7d)), closes [#67](#67) [#67](#67)

### BREAKING CHANGES

* **Fa:** Fa and FaStacked are removed
@kopax kopax closed this as completed Feb 2, 2019
@lock
Copy link

lock bot commented Feb 2, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependency enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant