-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move FA icons code into an utility file
- Loading branch information
1 parent
704c2e0
commit 753cb74
Showing
2 changed files
with
56 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
config, | ||
library, | ||
} from '@fortawesome/fontawesome-svg-core'; | ||
import '@fortawesome/fontawesome-svg-core/styles.css'; | ||
import { faGithub } from '@fortawesome/free-brands-svg-icons'; | ||
import { faTimesCircle } from '@fortawesome/free-regular-svg-icons'; | ||
import { | ||
faArrowCircleLeft, | ||
faArrowCircleRight, | ||
faBook, | ||
faBookReader, | ||
faCoffee, | ||
faHome, | ||
faQuestionCircle, | ||
faUserCog, | ||
} from '@fortawesome/free-solid-svg-icons'; | ||
|
||
// See https://github.com/FortAwesome/react-fontawesome#integrating-with-other-tools-and-frameworks | ||
config.autoAddCss = false; // Tell Font Awesome to skip adding the CSS automatically since it's being imported above | ||
|
||
/** | ||
* Configure the Font-Awesome icons library by pre-registering icon definitions so that we do not have to explicitly pass them to render an icon. | ||
* Necessary for proper server-side rendering of icons. | ||
* | ||
* XXX Since Next.js 10, it is possible to import CSS file outside of the _app.tsx file. | ||
* We leverage this new feature to configure our Font-Awesome icons outside of _app to avoid cluttering that file. | ||
* | ||
* @example <FontAwesomeIcon icon={['fas', 'home']} /> | ||
* | ||
* @see https://fontawesome.com/how-to-use/javascript-api/methods/library-add | ||
* @see https://nextjs.org/blog/next-10#importing-css-from-third-party-react-components | ||
*/ | ||
|
||
// Import @fortawesome/free-brands-svg-icons | ||
library.add( | ||
faGithub, | ||
); | ||
|
||
// Import @fortawesome/free-regular-svg-icons | ||
library.add( | ||
faTimesCircle, | ||
); | ||
|
||
// Import @fortawesome/free-solid-svg-icons | ||
library.add( | ||
faArrowCircleLeft, | ||
faArrowCircleRight, | ||
faBook, | ||
faBookReader, | ||
faCoffee, | ||
faHome, | ||
faQuestionCircle, | ||
faUserCog, | ||
); |
753cb74
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not what you expected? Are your scores flaky? Run Lighthouse on Foo
If scores continue to be inconsistent consider running all audits on Foo