From 3b17776cd4a398985a5069db28992ba231b82c40 Mon Sep 17 00:00:00 2001 From: Gary Kang <42440452+kangaree@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:30:48 -0400 Subject: [PATCH] [PLAY-1618] Font Awesome Setup Documentation - Phase 1 (#3865) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **What does this PR do?** Add Font Awesome setup docs for Ruby on Rails asset pipeline. [PLAY-1618](https://runway.powerhrg.com/backlog_items/PLAY-1618) **Screenshots:** Screenshots to visualize your addition/change ![Screenshot 2024-10-31 at 8 12 12 AM](https://github.com/user-attachments/assets/70af7291-6f8d-49c0-997c-578281c97790) **How to test?** Steps to confirm the desired behavior: 1. Go to /guides/getting_started 2. Click Font Awesome 3. Review the doc #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. --------- Co-authored-by: Mark Co-authored-by: Mark Rosenberg <38965626+markdoeswork@users.noreply.github.com> --- .../guides/getting_started/font_awesome.md | 73 +++++++++++++++++++ .../config/initializers/global_variables.rb | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 playbook-website/app/views/guides/getting_started/font_awesome.md diff --git a/playbook-website/app/views/guides/getting_started/font_awesome.md b/playbook-website/app/views/guides/getting_started/font_awesome.md new file mode 100644 index 0000000000..732a79757b --- /dev/null +++ b/playbook-website/app/views/guides/getting_started/font_awesome.md @@ -0,0 +1,73 @@ +--- +title: Font Awesome Setup +description: Playbook seamlessly integrates with Font Awesome, a leading icon library known for its extensive collection of high-quality, scalable icons. This integration not only enhances the visual appeal of websites and applications but also improves overall usability. +icon: font-awesome +--- + +Playbook seamlessly integrates with [Font Awesome](https://fontawesome.com/), a leading icon library known for its extensive collection of high-quality, scalable icons. This integration not only enhances the visual appeal of websites and applications but also improves overall usability. + +Some Font Awesome benefits: + +**1. Wide Range of Icons:** Font Awesome offers a vast selection of icons to suit a variety of needs. You can easily find the perfect icon for your project through their [icon search](https://fontawesome.com/search). +**2. Ease of Use:** The icons are straightforward to implement. With just a few lines of code, you can quickly and easily add visual elements to your web projects. Note, a Pro subscription is required for access to a wider range of icons beyond the [Free set](https://fontawesome.com/search?o=r&m=free&s=regular). +**3. Visual Appeal:** Incorporating these icons can improve the aesthetic of your site or application, making it more attractive to users. With Playbook, you have the flexibility to customize color, size, and animations. +**4. User-Friendliness:** Icons can help users navigate and understand your website or application more efficiently, enhancing their overall experience. Font Awesome icons are web fonts compatible with most browsers and are optimized for performance and accessibility. + +Integrating Font Awesome with Playbook ensures that you have access to these benefits, making your projects more polished and professional. + +![fontawesome](https://github.com/user-attachments/assets/638b63ad-56d3-4819-8e05-fcbb175bedc7) + +## Ruby on Rails Setup (default with asset pipeline) + +**Make sure you are on Rails 7 or higher.** + +**1.** Follow the [Ruby on Rails Setup getting started page](/guides/getting_started/ruby_on_rails_setup) to setup Playbook with your Rails project. + +**2.** Setup Pro or Free Font Awesome to use our Icon Component. + +**Pro:** + +```rb +# app/assets/stylesheets/application.scss + @import "font-awesome-pro"; + @import "font-awesome-pro/solid"; + @import "font-awesome-pro/regular"; + @import "playbook"; +``` + +```rb +# app/Gemfile + source "https://token:TOKEN@dl.fontawesome.com/basic/fontawesome-pro/ruby/" do + gem "font-awesome-pro-sass", "6.2.0" + end +``` + +**Free:** + +*Currently only [Free Regular](https://fontawesome.com/search?o=r&m=free&s=regular) icons are supported in our icon component structure.* + +```rb +# app/assets/stylesheets/application.scss + @import "font-awesome"; +``` + +```rb +# app/Gemfile + source "https://token:TOKEN@dl.fontawesome.com/basic/fontawesome-pro/ruby/" do + gem "font-awesome-pro-sass", "6.2.0" + end +``` + +**3.** Bundle all the things! + +```sh +bundle install +``` + +**4.** **Go build awesome stuff!** + +Refer to our [Icon kit](/kits/icon) to get started with Font Awesome icons in Playbook. + +```rb +<%= pb_rails("icon", props: { icon: "font-awesome", fixed_width: true }) %> +``` diff --git a/playbook-website/config/initializers/global_variables.rb b/playbook-website/config/initializers/global_variables.rb index ca695bca59..c88293355d 100644 --- a/playbook-website/config/initializers/global_variables.rb +++ b/playbook-website/config/initializers/global_variables.rb @@ -70,7 +70,7 @@ } # Move these pages to the end of the Getting Started page -page_names = ["HTML&_CSS", "figma_setup", "how_to_theme", "dependencies"] +page_names = ["HTML&_CSS", "figma_setup", "how_to_theme", "dependencies", "font_awesome"] move_pages = navigation[:getting_started][:pages].select { |page| page_names.include?(page[:page_id]) } navigation[:getting_started][:pages].reject! { |page| page_names.include?(page[:page_id]) }